Skip to main content
GameDev.net gamedev.net

PRO Tired of ads? Read GameDev.net ad-free and help keep the community independent with GameDev Pro — $3/month.

Going steady

Going steady

rick_appleton
rick_appleton
Daedalus Development · · 1 min read
1,227 0
My thesis work is coming along nicely, although I have been held up by some very unsightly bugs.

Daedalus is shaping up very nicely. A code snippet for the interested:
#include "System/Window/window.h"#include class MyWindow : public System::PlatformWindow{public:  MyWindow() : right(100)  {	MyWindow() : right(100)	{		mKeymap.RegisterMapping(				DKEY_ESC,				Functor0(this, &PlatformWindow::Close),				Input::Keyboard::KEY_DOWN);		mKeymap.RegisterMapping(				DKEY_BACKSPACE,				Functor0(this, &MyWindow::Left),				Input::Keyboard::KEY_PRESSED);		mKeymap.RegisterMapping(				DKEY_ENTER,				Functor0(this, &MyWindow::Right),				Input::Keyboard::KEY_PRESSED);		mKeymap.RegisterMapping(				'G',				Functor0(this, &MyWindow::Color),				Input::Keyboard::KEY_PRESSED);	}	float r,g,b;	float right;	void Color( void )	{		g += 0.001;		Redraw();	}	void Left( void )	{		right -= 0.1;		Redraw();	}	void Right( void )	{		right += 0.1;		Redraw();	}	void Draw( void )	{		glViewport(0,0,mWidth,mHeight);		glClearColor(0.f, 0.f, 0.f, 0.f);		glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );		glMatrixMode( GL_PROJECTION );		glLoadIdentity();		glOrtho(0, mWidth, 0, mHeight, -10, 10);		glMatrixMode( GL_MODELVIEW );		glLoadIdentity();		glColor3f(r,g,b);		glRectf(0,0, right, 100);	}};int Init(){	MyWindow *p = new MyWindow;	p->Create();	p->r = 1.f;	p->g = 0.f;	p->b = 0.f;	p->MoveToFront();	return 0;}


This basically does exactly what you'd expect of it. The Init function is called from within Daedalus. It creates a window of default size and colour depth, sets the color and moves it to the front (thereby giving it focus).
The window registers couple of input functions, and implements a drawing function.

This code works on Windows and on Linux without changing a single line. Only a recompile is necessary.

Discussion

Loading comments...