mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-08-10 16:51:19 +03:00
Refactoring WIP.
Changing the function naming convention from CamelCase to camelCase. --HG-- branch : dev
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
#include <eepp/ee.hpp>
|
||||
|
||||
#include <GL/gl.h>
|
||||
EE::Window::Window * win = NULL;
|
||||
float circ = 0, circ2 = 0;
|
||||
int op = 1;
|
||||
|
||||
void MainLoop()
|
||||
{
|
||||
@@ -22,8 +24,55 @@ void MainLoop()
|
||||
win->Close();
|
||||
}
|
||||
|
||||
circ += win->Elapsed().asMilliseconds() * 0.5f * op;
|
||||
circ2 += win->Elapsed().asMilliseconds() * 0.75f;
|
||||
|
||||
if ( op == 1 && circ > 340 )
|
||||
{
|
||||
op = -1;
|
||||
}
|
||||
else if ( op == -1 && circ < 20 )
|
||||
{
|
||||
op = 1;
|
||||
}
|
||||
|
||||
Vector2f winCenter( win->GetWidth() * 0.5f, win->GetHeight() * 0.5f );
|
||||
|
||||
|
||||
GLi->Enable(GL_STENCIL_TEST);
|
||||
GLi->StencilMask(0xFF);
|
||||
GLi->StencilFunc(GL_NEVER, 1, 0xFF);
|
||||
GLi->StencilOp(GL_REPLACE, GL_KEEP, GL_KEEP);
|
||||
|
||||
p.DrawCircle( winCenter, 150, 40 );
|
||||
|
||||
GLi->StencilFunc(GL_EQUAL, 0, 0xFF);
|
||||
|
||||
// Draw a circle
|
||||
p.DrawCircle( Vector2f( win->GetWidth() * 0.5f, win->GetHeight() * 0.5f ), 200, 50 );
|
||||
p.DrawArc( winCenter, 200, 40, circ, circ2 );
|
||||
|
||||
GLi->Disable(GL_STENCIL_TEST);
|
||||
|
||||
/*
|
||||
GLi->Enable(GL_STENCIL_TEST);
|
||||
|
||||
GLi->StencilFunc(GL_ALWAYS, 1, 1);
|
||||
GLi->ColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
|
||||
GLi->StencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE);
|
||||
|
||||
p.SetColor( ColorA( 255, 255, 255, 255 ) );
|
||||
p.DrawCircle( winCenter, 150, 40 );
|
||||
|
||||
GLi->StencilFunc(GL_NOTEQUAL, 1, 1);
|
||||
GLi->StencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
|
||||
GLi->ColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
|
||||
|
||||
// Draw a circle
|
||||
p.SetColor( ColorA( 0, 255, 0, 150 ) );
|
||||
p.DrawArc( winCenter, 200, 40, circ, circ2 );
|
||||
|
||||
GLi->Disable(GL_STENCIL_TEST);
|
||||
*/
|
||||
|
||||
// Draw frame
|
||||
win->Display();
|
||||
@@ -40,6 +89,8 @@ EE_MAIN_FUNC int main (int argc, char * argv [])
|
||||
// Set window background color
|
||||
win->BackColor( RGB( 50, 50, 50 ) );
|
||||
|
||||
GLi->PolygonMode( );
|
||||
|
||||
// Set the MainLoop function and run it
|
||||
// This is the application loop, it will loop until the window is closed.
|
||||
// This is only a requirement if you want to support Emscripten builds ( WebGL + Canvas ).
|
||||
@@ -52,10 +103,10 @@ EE_MAIN_FUNC int main (int argc, char * argv [])
|
||||
}
|
||||
|
||||
// Destroy the engine instance. Destroys all the windows and engine singletons.
|
||||
Engine::DestroySingleton();
|
||||
Engine::destroySingleton();
|
||||
|
||||
// If was compiled in debug mode it will print the memory manager report
|
||||
MemoryManager::ShowResults();
|
||||
MemoryManager::showResults();
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -197,7 +197,7 @@ void MainLoop()
|
||||
/// Stop the simulation if the window is not visible
|
||||
while ( !win->Visible() ) {
|
||||
imp->Update(); /// To get the real state of the window you need to update the window input
|
||||
Sys::Sleep( 100 ); /// Sleep 100 ms
|
||||
Sys::sleep( 100 ); /// Sleep 100 ms
|
||||
}
|
||||
|
||||
win->Display();
|
||||
@@ -241,7 +241,7 @@ EE_MAIN_FUNC int main (int argc, char * argv [])
|
||||
/// Since fixed-pipeline OpenGL use gl_FrontColor for glColorPointer, we need to replace the color attribute
|
||||
/// This is all to show how it works, in a real world scenario, you will choose to work fixed-pipeline or programmable-pipeline.
|
||||
if ( GLi->Version() == GLv_2 ) {
|
||||
String::ReplaceAll( fs, "gl_FragColor = dgl_Color", "gl_FragColor = gl_FrontColor" );
|
||||
String::replaceAll( fs, "gl_FragColor = dgl_Color", "gl_FragColor = gl_FrontColor" );
|
||||
}
|
||||
|
||||
/// Create the new shader program
|
||||
@@ -279,9 +279,9 @@ EE_MAIN_FUNC int main (int argc, char * argv [])
|
||||
eeSAFE_DELETE_ARRAY( colors );
|
||||
}
|
||||
|
||||
Engine::DestroySingleton();
|
||||
Engine::destroySingleton();
|
||||
|
||||
MemoryManager::ShowResults();
|
||||
MemoryManager::showResults();
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ EE_MAIN_FUNC int main (int argc, char * argv [])
|
||||
// Check if created
|
||||
if ( win->Created() ) {
|
||||
// Get the application path
|
||||
std::string AppPath = Sys::GetProcessPath();
|
||||
std::string AppPath = Sys::getProcessPath();
|
||||
|
||||
// Create a new True Type Font
|
||||
TTF = TTFFont::New( "DejaVuSansMonoOutline" );
|
||||
@@ -87,7 +87,7 @@ EE_MAIN_FUNC int main (int argc, char * argv [])
|
||||
// Load a monospaced texture font from image ( using the texture loader to set the color key )
|
||||
TextureLoader TexLoader( AppPath + "assets/fonts/conchars.png" );
|
||||
TexLoader.SetColorKey( RGB(0,0,0) );
|
||||
TexLoader.Load();;
|
||||
TexLoader.load();;
|
||||
TexF2->Load( TexLoader.Id(), 32 );
|
||||
|
||||
// Set a text to render
|
||||
@@ -131,10 +131,10 @@ EE_MAIN_FUNC int main (int argc, char * argv [])
|
||||
|
||||
// Destroy the engine instance. Destroys all the windows and engine singletons.
|
||||
// Fonts are autoreleased by the engine
|
||||
Engine::DestroySingleton();
|
||||
Engine::destroySingleton();
|
||||
|
||||
// If was compiled in debug mode it will print the memory manager report
|
||||
MemoryManager::ShowResults();
|
||||
MemoryManager::showResults();
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ EE_MAIN_FUNC int main (int argc, char * argv []) {
|
||||
request.SetUri("/wiki/Main_Page");
|
||||
|
||||
// Creates an async http request
|
||||
Http::Request asyncRequest( "/wiki/" + Version::GetCodename() );
|
||||
Http::Request asyncRequest( "/wiki/" + Version::getCodename() );
|
||||
|
||||
http.SendAsyncRequest( cb::Make3( AsyncRequestCallback ), asyncRequest, Seconds( 5 ) );
|
||||
} else {
|
||||
@@ -55,7 +55,7 @@ EE_MAIN_FUNC int main (int argc, char * argv []) {
|
||||
}
|
||||
}
|
||||
|
||||
MemoryManager::ShowResults();
|
||||
MemoryManager::showResults();
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -540,7 +540,7 @@ void ChangeDemo( int num ) {
|
||||
|
||||
void PhysicsCreate() {
|
||||
// Initialize the physics engine
|
||||
PhysicsManager::CreateSingleton();
|
||||
PhysicsManager::createSingleton();
|
||||
|
||||
mDemo.clear();
|
||||
|
||||
@@ -642,9 +642,9 @@ EE_MAIN_FUNC int main (int argc, char * argv [])
|
||||
PhysicsDestroy();
|
||||
}
|
||||
|
||||
Engine::DestroySingleton();
|
||||
Engine::destroySingleton();
|
||||
|
||||
MemoryManager::ShowResults();
|
||||
MemoryManager::showResults();
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include <eepp/ee.hpp>
|
||||
|
||||
// Get the process path to be used to load the sounds ( it is safer )
|
||||
std::string AppPath = Sys::GetProcessPath();
|
||||
std::string AppPath = Sys::getProcessPath();
|
||||
|
||||
/// Play a sound
|
||||
void PlaySound() {
|
||||
@@ -15,7 +15,7 @@ void PlaySound() {
|
||||
|
||||
// Display sound informations
|
||||
std::cout << "sound.ogg :" << std::endl;
|
||||
std::cout << " " << buffer.GetDuration().AsSeconds() << " seconds" << std::endl;
|
||||
std::cout << " " << buffer.GetDuration().asSeconds() << " seconds" << std::endl;
|
||||
std::cout << " " << buffer.GetSampleRate() << " samples / sec" << std::endl;
|
||||
std::cout << " " << buffer.GetChannelCount() << " channels" << std::endl;
|
||||
|
||||
@@ -34,7 +34,7 @@ void PlayMusic() {
|
||||
|
||||
// Display music informations
|
||||
std::cout << "music.ogg :" << std::endl;
|
||||
std::cout << " " << music.GetDuration().AsSeconds() << " seconds" << std::endl;
|
||||
std::cout << " " << music.GetDuration().asSeconds() << " seconds" << std::endl;
|
||||
std::cout << " " << music.GetSampleRate() << " samples / sec" << std::endl;
|
||||
std::cout << " " << music.GetChannelCount() << " channels" << std::endl;
|
||||
|
||||
@@ -44,10 +44,10 @@ void PlayMusic() {
|
||||
// Loop while the music is playing
|
||||
while ( music.State() == Sound::Playing ) {
|
||||
// Leave some CPU time for other processes
|
||||
Sys::Sleep( 100 );
|
||||
Sys::sleep( 100 );
|
||||
|
||||
// Display the playing position
|
||||
std::cout << "\rPlaying... " << music.PlayingOffset().AsSeconds() << " sec ";
|
||||
std::cout << "\rPlaying... " << music.PlayingOffset().asSeconds() << " sec ";
|
||||
std::cout << std::flush;
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ EE_MAIN_FUNC int main (int argc, char * argv [])
|
||||
std::cin.ignore(10000, '\n');
|
||||
|
||||
// If was compiled in debug mode it will print the memory manager report
|
||||
MemoryManager::ShowResults();
|
||||
MemoryManager::showResults();
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ EE_MAIN_FUNC int main (int argc, char * argv [])
|
||||
// Check if created
|
||||
if ( win->Created() ) {
|
||||
// Get the application path
|
||||
std::string AppPath = Sys::GetProcessPath();
|
||||
std::string AppPath = Sys::getProcessPath();
|
||||
|
||||
// Load the rock texture
|
||||
Uint32 PlanetId = TextureFactory::instance()->Load( AppPath + "assets/sprites/7.png" );
|
||||
@@ -167,10 +167,10 @@ EE_MAIN_FUNC int main (int argc, char * argv [])
|
||||
eeSAFE_DELETE( Blindy );
|
||||
|
||||
// Destroy the engine instance. Destroys all the windows and engine singletons.
|
||||
Engine::DestroySingleton();
|
||||
Engine::destroySingleton();
|
||||
|
||||
// If was compiled in debug mode it will print the memory manager report
|
||||
MemoryManager::ShowResults();
|
||||
MemoryManager::showResults();
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ void MainLoop()
|
||||
Batch->Draw();
|
||||
|
||||
// Add the rotation angle
|
||||
ang+=win->Elapsed().AsMilliseconds() * 0.1f;
|
||||
ang+=win->Elapsed().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->Elapsed().asMilliseconds() * 0.00025f : scale-win->Elapsed().asMilliseconds() * 0.00025f;
|
||||
|
||||
// Draw frame
|
||||
win->Display();
|
||||
@@ -160,10 +160,10 @@ EE_MAIN_FUNC int main (int argc, char * argv [])
|
||||
}
|
||||
|
||||
// Destroy the engine instance. Destroys all the windows and engine singletons.
|
||||
Engine::DestroySingleton();
|
||||
Engine::destroySingleton();
|
||||
|
||||
// If was compiled in debug mode it will print the memory manager report
|
||||
MemoryManager::ShowResults();
|
||||
MemoryManager::showResults();
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user