// GLWindow event handlers
void GXBaseContext::OnCreate(void) 
{
	Setup2D();

	//Setup TweakBar
	TwInit(TW_OPENGL, NULL);
	TwWindowSize(Width(), Height());
}
void GXBaseContext::OnResize(int w, int h)
{
	GLWindow::OnResize(w, h);

	Setup2D();

	//REsize tweakbar
	TwWindowSize(w, h);
}
Ejemplo n.º 3
0
void Graphics::Setup2D( double y1, double y2 )
{
	double h = y2 - y1;
	double w = h * (double) W / (double) H;
	double extra = (w - h) / 2.;
	double x1 = y1 - extra;
	double x2 = y2 + extra;
	
	Setup2D( x1, y1, x2, y2 );
}
Ejemplo n.º 4
0
void cWindowSFML::VideoResize( Uint32 Width, Uint32 Height ) {
	mWindow.WindowConfig.Width    = Width;
	mWindow.WindowConfig.Height   = Height;

	mDefaultView.SetView( 0, 0, Width, Height );

	Setup2D();

	mCursorManager->Reload();

	SendVideoResizeCb();
}
Ejemplo n.º 5
0
void Graphics::Setup2D( void )
{
	Setup2D( 0, 0, W, H );
}
Ejemplo n.º 6
0
void Framebuffer::Setup2D( void )
{
	Setup2D( 0, 0, W, H );
}
Ejemplo n.º 7
0
bool cWindowSFML::Create( WindowSettings Settings, ContextSettings Context ) {
	if ( mWindow.Created )
		return false;

	sf::VideoMode mode			= sf::VideoMode::getDesktopMode();
	mWindow.WindowConfig		= Settings;
	mWindow.ContextConfig		= Context;
	mWindow.DesktopResolution	= eeSize( mode.width, mode.height );

	if ( mWindow.WindowConfig.Style & WindowStyle::Titlebar )
		mWindow.Flags |= sf::Style::Titlebar;

	if ( mWindow.WindowConfig.Style & WindowStyle::Resize )
		mWindow.Flags |= sf::Style::Resize;

	if ( mWindow.WindowConfig.Style & WindowStyle::NoBorder )
		mWindow.Flags = sf::Style::None;

	if ( mWindow.WindowConfig.Style & WindowStyle::UseDesktopResolution ) {
		mWindow.WindowConfig.Width	= mode.width;
		mWindow.WindowConfig.Height	= mode.height;
	}

	Uint32 TmpFlags = mWindow.Flags;

	if ( mWindow.WindowConfig.Style & WindowStyle::Fullscreen )
		TmpFlags |= sf::Style::Fullscreen;

	mSFMLWindow.create( sf::VideoMode( Settings.Width, Settings.Height, Settings.BitsPerPixel ), mWindow.WindowConfig.Caption, TmpFlags, sf::ContextSettings( Context.DepthBufferSize, Context.StencilBufferSize ) );

	mSFMLWindow.setVerticalSyncEnabled( Context.VSync );

	if ( NULL == cGL::ExistsSingleton() ) {
		cGL::CreateSingleton( mWindow.ContextConfig.Version );
		cGL::instance()->Init();
	}

	CreatePlatform();

	GetMainContext();

	CreateView();

	Setup2D();

	mWindow.Created = true;
	mVisible = true;

	if ( "" != mWindow.WindowConfig.Icon ) {
		Icon( mWindow.WindowConfig.Icon );
	}

	/// Init the clipboard after the window creation
	reinterpret_cast<cClipboardSFML*> ( mClipboard )->Init();

	/// Init the input after the window creation
	reinterpret_cast<cInputSFML*> ( mInput )->Init();

	LogSuccessfulInit( GetVersion() );

	return true;
}