mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-06-05 04:56:31 +03:00
Renamed cImage::Size() to cImage::MemSize(), since it was confusing.
cImage::Size() now returns the image dimensions. Changed how cUIControl::SetSkin works, it was confusing, now just spects a Skin const reference and make a copy from it. Fixed DoAfterSetTheme to be virtual, now SetSkin works for all the controls. Restructured cPrimitives. Removed some Draw* calls, since it was a little bit bloated, sometimes less is more. Also added fill mode, blend mode and line width as members of the instance of the primitives class, this way i reduced the number of parameters in almost all the functions, and, it's cleaner.
This commit is contained in:
@@ -562,18 +562,20 @@ void cEETest::CreateUI() {
|
||||
#ifdef EE_PLATFORM_TOUCH
|
||||
cTextureAtlas * SG = cGlobalTextureAtlas::instance();
|
||||
|
||||
SG->Add( TF->Load( MyPath + "extra/button-te_normal.png" ), "button-te_normal" );
|
||||
cTexture * butTex = TF->GetTexture( TF->Load( MyPath + "extra/button-te_normal.png" ) );
|
||||
|
||||
SG->Add( butTex->Id(), "button-te_normal" );
|
||||
SG->Add( TF->Load( MyPath + "extra/button-te_mdown.png" ), "button-te_mdown" );
|
||||
|
||||
cUISkinSimple * nSkin = eeNew( cUISkinSimple, ( "button-te" ) );
|
||||
cUISkinSimple nSkin( "button-te" );
|
||||
|
||||
mShowMenu = mTheme->CreatePushButton( NULL, eeSize( 128, 64 ), eeVector2i( mWindow->GetWidth() - 158, mWindow->GetHeight() - 74 ), UI_CONTROL_ALIGN_CENTER | UI_ANCHOR_RIGHT | UI_ANCHOR_BOTTOM );
|
||||
mShowMenu = mTheme->CreatePushButton( NULL, butTex->Size(), eeVector2i( mWindow->GetWidth() - butTex->Width() - 20, mWindow->GetHeight() - butTex->Height() - 10 ), UI_CONTROL_ALIGN_CENTER | UI_ANCHOR_RIGHT | UI_ANCHOR_BOTTOM );
|
||||
mShowMenu->SetSkin( nSkin );
|
||||
mShowMenu->Text( "Show Menu" );
|
||||
mShowMenu->AddEventListener( cUIEvent::EventMouseClick, cb::Make1( this, &cEETest::OnShowMenu ) );
|
||||
|
||||
mTerrainBut = mTheme->CreatePushButton( NULL, eeSize( 128, 64 ), eeVector2i( mShowMenu->Pos().x - 128 - 20, mWindow->GetHeight() - 74 ), UI_CONTROL_ALIGN_CENTER | UI_ANCHOR_RIGHT | UI_ANCHOR_BOTTOM );
|
||||
mTerrainBut->SetSkin( nSkin->Copy() );
|
||||
mTerrainBut = mTheme->CreatePushButton( NULL, butTex->Size(), eeVector2i( mShowMenu->Pos().x - butTex->Width() - 20, mWindow->GetHeight() - butTex->Height() - 10 ), UI_CONTROL_ALIGN_CENTER | UI_ANCHOR_RIGHT | UI_ANCHOR_BOTTOM );
|
||||
mTerrainBut->SetSkin( nSkin );
|
||||
mTerrainBut->Text( "Terrain Up" );
|
||||
mTerrainBut->AddEventListener( cUIEvent::EventMouseClick, cb::Make1( this, &cEETest::OnTerrainMouse ) );
|
||||
mTerrainBut->Visible( 1 == Screen );
|
||||
@@ -1105,9 +1107,10 @@ void cEETest::Screen2() {
|
||||
CL1.Draw();
|
||||
CL2.Draw();
|
||||
|
||||
PR.DrawRectangle( CL1.GetAABB(), 0.0f, 1.0f, EE_DRAW_LINE );
|
||||
PR.FillMode( EE_DRAW_LINE );
|
||||
PR.DrawRectangle( CL1.GetAABB() );
|
||||
|
||||
PR.DrawQuad( CL1.GetQuad(), EE_DRAW_LINE );
|
||||
PR.DrawQuad( CL1.GetQuad() );
|
||||
#endif
|
||||
|
||||
Ang = Ang + mWindow->Elapsed() * 0.1f;
|
||||
@@ -1140,15 +1143,16 @@ void cEETest::Screen2() {
|
||||
else if (iL2)
|
||||
PR.SetColor( eeColorA(255, 255, 0, 255) );
|
||||
|
||||
PR.DrawCircle(Mousef.x, Mousef.y, 80.f, (Uint32)(Ang/3), EE_DRAW_LINE);
|
||||
PR.FillMode( EE_DRAW_LINE );
|
||||
PR.DrawCircle( eeVector2f( Mousef.x, Mousef.y ), 80.f, (Uint32)(Ang/3) );
|
||||
|
||||
PR.DrawTriangle( eeVector2f( Mousef.x, Mousef.y - 10.f ), eeVector2f( Mousef.x - 10.f, Mousef.y + 10.f ), eeVector2f( Mousef.x + 10.f, Mousef.y + 10.f ), EE_DRAW_LINE );
|
||||
PR.DrawLine( eeVector2f(Mousef.x - 80.f, Mousef.y - 80.f), eeVector2f(Mousef.x + 80.f, Mousef.y + 80.f) );
|
||||
PR.DrawLine( eeVector2f(Mousef.x - 80.f, Mousef.y + 80.f), eeVector2f(Mousef.x + 80.f, Mousef.y - 80.f) );
|
||||
PR.DrawLine( eeVector2f((eeFloat)mWindow->GetWidth(), 0.f), eeVector2f( 0.f, (eeFloat)mWindow->GetHeight() ) );
|
||||
PR.DrawQuad( eeVector2f(0.f, 0.f), eeVector2f(0.f, 100.f), eeVector2f(150.f, 150.f), eeVector2f(200.f, 150.f), eeColorA(220, 240, 0, 125), eeColorA(100, 0, 240, 125), eeColorA(250, 50, 25, 125), eeColorA(50, 150, 150, 125) );
|
||||
PR.DrawRectangle(Mousef.x - 80.f, Mousef.y - 80.f, 160.f, 160.f, 45.f, 1.f, EE_DRAW_LINE);
|
||||
PR.DrawLine( eeVector2f(0.f, 0.f), eeVector2f( (eeFloat)mWindow->GetWidth(), (eeFloat)mWindow->GetHeight() ) );
|
||||
PR.DrawTriangle( eeTriangle2f( eeVector2f( Mousef.x, Mousef.y - 10.f ), eeVector2f( Mousef.x - 10.f, Mousef.y + 10.f ), eeVector2f( Mousef.x + 10.f, Mousef.y + 10.f ) ) );
|
||||
PR.DrawLine( eeLine2f( eeVector2f(Mousef.x - 80.f, Mousef.y - 80.f), eeVector2f(Mousef.x + 80.f, Mousef.y + 80.f) ) );
|
||||
PR.DrawLine( eeLine2f( eeVector2f(Mousef.x - 80.f, Mousef.y + 80.f), eeVector2f(Mousef.x + 80.f, Mousef.y - 80.f) ) );
|
||||
PR.DrawLine( eeLine2f( eeVector2f((eeFloat)mWindow->GetWidth(), 0.f), eeVector2f( 0.f, (eeFloat)mWindow->GetHeight() ) ) );
|
||||
PR.DrawQuad( eeQuad2f( eeVector2f(0.f, 0.f), eeVector2f(0.f, 100.f), eeVector2f(150.f, 150.f), eeVector2f(200.f, 150.f) ), eeColorA(220, 240, 0, 125), eeColorA(100, 0, 240, 125), eeColorA(250, 50, 25, 125), eeColorA(50, 150, 150, 125) );
|
||||
PR.DrawRectangle( eeRectf( eeVector2f( Mousef.x - 80.f, Mousef.y - 80.f ), eeSizef( 160.f, 160.f ) ), 45.f );
|
||||
PR.DrawLine( eeLine2f( eeVector2f(0.f, 0.f), eeVector2f( (eeFloat)mWindow->GetWidth(), (eeFloat)mWindow->GetHeight() ) ) );
|
||||
|
||||
TNP[3]->DrawQuadEx( eeQuad2f( eeVector2f(0.f, 0.f), eeVector2f(0.f, 100.f), eeVector2f(150.f, 150.f), eeVector2f(200.f, 150.f) ), 0.0f, 0.0f, ang, scale, eeColorA(220, 240, 0, 125), eeColorA(100, 0, 240, 125), eeColorA(250, 50, 25, 125), eeColorA(50, 150, 150, 125) );
|
||||
|
||||
@@ -1262,13 +1266,19 @@ void cEETest::Render() {
|
||||
eeColorA ColRR3( 100, 100, 100, 220 );
|
||||
|
||||
PR.SetColor( eeColorA(150, 150, 150, 220) );
|
||||
|
||||
PR.FillMode( EE_DRAW_FILL );
|
||||
PR.DrawRectangle(
|
||||
0.f,
|
||||
(eeFloat)mWindow->GetHeight() - mEEText.GetTextHeight(),
|
||||
mEEText.GetTextWidth(),
|
||||
mEEText.GetTextHeight(),
|
||||
ColRR1, ColRR2, ColRR3, ColRR4
|
||||
eeRectf(
|
||||
eeVector2f(
|
||||
0.f,
|
||||
(eeFloat)mWindow->GetHeight() - mEEText.GetTextHeight()
|
||||
),
|
||||
eeVector2f(
|
||||
mEEText.GetTextWidth(),
|
||||
mEEText.GetTextHeight()
|
||||
)
|
||||
),
|
||||
ColRR1, ColRR2, ColRR3, ColRR4
|
||||
);
|
||||
|
||||
mEEText.Draw( 0.f, (eeFloat)mWindow->GetHeight() - mEEText.GetTextHeight(), FONT_DRAW_CENTER );
|
||||
|
||||
Reference in New Issue
Block a user