Code:
HDC pDC;
HBITMAP old;
HBITMAP ourBitmap;
int* buffer;
void RenderEffect( int iTick, int* pBuffer )
{
int i, j, k;
iTick /= 4;
for( k = 0, i = 0; i < 200; i++ )
{
for( j = 0; j < 320; j++, k++ )
{
*( pBuffer + k ) = RGB( SINTAB[( i + iTick ) & 0xff],
SINTAB[( j - iTick ) & 0xff],
SINTAB[( SINTAB[iTick & 0xff] + ( k << 6 ) ) & 0xff] );
}
}
}
void Render( HDC hDC )
{
RenderEffect( GetTickCount(), buffer );
BitBlt( hDC, 0, 0, 320, 200, pDC, 0, 0, SRCCOPY );
}
void DeInitFramebuffer( void )
{
SelectObject( pDC, old );
DeleteDC( pDC );
DeleteObject( ourBitmap );
}
void InitFramebuffer( void )
{
HDC hDC;
BITMAPINFO bitInfo;
bitInfo.bmiHeader.biSize = sizeof( BITMAPINFOHEADER );
bitInfo.bmiHeader.biWidth = 300;
bitInfo.bmiHeader.biHeight = -200;
bitInfo.bmiHeader.biPlanes = 1;
bitInfo.bmiHeader.biBitCount = 32;
bitInfo.bmiHeader.biCompression = BI_RGB;
bitInfo.bmiHeader.biSizeImage = 0;
bitInfo.bmiHeader.biClrUsed = 256;
bitInfo.bmiHeader.biClrImportant = 256;
ourBitmap = CreateDIBSection( hDC, &bitInfo, DIB_RGB_COLORS, &buffer, 0, 0 );
pDC = CreateCompatibleDC( NULL );
old = SelectObject( pDC, ourBitmap );
DeleteDC( hDC );
}
the errors I get are:
main.cpp||In function `int WinMain(HINSTANCE__*, HINSTANCE__*, CHAR*, int)':|
main.cpp|15|warning: converting to `char' from `double'|
main.cpp||In function `void InitFramebuffer()':|
main.cpp|104|error: invalid conversion from `int**' to `void**'|
main.cpp|104|error: initializing argument 4 of `HBITMAP__* CreateDIBSection(HDC__*, const BITMAPINFO*, UINT, void**, void*, DWORD)'|
main.cpp|106|error: invalid conversion from `void*' to `HBITMAP__*'|
||=== Build finished: 3 errors, 1 warnings ===|
I am trying to understand why those errors are actually errors. You should be able to cast anytype of ** to a void** right?
BTW why are the code tags not working? What did I do wrong there?