ik wil een spel maken dat zo klein mogelijk is. ik heb namelijk maar 96Kb om een spelletje in te maken. maar nu vroeg ik me af hoe ik het beste het formaat van mijn executable naar beneden krijg. ik heb op dit moment maar 63 regels aan code maar door alle troep die geinclude word om een windowtje te maken is de exe al bijna 10k. aangezien ik al regelmatig redelijk uitgebreide dingen heb gezien in slechts 4 Kb denk ik toch dat ik wat fout doe 
ik heb enkel dit als code:
ik heb enkel dit als code:
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
| #include <windows.h>
LRESULT CALLBACK MainWndProc
(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch(message)
{
case WM_DESTROY:
::PostQuitMessage(0);
return 0;
}
return ::DefWindowProc (hwnd, message, wParam, lParam);
}
int WINAPI WinMain
(HINSTANCE hInst, HINSTANCE hPrevInst,
char * cmdParam, int cmdShow)
{
WNDCLASSEX _class;
_class.cbSize = sizeof (WNDCLASSEX);
_class.style = 0;
_class.lpszClassName = "test";
_class.hInstance = hInst;
_class.hIcon = 0;
_class.hIconSm = 0;
_class.lpszMenuName = 0;
_class.cbClsExtra = 0;
_class.cbWndExtra = 0;
_class.hbrBackground = reinterpret_cast<HBRUSH> (COLOR_WINDOW + 1);
_class.hCursor = ::LoadCursor (0, IDC_ARROW);
_class.lpfnWndProc = MainWndProc;
::RegisterClassEx(&_class);
HWND _hwnd;
_hwnd=::CreateWindowEx(0,"test","test",
WS_OVERLAPPEDWINDOW | WS_VISIBLE,CW_USEDEFAULT,0,
CW_USEDEFAULT,0,0,0,hInst,0);
::ShowWindow (_hwnd, SW_SHOWNORMAL);
::UpdateWindow (_hwnd);
// The main message loop
MSG msg;
int status;
while ((status = ::GetMessage (&msg, 0, 0, 0)) != 0)
{
if (status == -1)
return -1;
::TranslateMessage (&msg);
::DispatchMessage (&msg);
}
return msg.wParam;
return 0;
} |