guiapp.cpp
来自「老外为HGE写的扩展GUI」· C++ 代码 · 共 53 行
CPP
53 行
#include <stdio.h>
#include "guiapp.h"
GUIApp::GUIApp(HGE *hge) : hgeGUI () {
myHge = hge;
dummyCtrl *ctlr = new dummyCtrl ();
AddCtrl(ctlr);
}
bool GUIApp::LoadCursor ( const char*fname, float w, float h ) {
cursorTexture = myHge->Texture_Load(fname);
if ( cursorTexture ) {
cursorSprite=new hgeSprite(cursorTexture,0,0,w,h);
SetCursor(cursorSprite);
return true;
} else {
return false;
}
}
bool GUIApp::Input_GetKeyState (int key) {
return myHge->Input_GetKeyState(key);
}
void GUIApp::PreRender () {
}
void GUIApp::PostRender () {
}
bool GUIApp::FrameFunc() {
float dt=myHge->Timer_GetDelta();
Update(dt);
myHge->Gfx_BeginScene();
myHge->Gfx_Clear(0);
PreRender();
Render();
PostRender();
myHge->Gfx_EndScene();
return false;
}
hgeFont *GUIApp::CreateFont ( const char *fname ) {
FILE * in = fopen (fname,"r");
if ( !in ) {
return 0;
} else {
fclose(in);
hgeFont *fnt = new hgeFont(fname);
return fnt;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?