Last active
March 11, 2026 02:29
-
-
Save bg1bgst333/8b7baa49a5a65d9153acf96b231b486b to your computer and use it in GitHub Desktop.
CGameApplication::MainProc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ヘッダのインクルード | |
| // 独自のヘッダ | |
| #include "GameApplication.h" // CGameApplication | |
| // コンストラクタCGameApplication | |
| CGameApplication::CGameApplication() : CGraphicalApplication() { | |
| } | |
| // メインループ処理関数MainProc. | |
| void CGameApplication::MainProc(){ | |
| // キー入力で描画位置を動かす. | |
| static int x; | |
| static int y; | |
| if (GetAsyncKeyState(VK_LEFT) & 0x8000){ | |
| x -= 2; | |
| } | |
| if (GetAsyncKeyState(VK_RIGHT) & 0x8000){ | |
| x += 2; | |
| } | |
| if (GetAsyncKeyState(VK_UP) & 0x8000){ | |
| y -= 2; | |
| } | |
| if (GetAsyncKeyState(VK_DOWN) & 0x8000){ | |
| y += 2; | |
| } | |
| // "ABCDE"を描画. | |
| HDC hDC = GetDC(m_pMainWnd->m_hWnd); | |
| TextOut(hDC, x, y, _T("ABCDE"), lstrlen(_T("ABCDE"))); | |
| ReleaseDC(m_pMainWnd->m_hWnd, hDC); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment