mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-08-13 04:42:12 +03:00
Added some usefull functions for the cursor manager.
Some minor clean up.
This commit is contained in:
@@ -72,7 +72,7 @@
|
||||
#endif
|
||||
|
||||
#ifndef EE_DEBUG
|
||||
#if defined( DEBUG ) || defined( _DEBUG ) || defined( __DEBUG )
|
||||
#if defined( DEBUG ) || defined( _DEBUG ) || defined( __DEBUG ) || defined( __DEBUG__ )
|
||||
#define EE_DEBUG
|
||||
#endif
|
||||
#endif
|
||||
|
||||
1
src/ee.h
1
src/ee.h
@@ -23,7 +23,6 @@
|
||||
|
||||
/**
|
||||
@TODO Check for endianness problems, and make EEPP endianness agnostic.
|
||||
@TODO May be SFML backend ( may be implement as the default build-in backend with sfml-window static linked ).
|
||||
@TODO Support for Android and iOS.
|
||||
@TODO Add Scripting support ( squirrel or angel script ).
|
||||
*/
|
||||
|
||||
@@ -120,12 +120,12 @@ void cBatchRenderer::Flush() {
|
||||
|
||||
Uint32 alloc = sizeof(eeVertex) * NumVertex;
|
||||
|
||||
GLi->VertexPointer ( 2, GL_FP , sizeof(eeVertex), reinterpret_cast<char*> ( &mVertex[0] ) , alloc );
|
||||
GLi->VertexPointer ( 2, GL_FP , sizeof(eeVertex), reinterpret_cast<char*> ( &mVertex[0] ) , alloc );
|
||||
GLi->ColorPointer ( 4, GL_UNSIGNED_BYTE , sizeof(eeVertex), reinterpret_cast<char*> ( &mVertex[0] ) + sizeof(eeVector2f) + sizeof(eeTexCoord) , alloc );
|
||||
|
||||
if ( NULL != mTexture ) {
|
||||
cTextureFactory::instance()->Bind( mTexture );
|
||||
GLi->TexCoordPointer( 2, GL_FP , sizeof(eeVertex), reinterpret_cast<char*> ( &mVertex[0] ) + sizeof(eeVector2f) , alloc );
|
||||
GLi->TexCoordPointer( 2, GL_FP , sizeof(eeVertex), reinterpret_cast<char*> ( &mVertex[0] ) + sizeof(eeVector2f) , alloc );
|
||||
} else {
|
||||
GLi->Disable( GL_TEXTURE_2D );
|
||||
GLi->DisableClientState( GL_TEXTURE_COORD_ARRAY );
|
||||
|
||||
@@ -16,7 +16,6 @@ class CP_API cPhysicsManager : public tSingleton<cPhysicsManager> {
|
||||
class cDrawSpaceOptions {
|
||||
public:
|
||||
cDrawSpaceOptions() :
|
||||
DrawHash( false ),
|
||||
DrawBBs( false ),
|
||||
DrawShapes( true ),
|
||||
CollisionPointSize( 4.0f ),
|
||||
@@ -24,7 +23,6 @@ class CP_API cPhysicsManager : public tSingleton<cPhysicsManager> {
|
||||
LineThickness( 1.5f )
|
||||
{}
|
||||
|
||||
bool DrawHash;
|
||||
bool DrawBBs;
|
||||
bool DrawShapes;
|
||||
cpFloat CollisionPointSize;
|
||||
|
||||
@@ -169,8 +169,12 @@ cShapeSegment * cShape::GetAsSegment() {
|
||||
void cShape::DrawBB() {
|
||||
#ifdef PHYSICS_RENDERER_ENABLED
|
||||
cPrimitives P;
|
||||
P.SetColor( eeColorA( 76, 128, 76, 255 ) );
|
||||
P.DrawRectangle( eeRectf( mShape->bb.l, mShape->bb.t, mShape->bb.r, mShape->bb.b ), 0.f, 1.f, EE_DRAW_LINE );
|
||||
P.SetColor( eeColorA( 76, 128, 76, 255 ) );
|
||||
P.ForceDraw( false );
|
||||
P.DrawLine( eeVector2f( mShape->bb.l, mShape->bb.t ), eeVector2f( mShape->bb.r, mShape->bb.t ) );
|
||||
P.DrawLine( eeVector2f( mShape->bb.l, mShape->bb.t ), eeVector2f( mShape->bb.l, mShape->bb.b ) );
|
||||
P.DrawLine( eeVector2f( mShape->bb.l, mShape->bb.b ), eeVector2f( mShape->bb.r, mShape->bb.b ) );
|
||||
P.DrawLine( eeVector2f( mShape->bb.r, mShape->bb.t ), eeVector2f( mShape->bb.r, mShape->bb.b ) );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -291,32 +291,28 @@ void cSpace::Draw() {
|
||||
cpFloat lw = BR->GetLineWidth();
|
||||
cpFloat ps = BR->GetPointSize();
|
||||
|
||||
if( options->DrawHash ) {
|
||||
//cpBBTreeRenderDebug( mSpace->staticShapes );
|
||||
//cpBBTreeRenderDebug( mSpace->activeShapes );
|
||||
}
|
||||
|
||||
BR->SetLineWidth( options->LineThickness );
|
||||
|
||||
if( options->DrawShapes ) {
|
||||
if ( options->DrawShapes ) {
|
||||
cpSpatialIndexEach( mSpace->CP_PRIVATE(activeShapes), (cpSpatialIndexIteratorFunc)drawObject, mSpace );
|
||||
cpSpatialIndexEach( mSpace->CP_PRIVATE(staticShapes), (cpSpatialIndexIteratorFunc)drawObject, mSpace );
|
||||
}
|
||||
|
||||
BR->SetLineWidth( lw );
|
||||
|
||||
if( options->DrawBBs ){
|
||||
if ( options->DrawBBs ){
|
||||
cpSpatialIndexEach( mSpace->CP_PRIVATE(activeShapes), (cpSpatialIndexIteratorFunc)drawBB, NULL );
|
||||
cpSpatialIndexEach( mSpace->CP_PRIVATE(staticShapes), (cpSpatialIndexIteratorFunc)drawBB, NULL );
|
||||
BR->Draw();
|
||||
}
|
||||
|
||||
cpArray * constraints = mSpace->CP_PRIVATE(constraints);
|
||||
|
||||
for( int i=0, count = constraints->num; i < count; i++ ) {
|
||||
for ( int i = 0, count = constraints->num; i < count; i++ ) {
|
||||
drawConstraint( (cpConstraint *)constraints->arr[i] );
|
||||
}
|
||||
|
||||
if( options->BodyPointSize ) {
|
||||
if ( options->BodyPointSize ) {
|
||||
BR->SetPointSize( options->BodyPointSize );
|
||||
BR->PointsBegin();
|
||||
BR->PointSetColor( eeColorA( 255, 255, 255, 255 ) );
|
||||
|
||||
@@ -1704,7 +1704,6 @@ void cEETest::PhysicsCreate() {
|
||||
cPhysicsManager * PM = cPhysicsManager::instance();
|
||||
cPhysicsManager::cDrawSpaceOptions * DSO = PM->GetDrawOptions();
|
||||
|
||||
DSO->DrawHash = false;
|
||||
DSO->DrawBBs = false;
|
||||
DSO->DrawShapes = true;
|
||||
DSO->CollisionPointSize = 0;
|
||||
|
||||
@@ -25,7 +25,7 @@ cCursor * cCursorManagerSDL::Create( const std::string& path, const eeVector2i&
|
||||
void cCursorManagerSDL::Set( cCursor * cursor ) {
|
||||
SDL_SetCursor( reinterpret_cast<cCursorSDL*>( cursor )->GetCursor() );
|
||||
|
||||
mCurrrent = cursor;
|
||||
mCurrent = cursor;
|
||||
mCurSysCursor = false;
|
||||
mSysCursor = Cursor::SYS_CURSOR_NONE;
|
||||
}
|
||||
@@ -33,7 +33,7 @@ void cCursorManagerSDL::Set( cCursor * cursor ) {
|
||||
void cCursorManagerSDL::Set( EE_SYSTEM_CURSOR syscurid ) {
|
||||
mWindow->GetPlatform()->SetSystemMouseCursor( syscurid );
|
||||
|
||||
mCurrrent = NULL;
|
||||
mCurrent = NULL;
|
||||
mCurSysCursor = true;
|
||||
mSysCursor = syscurid;
|
||||
}
|
||||
@@ -67,7 +67,7 @@ void cCursorManagerSDL::Reload() {
|
||||
if ( mCurSysCursor ) {
|
||||
Set( mSysCursor );
|
||||
} else {
|
||||
Set( mCurrrent );
|
||||
Set( mCurrent );
|
||||
}
|
||||
} else {
|
||||
Hide();
|
||||
|
||||
@@ -28,14 +28,14 @@ void cCursorManagerAl::Set( cCursor * cursor ) {
|
||||
return;
|
||||
|
||||
al_set_mouse_cursor( reinterpret_cast<cWindowAl*>( mWindow )->GetDisplay(), reinterpret_cast<cCursorAl*>( cursor )->GetCursor() );
|
||||
mCurrrent = cursor;
|
||||
mCurrent = cursor;
|
||||
mCurSysCursor = false;
|
||||
mSysCursor = Cursor::SYS_CURSOR_NONE;
|
||||
}
|
||||
|
||||
void cCursorManagerAl::Set( EE_SYSTEM_CURSOR syscurid ) {
|
||||
al_set_system_mouse_cursor( reinterpret_cast<cWindowAl*>( mWindow )->GetDisplay(), (ALLEGRO_SYSTEM_MOUSE_CURSOR)syscurid );
|
||||
mCurrrent = NULL;
|
||||
mCurrent = NULL;
|
||||
mCurSysCursor = true;
|
||||
mSysCursor = syscurid;
|
||||
}
|
||||
@@ -69,7 +69,7 @@ void cCursorManagerAl::Reload() {
|
||||
if ( mCurSysCursor ) {
|
||||
Set( mSysCursor );
|
||||
} else {
|
||||
Set( mCurrrent );
|
||||
Set( mCurrent );
|
||||
}
|
||||
} else {
|
||||
Hide();
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace EE { namespace Window {
|
||||
|
||||
cCursorManager::cCursorManager( cWindow * window ) :
|
||||
mWindow( window ),
|
||||
mCurrrent( NULL ),
|
||||
mCurrent( NULL ),
|
||||
mSysCursor( SYS_CURSOR_NONE ),
|
||||
mCursors(),
|
||||
mCurSysCursor( SYS_CURSOR_NONE ),
|
||||
@@ -75,5 +75,17 @@ bool cCursorManager::Visible() {
|
||||
return mVisible;
|
||||
}
|
||||
|
||||
cCursor * cCursorManager::Current() const {
|
||||
return mCurrent;
|
||||
}
|
||||
|
||||
EE_SYSTEM_CURSOR cCursorManager::CurrentSysCursor() const {
|
||||
return mSysCursor;
|
||||
}
|
||||
|
||||
bool cCursorManager::CurrentIsSysCursor() const {
|
||||
return mCurSysCursor;
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
|
||||
@@ -55,10 +55,16 @@ class EE_API cCursorManager {
|
||||
virtual void Visible( bool visible ) = 0;
|
||||
|
||||
virtual bool Visible();
|
||||
|
||||
cCursor * Current() const;
|
||||
|
||||
EE_SYSTEM_CURSOR CurrentSysCursor() const;
|
||||
|
||||
bool CurrentIsSysCursor() const;
|
||||
protected:
|
||||
typedef std::set<cCursor*> CursorsList;
|
||||
cWindow * mWindow;
|
||||
cCursor * mCurrrent;
|
||||
cCursor * mCurrent;
|
||||
EE_SYSTEM_CURSOR mSysCursor;
|
||||
CursorsList mCursors;
|
||||
bool mCurSysCursor;
|
||||
|
||||
@@ -20,8 +20,6 @@
|
||||
#define BACKEND_SDL 1
|
||||
#define BACKEND_ALLEGRO 2
|
||||
|
||||
//#define DEFAULT_BACKEND BACKEND_ALLEGRO
|
||||
|
||||
#ifndef DEFAULT_BACKEND
|
||||
|
||||
#if defined( EE_BACKEND_SDL_ACTIVE )
|
||||
|
||||
Reference in New Issue
Block a user