Updated SOIL2.

This commit is contained in:
Martín Lucas Golini
2013-11-13 02:40:10 -03:00
parent f276feb274
commit d40a10a07c
5 changed files with 224 additions and 177 deletions

View File

@@ -1,41 +1,44 @@
#include <eepp/ee.hpp>
cWindow * win = NULL;
void MainLoop()
{
win->Clear();
// Create an instance of the primitive renderer
cPrimitives p;
// Change the color
p.SetColor( eeColorA( 0, 255, 0, 150 ) );
// Update the input
win->GetInput()->Update();
// Check if ESCAPE key is pressed
if ( win->GetInput()->IsKeyDown( KEY_ESCAPE ) ) {
// Close the window
win->Close();
}
// Draw a circle
p.DrawCircle( eeVector2f( win->GetWidth() * 0.5f, win->GetHeight() * 0.5f ), 200 );
// Draw frame
win->Display(false);
}
EE_MAIN_FUNC int main (int argc, char * argv [])
{
// Create a new window
cWindow * win = cEngine::instance()->CreateWindow( WindowSettings( 960, 640, "eepp - Empty Window" ) );
// Create a new window with vsync enabled
win = cEngine::instance()->CreateWindow( WindowSettings( 960, 640, "eepp - Empty Window" ), ContextSettings( true ) );
// Check if created
if ( win->Created() ) {
// Set window background color
win->BackColor( eeColor( 50, 50, 50 ) );
// Create an instance of the primitive renderer
cPrimitives p;
// Change the color
p.SetColor( eeColorA( 0, 255, 0, 150 ) );
// Application loop
while ( win->Running() ) {
// Update the input
win->GetInput()->Update();
// Check if ESCAPE key is pressed
if ( win->GetInput()->IsKeyDown( KEY_ESCAPE ) ) {
// Close the window
win->Close();
}
// Draw a circle
p.DrawCircle( eeVector2f( win->GetWidth() * 0.5f, win->GetHeight() * 0.5f ), 200 );
// Draw frame
win->Display();
// Sleep thread for 10 ms
Sys::Sleep( 10 );
}
win->RunMainLoop( &MainLoop, 60 );
}
// Destroy the engine instance. Destroys all the windows and engine singletons.