📄 application.h
字号:
/********************************************************************
created: 2003/04/18
author: Carl Johansson
copyright: Copyright 2003 (C) Carl Johansson
email: charliec@home.se
description: Base class for Win32 applications
*********************************************************************/
#ifndef _APPLICATION_H_
#define _APPLICATION_H_
#define APPLICATION_NAME "Win32 Framework"
#include <windows.h>
#include <window.h>
#include <singleton.h>
class Win32Application : public Singleton<Win32Application>
{
public:
Win32Application();
virtual ~Win32Application();
// Creates the application
int Create( HINSTANCE hInst, LPSTR cmdLine, int cmdShow,
int width = DEFAULT_WIDTH, int height = DEFAULT_HEIGHT );
virtual bool Init();
virtual void Close();
// Callback for windows
static LRESULT CALLBACK WindowProc( HWND hWnd, unsigned int message, WPARAM wParam, LPARAM lParam );
// Executes core loop code
virtual void CoreLoop();
// Callbacks for window messages
virtual void OnActivate( BOOL active );
virtual void OnClose();
virtual void OnDestroy();
virtual void OnKeyDown( unsigned int key );
virtual void OnKeyUp( unsigned int key );
virtual void OnSize( int width, int height );
// Returns the window handle
HWND GetHandle() { return m_win.GetHwnd(); }
// Returns the Win32Window
Win32Window * GetWindow() { return &m_win; }
protected:
void Quit(); // Called when user Quits the program
HWND m_hwnd;
HINSTANCE m_hInst;
Win32Window m_win;
private:
int Loop(); // After initilization the game will run inside this member
};
#endif /* _APPLICATION_H_ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -