|
楼主 |
发表于 2011-4-12 12:36:00
|
显示全部楼层
Re:FlowControl的新问题
//完整的测试代码 , Blue类中增加了一个按钮,但是按钮只能显示,不能更新
using namespace hgl;
class Blue:public FlowObject
{
public:
Blue()
{
Control = new Button(0,0,100,100);
}
void Draw()
{
glClearColor(0,0,1,1);
ClearScreen();
}
};//class Blue
class Red:public FlowObject
{
public:
void Draw()
{
glClearColor(1,0,0,1);
ClearScreen();
}
};//class Red
class GameControl:public FlowControl
{
bool MouseLeftDoubleClickProc(int,int,uint)
{
Exit(new Red);
return(true);
}
public:
GameControl(FlowObject *obj)
{
SetStart(obj);
SetEventCall(onMouseLeftDoubleClick,this,GameControl,MouseLeftDoubleClickProc);
}
void Update()
{
ProcCurState();
}
};//class GameControl
void GameMain(int,wchar_t**)
{
SystemInitInfo sii;
GameApplication app;
sii.info.ProjectName=L"自定义流程控制器";
sii.info.ProjectCode=L"Customize FlowControl";
if(!app.Init(&sii))
return;
app.SetStart(new GameControl(new Blue));
app.Run();
}
|
|