63 lines
1.2 KiB
C++
63 lines
1.2 KiB
C++
module;
|
|
#include <Windows.h>
|
|
#include <vector>
|
|
#include <wrl/client.h>
|
|
#include <chrono>
|
|
|
|
export module MegaEngine;
|
|
|
|
import Input;
|
|
import Graphics;
|
|
import GameObject;
|
|
import Steve;
|
|
import Obstacle;
|
|
import ScoreBoard;
|
|
import BackGround;
|
|
|
|
using namespace std;
|
|
using namespace std::chrono;
|
|
|
|
export class Game
|
|
{
|
|
public:
|
|
static constexpr LPCWSTR wndClassName = L"1mGameWnd";
|
|
static constexpr LPCWSTR gameTitle = L"1mGame";
|
|
static constexpr int wndHeight = 450;
|
|
static constexpr int wndWidth = 1050;
|
|
|
|
void Run();
|
|
|
|
private:
|
|
Texture image;
|
|
Steve steve;
|
|
Obstacle obs;
|
|
ScoreBoard score;
|
|
BackGround background;
|
|
steady_clock::time_point last;
|
|
float delta;
|
|
|
|
enum Status { Begin, Running, End } status;
|
|
|
|
HWND hwnd = nullptr;
|
|
bool done = false;
|
|
|
|
void StartUp();
|
|
|
|
void Update();
|
|
void Render();
|
|
void LaterUpdate();
|
|
|
|
void CleanUp();
|
|
|
|
void CreateWnd();
|
|
bool PeekMsg();
|
|
bool Done();
|
|
|
|
void GameOver();
|
|
void ReStart();
|
|
|
|
static LRESULT CALLBACK WndProcSetUp(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
|
static LRESULT CALLBACK WndProcThunk(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
|
LRESULT WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
|
};
|