示例#1
0
int main(int argc, char *argv[])
{
	MiscAppInit();
	if (SDL_Init(SDL_INIT_VIDEO) < 0) 
	{
		MiscTrace("Couldn't initialize SDL: %s\n",SDL_GetError());
		return 1;
	}
	MainFrameSetTitle(SSS_TITLE);
	s_screen = CanvasInit();
	MouseInit();
	KeyboardInit();
	s_screenArea.x = 0;
	s_screenArea.y = 0;
	s_screenArea.w = WINDOW_WIDTH;
	s_screenArea.h = WINDOW_HEIGHT;
	s_done = 0;
#if 0
	while (1) 
	{
		if(MainFrameGetMsg())
		{
			break;
		}
		{
			int k = 0;
			int width = WINDOW_WIDTH;
			int height = WINDOW_HEIGHT;
			CanvasLock();
			CanvasSetColor(CanvasRGB(0xff, 0, 0));
			CanvasMoveTo(0, 0);
			CanvasLineTo(width * 2, height * 2);
			for (k = height / 4; k < height / 2; k++)
			{
				CanvasSetPixel(width / 2, k, 
					CanvasRGB(0xff, 0, 0xff));
			}
			CanvasDrawLine(-width, height * 2, width * 2, -height, 
				CanvasRGB(0, 0, 0xff));
			CanvasUnlock();
			MainFrameRefresh();
		}
	}
#else
	ScriptRun();
#endif
	KeyboardRelease();
	MouseRelease();
	CanvasRelease();
	SDL_Quit();
	return 0;
}
示例#2
0
int APIENTRY WinMain(HINSTANCE hInstance, 
	HINSTANCE hPrevInstance, 
	LPTSTR lpCmdLine, 
	int nCmdShow)
{
    WNDCLASSEX wcex = { 
		sizeof(WNDCLASSEX), 
		CS_OWNDC | CS_HREDRAW | CS_VREDRAW, 
		WndProc, 
		0, 0, 
		hInstance, 
		NULL, NULL, 
		(HBRUSH)(COLOR_WINDOW + 1), 
		NULL,
		SSS_CLASS, 
		NULL
	};
    RECT R = {0, 0, WINDOW_WIDTH, WINDOW_HEIGHT};
	MiscAppInit();
	if(!RegisterClassEx(&wcex))
    {
		return 0;
    }
	AdjustWindowRect(&R, WINDOW_STYLE, FALSE);
    if (!(s_hAppWnd = CreateWindow(SSS_CLASS, 
		SSS_TITLE, 
		WINDOW_STYLE, 
		CW_USEDEFAULT,
		0, R.right - R.left, R.bottom - R.top, 
		NULL, NULL, hInstance, NULL)))
	{
        return 0;
    }
	ShowWindow(s_hAppWnd, nCmdShow);
	UpdateWindow(s_hAppWnd);
	/*
	do
	{
        if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
		{
            TranslateMessage(&msg);
            DispatchMessage(&msg);
        }
		else 
		{
			
        }
    } while(msg.message != WM_QUIT);
	or 
    while (1)
	{
        if (MainFrameGetMsg())
			break;
		CanvasLock();
		CanvasUnlock();
    }
	*/
	ScriptRun();
	CanvasRelease();
    return 0;
}