mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-08-11 09:07:51 +03:00
Updated SOIL2.
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user