mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-06-01 11:06:30 +03:00
Refactored Colors.
Removed PBuffer support. Abstracted WMInfo.
This commit is contained in:
@@ -11,7 +11,7 @@ void MainLoop()
|
||||
cPrimitives p;
|
||||
|
||||
// Change the color
|
||||
p.SetColor( eeColorA( 0, 255, 0, 150 ) );
|
||||
p.SetColor( ColorA( 0, 255, 0, 150 ) );
|
||||
|
||||
// Update the input
|
||||
win->GetInput()->Update();
|
||||
@@ -38,7 +38,7 @@ EE_MAIN_FUNC int main (int argc, char * argv [])
|
||||
// Check if created
|
||||
if ( win->Created() ) {
|
||||
// Set window background color
|
||||
win->BackColor( eeColor( 50, 50, 50 ) );
|
||||
win->BackColor( RGB( 50, 50, 50 ) );
|
||||
|
||||
// Set the MainLoop function and run it
|
||||
// This is the application loop, it will loop until the window is closed.
|
||||
|
||||
@@ -19,7 +19,7 @@ Float th;
|
||||
Float aspectRatio;
|
||||
eeVector3ff * vertices = eeNewArray( eeVector3ff, ParticlesNum );
|
||||
eeVector3ff * velocities = eeNewArray( eeVector3ff, ParticlesNum );
|
||||
eeColorAf * colors = eeNewArray( eeColorAf, ParticlesNum );
|
||||
ColorAf * colors = eeNewArray( ColorAf, ParticlesNum );
|
||||
|
||||
void videoResize( cWindow * w ) {
|
||||
/// Video Resize event will re-setup the 2D projection and states, so we must rebuild them.
|
||||
@@ -189,7 +189,7 @@ void MainLoop()
|
||||
GLi->VertexPointer( 3, GL_FLOAT, sizeof(eeVector3ff), reinterpret_cast<char*> ( &vertices[0] ), ParticlesNum * sizeof(float) * 3 );
|
||||
|
||||
/// ColorPointer to "dgl_FrontColor"
|
||||
GLi->ColorPointer( 4, GL_FP, sizeof(eeColorAf), reinterpret_cast<char*> ( &colors[0] ), ParticlesNum * sizeof(Float) * 4 );
|
||||
GLi->ColorPointer( 4, GL_FP, sizeof(ColorAf), reinterpret_cast<char*> ( &colors[0] ), ParticlesNum * sizeof(Float) * 4 );
|
||||
|
||||
/// Draw the lines
|
||||
GLi->DrawArrays( DM_LINES, 0, ParticlesNum );
|
||||
@@ -260,7 +260,7 @@ EE_MAIN_FUNC int main (int argc, char * argv [])
|
||||
{
|
||||
vertices[i] = eeVector3ff( 0, 0, 1.83 );
|
||||
velocities[i] = eeVector3ff( (Math::Randf() * 2 - 1)*.05, (Math::Randf() * 2 - 1)*.05, .93 + Math::Randf()*.02 );
|
||||
colors[i] = eeColorAf( Math::Randf() * 0.5, 0.1, 0.8, 0.5 );
|
||||
colors[i] = ColorAf( Math::Randf() * 0.5, 0.1, 0.8, 0.5 );
|
||||
}
|
||||
|
||||
/** Optimized for ARM ( pre-cache sqrt ) */
|
||||
|
||||
@@ -51,7 +51,7 @@ EE_MAIN_FUNC int main (int argc, char * argv [])
|
||||
win = cEngine::instance()->CreateWindow( WindowSettings( 960, 640, "eepp - Fonts" ), ContextSettings( true ) );
|
||||
|
||||
// Set window background color
|
||||
win->BackColor( eeColor(255,255,255) );
|
||||
win->BackColor( RGB(255,255,255) );
|
||||
|
||||
// Check if created
|
||||
if ( win->Created() ) {
|
||||
@@ -66,15 +66,15 @@ EE_MAIN_FUNC int main (int argc, char * argv [])
|
||||
TexF2 = cTextureFont::New( "conchars" );
|
||||
|
||||
// Load the TTF font
|
||||
TTF->Load( AppPath + "assets/fonts/DejaVuSansMono.ttf", 18, TTF_STYLE_NORMAL, 128, eeColor(255,255,255), 3, eeColor(0,0,0), true );
|
||||
TTF->Load( AppPath + "assets/fonts/DejaVuSansMono.ttf", 18, TTF_STYLE_NORMAL, 128, RGB(255,255,255), 3, RGB(0,0,0), true );
|
||||
|
||||
// Change the default method to use for outlining the font glyphs
|
||||
cTTFFont::OutlineMethod = cTTFFont::OutlineFreetype;
|
||||
|
||||
// Create the exact same font than before but using the new outlining method
|
||||
TTFO->Load( AppPath + "assets/fonts/DejaVuSansMono.ttf", 18, TTF_STYLE_NORMAL, 128, eeColor(255,255,255), 3, eeColor(0,0,0), true );
|
||||
TTFO->Load( AppPath + "assets/fonts/DejaVuSansMono.ttf", 18, TTF_STYLE_NORMAL, 128, RGB(255,255,255), 3, RGB(0,0,0), true );
|
||||
|
||||
TTF2->Load( AppPath + "assets/fonts/DejaVuSansMono.ttf", 24, TTF_STYLE_NORMAL, 128, eeColor(255,255,255), 0, eeColor(0,0,0), true );
|
||||
TTF2->Load( AppPath + "assets/fonts/DejaVuSansMono.ttf", 24, TTF_STYLE_NORMAL, 128, RGB(255,255,255), 0, RGB(0,0,0), true );
|
||||
|
||||
// Save the TTF font so then it can be loaded as a cTextureFont
|
||||
TTF->Save( AppPath + "assets/temp/DejaVuSansMono.png", AppPath + "assets/temp/DejaVuSansMono.fnt" );
|
||||
@@ -86,7 +86,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 )
|
||||
cTextureLoader TexLoader( AppPath + "assets/fonts/conchars.png" );
|
||||
TexLoader.SetColorKey( eeColor(0,0,0) );
|
||||
TexLoader.SetColorKey( RGB(0,0,0) );
|
||||
TexLoader.Load();;
|
||||
TexF2->Load( TexLoader.Id(), 32 );
|
||||
|
||||
@@ -98,8 +98,8 @@ EE_MAIN_FUNC int main (int argc, char * argv [])
|
||||
TexF2->SetText( TTF->GetText() );
|
||||
|
||||
// Set the font color
|
||||
TTF2->Color( eeColor(0,0,0) );
|
||||
TexF->Color( eeColor(0,0,0) );
|
||||
TTF2->Color( RGB(0,0,0) );
|
||||
TexF->Color( RGB(0,0,0) );
|
||||
|
||||
// Create a new text string
|
||||
String Txt( "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum." );
|
||||
@@ -109,7 +109,7 @@ EE_MAIN_FUNC int main (int argc, char * argv [])
|
||||
|
||||
// Create a new text cache to draw on screen
|
||||
// The cached text will
|
||||
TxtCache = eeNew( cTextCache, ( TTF2, Txt, eeColorA(0,0,0,255) ) );
|
||||
TxtCache = eeNew( cTextCache, ( TTF2, Txt, ColorA(0,0,0,255) ) );
|
||||
|
||||
// Set the text cache to be centered
|
||||
TxtCache->Flags( FONT_DRAW_CENTER );
|
||||
@@ -120,7 +120,7 @@ EE_MAIN_FUNC int main (int argc, char * argv [])
|
||||
size_t size = TxtCache->Text().size();
|
||||
|
||||
for ( size_t i = 0; i < size; i++ ) {
|
||||
TxtCache->Color( eeColorA(255*i/size,0,0,255), i, i+1 );
|
||||
TxtCache->Color( ColorA(255*i/size,0,0,255), i, i+1 );
|
||||
}
|
||||
|
||||
// Application loop
|
||||
|
||||
@@ -633,7 +633,7 @@ EE_MAIN_FUNC int main (int argc, char * argv [])
|
||||
if ( mWindow->Created() ) {
|
||||
KM = mWindow->GetInput();
|
||||
|
||||
mWindow->BackColor( eeColor( 255, 255, 255 ) );
|
||||
mWindow->BackColor( RGB( 255, 255, 255 ) );
|
||||
|
||||
PhysicsCreate();
|
||||
|
||||
|
||||
@@ -77,11 +77,11 @@ void MainLoop()
|
||||
Blindy->Draw();
|
||||
|
||||
// Draw the Rock Axis-Aligned Bounding Box
|
||||
P.SetColor( eeColorA( 255, 255, 255, 255 ) );
|
||||
P.SetColor( ColorA( 255, 255, 255, 255 ) );
|
||||
P.DrawRectangle( Rock->GetAABB() );
|
||||
|
||||
// Draw the Rock Quad
|
||||
P.SetColor( eeColorA( 255, 0, 0, 255 ) );
|
||||
P.SetColor( ColorA( 255, 0, 0, 255 ) );
|
||||
P.DrawQuad( Rock->GetQuad() );
|
||||
|
||||
// Draw frame
|
||||
|
||||
@@ -51,7 +51,7 @@ void MainLoop()
|
||||
// Draw the frame buffer many times
|
||||
for ( int y = 0; y < 5; y++ ) {
|
||||
for ( int x = 0; x < 5; x++ ) {
|
||||
FBO->GetTexture()->Draw( x * 200, y * 200, -ang, eeVector2f::One, eeColorA(255,255,255,100) );
|
||||
FBO->GetTexture()->Draw( x * 200, y * 200, -ang, eeVector2f::One, ColorA(255,255,255,100) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ void MainLoop()
|
||||
Float tmpy = (Float)y * 32.f;
|
||||
|
||||
// Add the quad to the batch
|
||||
Batch->QuadsSetColor( eeColorA( z * 16, 255, 255, 150 ) );
|
||||
Batch->QuadsSetColor( ColorA( z * 16, 255, 255, 150 ) );
|
||||
Batch->BatchQuadFree( TmpQuad[0].x + tmpx, TmpQuad[0].y + tmpy, TmpQuad[1].x + tmpx, TmpQuad[1].y + tmpy, TmpQuad[2].x + tmpx, TmpQuad[2].y + tmpy, TmpQuad[3].x + tmpx, TmpQuad[3].y + tmpy );
|
||||
}
|
||||
}
|
||||
@@ -116,7 +116,7 @@ EE_MAIN_FUNC int main (int argc, char * argv [])
|
||||
win = cEngine::instance()->CreateWindow( WindowSettings( 1024, 768, "eepp - VBO - FBO and Batch Rendering" ), ContextSettings( true ) );
|
||||
|
||||
// Set window background color
|
||||
win->BackColor( eeColor( 50, 50, 50 ) );
|
||||
win->BackColor( RGB( 50, 50, 50 ) );
|
||||
|
||||
// Check if created
|
||||
if ( win->Created() ) {
|
||||
@@ -131,14 +131,14 @@ EE_MAIN_FUNC int main (int argc, char * argv [])
|
||||
if ( NULL != VBO && NULL != VBO2 ) {
|
||||
for ( Uint32 i = 0; i < Poly.Size(); i++ ) {
|
||||
VBO->AddVertex( Poly[i] );
|
||||
VBO->AddColor( eeColorA( 100 + i, 255 - i, 150 + i, 100 ) );
|
||||
VBO->AddColor( ColorA( 100 + i, 255 - i, 150 + i, 100 ) );
|
||||
}
|
||||
|
||||
Poly.Rotate( 90, Poly.ToAABB().Center() );
|
||||
|
||||
for ( Uint32 i = 0; i < Poly.Size(); i++ ) {
|
||||
VBO2->AddVertex( Poly[i] );
|
||||
VBO2->AddColor( eeColorA( 100 + i, 255 - i, 150 + i, 100 ) );
|
||||
VBO2->AddColor( ColorA( 100 + i, 255 - i, 150 + i, 100 ) );
|
||||
}
|
||||
|
||||
// Compile the Vertex Buffer, this uploads the data to the GPU
|
||||
|
||||
Reference in New Issue
Block a user