Rainbow: WinGL..

git-svn-id: svn://ultimatepp.org/upp/trunk@3603 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
unodgs 2011-07-03 19:32:27 +00:00
parent 58f76e1455
commit 329ff7c06c
4 changed files with 31 additions and 35 deletions

View file

@ -3,8 +3,6 @@
class ViewDraw : public SystemDraw {
ImageBuffer ib;
Vector<Rect> dummy_invalid;
public:
ViewDraw(Ctrl *ctrl) {}
@ -13,36 +11,14 @@ public:
class DHCtrl : Ctrl {};
void InitGl();
Vector<WString>& coreCmdLine__();
Vector<WString> SplitCmdLine__(const char *cmd);
int GlInit(HINSTANCE hInstance);
int AppMain(HINSTANCE hInstance, LPSTR lpCmdLine);
#define GUI_APP_MAIN \
void GuiMainFn_();\
\
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpCmdLine, int nCmdShow) \
{ \
UPP::coreCmdLine__() = UPP::SplitCmdLine__(UPP::FromSystemCharset(lpCmdLine)); \
UPP::AppInitEnvironment__(); \
int r = UPP::GlInit(hInstance); \
if(r > 0) { \
GuiMainFn_(); \
UPP::Ctrl::CloseTopCtrls(); \
UPP::UsrLog("---------- About to delete this log of WinGL..."); \
UPP::DeleteUsrLog(); \
return UPP::GetExitCode(); \
} else { \
Exclamation(Format("OpenGL window could not be initialized: %d", r)); \
return r; \
}\
} \
{ return UPP::AppMain(hInstance, lpCmdLine); } \
\
void GuiMainFn_()
void SetDesktop(Ctrl& desktop);
Ctrl *GetDesktop();

View file

@ -1,6 +1,8 @@
#include <CtrlCore/CtrlCore.h>
#ifdef GUI_WINGL
extern void GuiMainFn_();
NAMESPACE_UPP
@ -131,13 +133,35 @@ int GlInit(HINSTANCE hInstance)
}
//InitializeShaders();
//wglSwapIntervalEXT(0);
wglSwapIntervalEXT(0);
//SetTimeCallback(-10, THISBACK(Repaint), 1);
SetTimer(glHWND, 1, 10, NULL);
return 1;
}
Vector<WString>& coreCmdLine__();
Vector<WString> SplitCmdLine__(const char *cmd);
int AppMain(HINSTANCE hInstance, LPSTR lpCmdLine)
{
UPP::coreCmdLine__() = UPP::SplitCmdLine__(UPP::FromSystemCharset(lpCmdLine));
UPP::AppInitEnvironment__();
int r = UPP::GlInit(hInstance);
if(r > 0)
{
GuiMainFn_();
UPP::Ctrl::CloseTopCtrls();
UPP::UsrLog("---------- About to delete this log of WinGL...");
UPP::DeleteUsrLog();
UPP::DestroyGL();
return UPP::GetExitCode();
} else {
::MessageBox(NULL, Format("OpenGL window could not be initialized: %d", r), NULL, MB_ICONEXCLAMATION | MB_OK);
return r;
}
}
END_UPP_NAMESPACE
#endif

View file

@ -20,6 +20,7 @@ extern HDC hDC;
extern HGLRC hRC;
void ActivateGLContext();
void DestroyGL();
LRESULT CALLBACK glWindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
#define GUI_FB

View file

@ -28,9 +28,9 @@ void Ctrl::SetDesktop(Ctrl& q)
void Ctrl::SetWindowSize(Size sz)
{
//if(desktop)
// desktop->SetRect(sz);
screenRect = sz;
if(desktop)
desktop->SetRect(screenRect);
}
void Ctrl::InitGl()
@ -163,6 +163,7 @@ bool Ctrl::ProcessEvents(bool *quit)
//ApplyTransform(TS_AFTER_PAINT);
SwapBuffers(hDC);
painting = false;
LOGF("Fps %.2f\n", GetFps());
}
CursorSync();
return false;
@ -214,12 +215,6 @@ void Ctrl::GuiSleep0(int ms)
EnterGMutex(level);
}
Rect Ctrl::GetWndUpdateRect() const
{
GuiLock __;
return screenRect;
}
Rect Ctrl::GetWndScreenRect() const
{
GuiLock __;