Windows module improved.

--HG--
branch : dev
This commit is contained in:
Martín Lucas Golini
2017-02-17 17:47:41 -03:00
parent f11531fc9a
commit ca90d606f3
47 changed files with 429 additions and 555 deletions

View File

@@ -30,8 +30,8 @@ void MainLoop()
win->close();
}
circ += win->elapsed().asMilliseconds() * 0.5f * op;
circ2 += win->elapsed().asMilliseconds() * 0.75f;
circ += win->getElapsed().asMilliseconds() * 0.5f * op;
circ2 += win->getElapsed().asMilliseconds() * 0.75f;
if ( op == 1 && circ > 340 )
{
@@ -91,9 +91,9 @@ EE_MAIN_FUNC int main (int argc, char * argv [])
win = Engine::instance()->createWindow( WindowSettings( 960, 640, "eepp - Empty Window" ), ContextSettings( true ) );
// Check if created
if ( win->created() ) {
if ( win->isOpen() ) {
// Set window background color
win->backColor( RGB( 50, 50, 50 ) );
win->setBackColor( RGB( 50, 50, 50 ) );
GLi->polygonMode( );

View File

@@ -105,10 +105,10 @@ void MainLoop()
if ( imp->isKeyUp( KEY_F ) )
{
if ( win->isWindowed() ) {
win->size( win->getDesktopResolution().width(), win->getDesktopResolution().height(), false );
win->setSize( win->getDesktopResolution().width(), win->getDesktopResolution().height(), false );
} else {
win->size( 960, 640, true );
win->center();
win->setSize( 960, 640, true );
win->centerToScreen();
}
}
@@ -117,7 +117,7 @@ void MainLoop()
Float tratio = tw / th;
Float touchX = ( mf.x / tw - 1 ) * tratio;
Float touchY = -( mf.y / th - 1 );
bool touch = imp->mouseLeftPressed();
bool touch = imp->isMouseLeftPressed();
for( Uint32 i = 0; i < ParticlesNum; i+=2 )
{
@@ -195,7 +195,7 @@ void MainLoop()
GLi->drawArrays( DM_LINES, 0, ParticlesNum );
/// Stop the simulation if the window is not visible
while ( !win->visible() ) {
while ( !win->isVisible() ) {
imp->update(); /// To get the real state of the window you need to update the window input
Sys::sleep( 100 ); /// Sleep 100 ms
}
@@ -207,7 +207,7 @@ EE_MAIN_FUNC int main (int argc, char * argv [])
{
win = Engine::instance()->createWindow( WindowSettings( 960, 640, "eepp - External Shaders" ), ContextSettings( true ) );
if ( win->created() )
if ( win->isOpen() )
{
/// This will work without shaders too
ShadersSupported = GLi->shadersSupported();

View File

@@ -51,10 +51,10 @@ EE_MAIN_FUNC int main (int argc, char * argv [])
win = Engine::instance()->createWindow( WindowSettings( 960, 640, "eepp - Fonts" ), ContextSettings( true ) );
// Set window background color
win->backColor( RGB(255,255,255) );
win->setBackColor( RGB(255,255,255) );
// Check if created
if ( win->created() ) {
if ( win->isOpen() ) {
// Get the application path
std::string AppPath = Sys::getProcessPath();

View File

@@ -113,7 +113,7 @@ void Demo1Create() {
CreateJointAndBody();
mWindow->caption( "eepp - Physics - Logo Smash" );
mWindow->setCaption( "eepp - Physics - Logo Smash" );
mSpace = Physics::Space::New();
mSpace->iterations( 1 );
@@ -168,7 +168,7 @@ void Demo2Create() {
CreateJointAndBody();
mWindow->caption( "eepp - Physics - Pyramid Stack" );
mWindow->setCaption( "eepp - Physics - Pyramid Stack" );
Shape::resetShapeIdCounter();
@@ -294,7 +294,7 @@ void Demo3Create() {
CreateJointAndBody();
mWindow->caption( "eepp - Physics - Sensor" );
mWindow->setCaption( "eepp - Physics - Sensor" );
Shape::resetShapeIdCounter();
@@ -460,7 +460,7 @@ void Demo4Create() {
CreateJointAndBody();
mWindow->caption( "eepp - Physics - Sticky collisions using the Arbiter data pointer." );
mWindow->setCaption( "eepp - Physics - Sticky collisions using the Arbiter data pointer." );
mSpace = Space::New();
mSpace->iterations( 10 );
@@ -575,10 +575,10 @@ void PhysicsUpdate() {
mMousePoint = cVectNew( KM->getMousePosf().x, KM->getMousePosf().y );
cVect newPoint = tovect( cpvlerp( tocpv( mMousePoint_last ), tocpv( mMousePoint ), 0.25 ) );
mMouseBody->pos( newPoint );
mMouseBody->vel( ( newPoint - mMousePoint_last ) * (cpFloat)mWindow->FPS() );
mMouseBody->vel( ( newPoint - mMousePoint_last ) * (cpFloat)mWindow->getFPS() );
mMousePoint_last = newPoint;
if ( KM->mouseLeftPressed() ) {
if ( KM->isMouseLeftPressed() ) {
if ( NULL == mMouseJoint ) {
cVect point = cVectNew( KM->getMousePosf().x, KM->getMousePosf().y );
@@ -630,10 +630,10 @@ EE_MAIN_FUNC int main (int argc, char * argv [])
{
mWindow = Engine::instance()->createWindow( WindowSettings( 1024, 768, "eepp - Physics" ), ContextSettings( true ) );
if ( mWindow->created() ) {
if ( mWindow->isOpen() ) {
KM = mWindow->getInput();
mWindow->backColor( RGB( 255, 255, 255 ) );
mWindow->setBackColor( RGB( 255, 255, 255 ) );
PhysicsCreate();

View File

@@ -60,8 +60,8 @@ void MainLoop()
}
// Update the angle interpolation
PlanetAngle.update( win->elapsed() );
RockAngle.update( win->elapsed() );
PlanetAngle.update( win->getElapsed() );
RockAngle.update( win->getElapsed() );
// Set the Planet and Rock angle from the interpolation
Planet->angle( PlanetAngle.getPos() );
@@ -94,7 +94,7 @@ EE_MAIN_FUNC int main (int argc, char * argv [])
win = Engine::instance()->createWindow( WindowSettings( 640, 480, "eepp - Sprites" ), ContextSettings( true ) );
// Check if created
if ( win->created() ) {
if ( win->isOpen() ) {
// Get the application path
std::string AppPath = Sys::getProcessPath();

View File

@@ -93,7 +93,7 @@ void MainLoop()
Batch->draw();
// Add the rotation angle
ang+=win->elapsed().asMilliseconds() * 0.1f;
ang+=win->getElapsed().asMilliseconds() * 0.1f;
ang = (ang>=360) ? 0 : ang;
// Change the scale value
@@ -104,7 +104,7 @@ void MainLoop()
side = false;
scale = 0.5f;
}
scale = (!side) ? scale+win->elapsed().asMilliseconds() * 0.00025f : scale-win->elapsed().asMilliseconds() * 0.00025f;
scale = (!side) ? scale+win->getElapsed().asMilliseconds() * 0.00025f : scale-win->getElapsed().asMilliseconds() * 0.00025f;
// Draw frame
win->display();
@@ -116,10 +116,10 @@ EE_MAIN_FUNC int main (int argc, char * argv [])
win = Engine::instance()->createWindow( WindowSettings( 1024, 768, "eepp - VBO - FBO and Batch Rendering" ), ContextSettings( true ) );
// Set window background color
win->backColor( RGB( 50, 50, 50 ) );
win->setBackColor( RGB( 50, 50, 50 ) );
// Check if created
if ( win->created() ) {
if ( win->isOpen() ) {
Polygon2f Poly( Polygon2f::createRoundedRectangle( 0, 0, 200, 50 ) );
// Create the Vertex Buffer, the vertex buffer stores the vertex data in the GPU, making the rendering much faster