diff --git a/JGE/include/JRenderer.h b/JGE/include/JRenderer.h index d8feda767..0bf90a806 100644 --- a/JGE/include/JRenderer.h +++ b/JGE/include/JRenderer.h @@ -73,7 +73,8 @@ protected: void InitRenderer(); void DestroyRenderer(); - + float mActualWidth; + float mActualHeight; public: @@ -524,6 +525,29 @@ public: ////////////////////////////////////////////////////////////////////////// void SetImageFilter(JImageFilter* imageFilter); + /** + ** Set/Get methods for the actual display screen size. + */ + inline void SetActualWidth(float inWidth) + { + mActualWidth = inWidth; + } + + inline void SetActualHeight(float inHeight) + { + mActualHeight = inHeight; + } + + inline float GetActualWidth() + { + return mActualWidth; + } + + inline float GetActualHeight() + { + return mActualHeight; + } + private: struct TextureInfo diff --git a/JGE/src/pc/JGfx.cpp b/JGE/src/pc/JGfx.cpp index 901bbc35b..541f3609f 100644 --- a/JGE/src/pc/JGfx.cpp +++ b/JGE/src/pc/JGfx.cpp @@ -11,8 +11,6 @@ #ifdef WIN32 #pragma warning(disable : 4786) - extern int actualWidth; - extern int actualHeight; #pragma comment( lib, "giflib.lib" ) #endif @@ -393,7 +391,7 @@ void JRenderer::Destroy() } } -JRenderer::JRenderer() +JRenderer::JRenderer() : mActualWidth(SCREEN_WIDTH_F), mActualHeight(SCREEN_HEIGHT_F) { } @@ -814,8 +812,8 @@ void JRenderer::BeginScene() esOrtho(&theMvpMatrix, 0.0f, SCREEN_WIDTH_F, 0.0f, SCREEN_HEIGHT_F-1.0f,-1.0f, 1.0f); #endif //(!defined GL_ES_VERSION_2_0) && (!defined GL_VERSION_2_0) #ifdef WIN32 - float scaleH = (float)actualHeight/SCREEN_HEIGHT_F; - float scaleW = (float)actualWidth/SCREEN_WIDTH_F; + float scaleH = mActualHeight/SCREEN_HEIGHT_F; + float scaleW = mActualWidth/SCREEN_WIDTH_F; glScalef(scaleW,scaleW,1.f); #endif checkGlError(); diff --git a/JGE/src/winmain.cpp b/JGE/src/winmain.cpp index 1d2ec492f..f6fa591cd 100644 --- a/JGE/src/winmain.cpp +++ b/JGE/src/winmain.cpp @@ -10,9 +10,6 @@ * Visit My Site At nehe.gamedev.net */ -int actualWidth; -int actualHeight; - #ifdef WIN32 #include // Header File For Windows #else @@ -199,8 +196,8 @@ GLvoid ReSizeGLScene(GLsizei width, GLsizei height) // Resize And Initialize Th if (height==0) // Prevent A Divide By Zero By height=1; // Making Height Equal One - actualWidth = width; - actualHeight = height; + JRenderer::GetInstance()->SetActualWidth(static_cast(width)); + JRenderer::GetInstance()->SetActualHeight(static_cast(height)); glScissor(0, 0, width, height); glViewport (0, 0, width, height); // Reset The Current Viewport @@ -353,8 +350,8 @@ void KillGLWindow(void) // Properly Kill The Window BOOL CreateGLWindow(char* title, int width, int height, int bits, bool fullscreenflag) { - actualWidth = width; - actualHeight = height; + JRenderer::GetInstance()->SetActualWidth(static_cast(width)); + JRenderer::GetInstance()->SetActualWidth(static_cast(height)); GLuint pixelFormat; // Holds The Results After Searching For A Match diff --git a/projects/mtg/include/GuiHand.h b/projects/mtg/include/GuiHand.h index 5f2f4aa55..036cb1ac8 100644 --- a/projects/mtg/include/GuiHand.h +++ b/projects/mtg/include/GuiHand.h @@ -56,11 +56,12 @@ class GuiHandOpponent : public GuiHand class GuiHandSelf : public GuiHand { protected: - enum + typedef enum { Open, Closed - } state; + } HandState; + HandState state; Pos backpos; public: @@ -75,6 +76,11 @@ class GuiHandSelf : public GuiHand void Update(float dt); float LeftBoundary(); + HandState GetState() + { + return state; + }; + HandLimitor* limitor; }; diff --git a/projects/mtg/src/Navigator.cpp b/projects/mtg/src/Navigator.cpp index ff1656221..e8434e74a 100644 --- a/projects/mtg/src/Navigator.cpp +++ b/projects/mtg/src/Navigator.cpp @@ -718,7 +718,7 @@ int Navigator::CardToCardZone(PlayGuiObject* inCard) // isAI = card->getCard()->target->owner->isAI(); // nasty hack: the lines above don't always work, as when an enchantment comes into play, its ability hasn't been activated yet, // so it doesn't yet have a target. Instead, we now look at the card's position, if it's in the top half of the screen, it goes into an AI zone - isAI = card->y < SCREEN_HEIGHT / 2; + isAI = card->y < JRenderer::GetInstance()->GetActualHeight() / 2; // enchantments that target creatures are treated as part of the creature zone if (card->getCard()->spellTargetType.find("creature") != string::npos) diff --git a/projects/mtg/template.vcproj b/projects/mtg/template.vcproj index 823518c0d..74109e24f 100644 --- a/projects/mtg/template.vcproj +++ b/projects/mtg/template.vcproj @@ -741,6 +741,10 @@ RelativePath=".\src\MTGRules.cpp" > + + @@ -1198,6 +1202,10 @@ RelativePath=".\include\MTGRules.h" > + +