Abstract GSFrameBase class and callback

This commit is contained in:
Nekotekina 2014-08-25 02:23:26 +04:00
parent 50b5d72bb2
commit 84c5899faf
7 changed files with 94 additions and 109 deletions

View file

@ -1,80 +1,11 @@
#include "stdafx.h"
#include <wx/glcanvas.h>
#include "Gui/GLGSFrame.h"
#ifndef _WIN32
#include <dirent.h>
#endif
#include "rPlatform.h"
rCanvas::rCanvas(void *parent)
{
handle = static_cast<void*>(new wxGLCanvas(static_cast<wxWindow *>(parent),wxID_ANY,NULL));
}
rCanvas::~rCanvas()
{
delete static_cast<wxGLCanvas*>(handle);
}
bool rCanvas::SetCurrent(void *ctx)
{
return static_cast<wxGLCanvas*>(handle)->SetCurrent(*static_cast<wxGLContext *>(ctx));
}
rGLFrame::rGLFrame()
{
handle = static_cast<void*>(new GLGSFrame());
}
rGLFrame::~rGLFrame()
{
delete static_cast<GLGSFrame*>(handle);
}
void rGLFrame::Close()
{
static_cast<GLGSFrame*>(handle)->Close();
}
bool rGLFrame::IsShown()
{
return static_cast<GLGSFrame*>(handle)->IsShown();
}
void rGLFrame::Hide()
{
static_cast<GLGSFrame*>(handle)->Hide();
}
void rGLFrame::Show()
{
static_cast<GLGSFrame*>(handle)->Show();
}
void *rGLFrame::GetNewContext()
{
return static_cast<void *>(new wxGLContext(
static_cast<GLGSFrame*>(handle)->GetCanvas()
));
}
void rGLFrame::Flip(void *ctx)
{
static_cast<GLGSFrame*>(handle)->Flip(
static_cast<wxGLContext*>(ctx));
}
void rGLFrame::SetCurrent(void *ctx)
{
static_cast<GLGSFrame*>(handle)->GetCanvas()->SetCurrent(*static_cast<wxGLContext*>(ctx));
}
rImage::rImage()
{
handle = static_cast<void*>(new wxImage());

View file

@ -2,39 +2,8 @@
#include <vector>
#include <string>
struct rCanvas
{
rCanvas(void *parent);
rCanvas(const rCanvas &) = delete;
~rCanvas();
/*rGLContext*/void *GetCurrent();
bool SetCurrent(/*rGLContext &*/ void *ctx);
void *handle;
};
struct rGLFrame
{
rGLFrame();
rGLFrame(const rGLFrame &) = delete;
~rGLFrame();
void Close();
bool IsShown();
void Hide();
void Show();
void *handle;
void SetCurrent( void *ctx);
void *GetNewContext();
void Flip(/*rGLContext*/void *ctx);
};
struct rPlatform
{
rGLFrame *getGLGSFrame();
static rPlatform &getPlatform();
static std::string getConfigDir();
};