티스토리 뷰

API/DF.project

df_main-총알발사수정용

猫猫 2014. 10. 9. 17:16
반응형

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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#include <Windows.h>
#include <tchar.h>
#include "Scene_Tower.h"
#include "ST.h"
#include "BulletManager.h"
 
ST* ST::instance = NULL;
BulletManager* BulletManager::instance = NULL;
Scene*    g_pScene = NULL;
 
 
LRESULT CALLBACK WndProc(HWND,UINT,WPARAM,LPARAM);
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd )
{
 
    WNDCLASSEX wc;
    wc.cbSize            = sizeof(WNDCLASSEX);
    wc.style            = CS_HREDRAW | CS_VREDRAW;
    wc.lpfnWndProc        = WndProc;
    wc.cbClsExtra        = 0;
    wc.cbWndExtra        = 0;
    wc.hInstance        = hInstance;
    wc.hIcon            = LoadIcon( NULL, IDI_APPLICATION );
    wc.hIconSm            = LoadIcon( NULL, IDI_APPLICATION );
    wc.hCursor            = LoadCursor( NULL, IDC_ARROW );
    wc.hbrBackground    = (HBRUSH)GetStockObject(WHITE_BRUSH);
    wc.lpszMenuName        = NULL;
    wc.lpszClassName    = L"ApiDNF";
    RegisterClassEx(&wc);
    HWND hWnd = 
        CreateWindow(
        wc.lpszClassName,L"ApiDNF",
        WS_CAPTION|WS_SYSMENU, 
        0,0,1300,600,
        NULL, NULL,hInstance, NULL);
 
    ShowWindow(hWnd,SW_SHOW);
    MSG msg;
    ZeroMemory(&msg,sizeof(msg));
 
    DWORD ET = timeGetTime();
    DWORD DT = timeGetTime();
 
    while( msg.message != WM_QUIT )
    {
        DT = timeGetTime() - ET;
        ET = timeGetTime();
 
        float fDT = DT / 1000.0f;
 
        g_pScene->run(fDT);
 
        if( PeekMessage(&msg, NULL, 0, 0, PM_REMOVE) ) {
            DispatchMessage(&msg);
            TranslateMessage(&msg);
        }
    }
    g_pScene->dealloc();
    delete g_pScene;
    return 0;
}
 
LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
    switch (msg)
    {
    case WM_CREATE:
        {
            ST::call()->makeBackBuffer(hWnd);
            g_pScene = new Scene_Tower;
            g_pScene->init();
 
            break;
        }
    case WM_PAINT:
        {
            SIZE w = ST::call()->m_sWinSize;
            HDC b = ST::call()->m_hBackDC;
            PAINTSTRUCT ps;
            HDC hDC = BeginPaint(hWnd, &ps);
            BitBlt(hDC, 0, 0, w.cx, w.cy, b, 0, 0, SRCCOPY);
            EndPaint(hWnd, &ps);
            break;
        }
    case WM_DESTROY:
        {
            DeleteDC(ST::call()->m_hBackDC);
            DeleteObject(ST::call()->m_hBackBmp);
            DeleteDC(ST::call()->m_hMemDC);
            PostQuitMessage(NULL);
            break;
        }
    }
    return DefWindowProc(hWnd, msg, wParam, lParam);
}


반응형

'API > DF.project' 카테고리의 다른 글

objectbullet.h & objectbullet.cpp  (0) 2014.10.09
object.h & object.cpp  (0) 2014.10.09
object.h-jump수정  (0) 2014.10.07
object.h-jump수정  (0) 2014.10.07
objecthero.h-jump수정분  (0) 2014.10.07