コンパイルは、gccの場合、
gcc -o RasterScroll RasterScroll.c -mwindows
として下さい。
RasterScroll.c
// ラスタースクロール
// コンパイル方法 bcc32 -W RasterScroll.c
// gcc -o RasterScroll RasterScroll.c -mwindows
#include <windows.h>
#include <math.h>
int WINAPI WinMain(
HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow
){
int screen_width = GetSystemMetrics(0), screen_height = GetSystemMetrics(1), line, count = 0;
HDC screen_dc = GetDC(0), mem_dc;
SelectObject(mem_dc = CreateCompatibleDC(screen_dc), CreateCompatibleBitmap(screen_dc, screen_width, screen_height));
BitBlt(mem_dc, 0, 0, screen_width, screen_height, screen_dc, 0, 0, SRCCOPY);
while(!(GetKeyState(2) & (1 << 15))) {
for(line = 0; line < screen_height; line++)
BitBlt(screen_dc, (int)(sin((line) * 3.14 / screen_height) * sin((count++) / 40.0) * 60), line, screen_width, 1, mem_dc, 0, line,SRCCOPY);
Sleep(30);
}
InvalidateRect(0, 0, 1);
return 0;
}

コメント