Commit 608deebe authored by gerstrong@gmail.com's avatar gerstrong@gmail.com

Cleanups

parent 7f6c4cf7
......@@ -13,7 +13,6 @@ if(USE_VIRTUALPAD)
ADD_DEFINITIONS(-DVIRTUALPAD)
endif(USE_VIRTUALPAD)
# Use COmpile TIme REducer
include(cotire)
......
......@@ -757,15 +757,15 @@ void CInput::pollEvents()
#if SDL_VERSION_ATLEAST(2, 0, 0)
case SDL_FINGERDOWN:
{
Vector2D<int> rotPt(Event.tfinger.x*float(activeArea.w),
Event.tfinger.y*float(activeArea.h));
#ifdef VIRTUALPAD
// If Virtual gamepad takes control...
if(gVideoDriver.VGamePadEnabled() && mpVirtPad &&
mpVirtPad->active() )
{
transMouseRelCoord(Pos, rotPt, activeArea, tiltedScreen);
Vector2D<int> rotPt(Event.tfinger.x*float(activeArea.w),
Event.tfinger.y*float(activeArea.h));
transMouseRelCoord(Pos, rotPt, activeArea, tiltedScreen);
if(!mpVirtPad->mouseFingerState(Pos, Event.tfinger, true))
{
......@@ -777,7 +777,8 @@ void CInput::pollEvents()
else
#endif
{
transMouseRelCoord(Pos, Event.tfinger, activeArea, tiltedScreen);
const Vector2D<int> rotPt(Event.tfinger.x, Event.tfinger.y);
transMouseRelCoord(Pos, rotPt, activeArea, tiltedScreen);
m_EventList.add( new PointingDevEvent( Pos, PDE_BUTTONDOWN ) );
gPointDevice.mPointingState.mActionButton = 1;
gPointDevice.mPointingState.mPos = Pos;
......@@ -807,7 +808,10 @@ void CInput::pollEvents()
#endif
{
passSDLEventVec = true;
const Vector2D<int> rotPt(Event.tfinger.x, Event.tfinger.y);
Vector2D<int> rotPt(Event.tfinger.x*float(activeArea.w),
Event.tfinger.y*float(activeArea.h));
transMouseRelCoord(Pos, rotPt, activeArea, tiltedScreen);
m_EventList.add( new PointingDevEvent( Pos, PDE_BUTTONUP ) );
gPointDevice.mPointingState.mActionButton = 0;
......
......@@ -9,8 +9,8 @@
*
*/
#ifndef __CG_COPENGL_H__
#define __CG_COPENGL_H__
#ifndef CG_COPENGL_H
#define CG_COPENGL_H
#ifdef USE_OPENGL
......@@ -53,14 +53,12 @@ public:
private:
unsigned int m_texparam;
//float m_aspectratio;
stDims m_GameScaleDim, m_GamePOTScaleDim;
GLuint m_texture;
GLuint m_texFX;
};
#endif
#endif // USE_OPENGL
#endif
#endif // CG_COPENGL_H
......@@ -32,10 +32,6 @@
* - derivative works of the program are allowed.
*/
#if HAVE_CONFIG_H
#include <config.h>
#endif
#include "scale2x.h"
#include <assert.h>
......@@ -262,6 +258,8 @@ static inline void scale2x_16_def_whole(scale2x_uint16* restrict dst0, scale2x_u
}
}
#ifndef USE_SCALE_RANDOMWRITE
static inline void scale2x_16_def_border(scale2x_uint16* restrict dst, const scale2x_uint16* restrict src0, const scale2x_uint16* restrict src1, const scale2x_uint16* restrict src2, unsigned count)
{
assert(count >= 2);
......@@ -307,6 +305,8 @@ static inline void scale2x_16_def_border(scale2x_uint16* restrict dst, const sca
}
}
#endif
static inline void scale2x_16_def_center(scale2x_uint16* restrict dst, const scale2x_uint16* restrict src0, const scale2x_uint16* restrict src1, const scale2x_uint16* restrict src2, unsigned count)
{
assert(count >= 2);
......
......@@ -32,7 +32,7 @@
* - derivative works of the program are allowed.
*/
#if HAVE_CONFIG_H
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
......@@ -537,6 +537,8 @@ static inline void scale3x_32_def_whole(scale3x_uint32* restrict dst0, scale3x_u
}
}
#ifndef USE_SCALE_RANDOMWRITE
static inline void scale3x_32_def_border(scale3x_uint32* restrict dst, const scale3x_uint32* restrict src0, const scale3x_uint32* restrict src1, const scale3x_uint32* restrict src2, unsigned count)
{
assert(count >= 2);
......@@ -588,8 +590,6 @@ static inline void scale3x_32_def_border(scale3x_uint32* restrict dst, const sca
}
}
#ifndef USE_SCALE_RANDOMWRITE
static inline void scale3x_32_def_center(scale3x_uint32* restrict dst, const scale3x_uint32* restrict src0, const scale3x_uint32* restrict src1, const scale3x_uint32* restrict src2, unsigned count)
{
assert(count >= 2);
......
......@@ -33,10 +33,6 @@
* - derivative works of the program are allowed.
*/
#if HAVE_CONFIG_H
#include <config.h>
#endif
#include "scale2x.h"
#include "scale3x.h"
......
......@@ -122,10 +122,12 @@ void CGUIComboSelection::processRender(const GsRect<float> &RectDispCoordFloat)
{
drawRect( blitsfc, &lRect, 1, 0x00BBBBBB, 0x00DFDFDF );
}
#ifndef DISABLE_HOVER
else if( mHovered )
{
drawRect( blitsfc, &lRect, 1, 0x00BBBBBB, 0x00EFEFEF );
}
#endif
else
{
drawRect( blitsfc, &lRect, 1, 0x00BBBBBB, 0x00FFFFFF );
......
......@@ -36,11 +36,19 @@ void GsControl::processBlendEffects()
if(mEnabled)
{
// For some nice special effects
#ifndef DISABLE_HOVER
if(mHovered || mSelected)
#else
if(mSelected)
#endif
{
int maxBlend = 224;
#ifndef DISABLE_HOVER
if(mHovered && mSelected)
#else
if(mSelected)
#endif
{
maxBlend = 255;
}
......@@ -79,15 +87,22 @@ void GsControl::processPointingState(const GsRect<float> &rect)
}
}
#ifndef DISABLE_HOVER
if(!bDown || mPressed)
{
mHovered = hasPoint;
mHovered = hasPoint;
}
if(mHovered && bDown)
{
mPressed = true;
}
#else
if(bDown)
{
mPressed = true;
}
#endif
}
......@@ -116,10 +131,12 @@ void GsControl::drawTwirl( const SDL_Rect& lRect )
}
// Now lets draw the text of the button
#ifndef DISABLE_HOVER
if(mHovered)
{
Font.drawCharacter( blit.getSDLSurface(), 127, lRect.x+16, lRect.y );
}
#endif
}
......@@ -135,7 +152,11 @@ void GsControl::drawBlinker( const SDL_Rect& lRect )
int tile;
#ifndef DISABLE_HOVER
const bool blink = (mHovered || mSelected) && mTwirliconID;
#else
const bool blink = mSelected && mTwirliconID;
#endif
if(!mEnabled)
{
......
......@@ -71,7 +71,9 @@ public:
void setDown( const bool value )
{
#ifndef DISABLE_HOVER
mHovered = value;
#endif
}
virtual bool sendEvent(const InputCommand) { return false; }
......
......@@ -108,10 +108,12 @@ void CGUIInputText::processRender(const GsRect<float> &RectDispCoordFloat)
{
drawRect( blitsfc, &lRect, 1, 0x00BBBBBB, 0x00DFDFDF );
}
#ifndef DISABLE_HOVER
else if( mHovered )
{
drawRect( blitsfc, &lRect, 1, 0x00BBBBBB, 0x00EFEFEF );
}
#endif
else
{
drawRect( blitsfc, &lRect, 1, 0x00BBBBBB, 0x00FFFFFF );
......
......@@ -11,8 +11,8 @@
#include "GsBaseMenu.h"
#ifndef __GSMENUCONTROLLER_H__
#define __GSMENUCONTROLLER_H__
#ifndef GSMENUCONTROLLER_H
#define GSMENUCONTROLLER_H
#define gMenuController CMenuController::get()
......@@ -97,4 +97,4 @@ private:
bool mHidden;
};
#endif /* __GSMENUCONTROLLER_H__ */
#endif /* GSMENUCONTROLLER_H */
......@@ -119,6 +119,7 @@ void CGUINumberControl::processLogic()
}
}
#ifndef DISABLE_HOVER
if(!bDown || mPressed)
{
mHovered = hasPoint;
......@@ -163,6 +164,47 @@ void CGUINumberControl::processLogic()
mLightRatio = 0;
}
}
#else
if(bDown)
{
mPressed = true;
if( mDecSel )
{
// Cycle through the values -> go one value down
if( mValue > mStartValue )
decrement();
}
else if( mIncSel )
{
// Cycle through the values -> go one value up
if( mValue < mEndValue )
increment();
}
mMustRedraw = true;
}
if(mEnabled)
{
// For some nice special effects
if(mSelected)
{
if(mLightRatio+BLEND_SPEED < 255)
mLightRatio += BLEND_SPEED;
else
mLightRatio = 255;
}
else // Button is not hovered
{
if(mLightRatio-BLEND_SPEED > 0)
mLightRatio -= BLEND_SPEED;
else
mLightRatio = 0;
}
}
#endif
}
......
......@@ -221,7 +221,7 @@ GsProgressBar::processRender(const GsRect<float> &RectDispCoordFloat)
progressColor = SDL_MapRGBA(
pBlitsurface->format,
0, 255, Uint8(mFlashBlue), 255 );
ss << "Completed!";
ss << "Finalizing!";
}
else
{
......
......@@ -167,7 +167,7 @@ private:
std::map<std::string,std::string> stringmap;
std::vector<stTeleporterTable> m_TeleporterTable; // Teleporter table used for the destinations
// used by Episode 1 especially
int numStrings;
// int numStrings;
size_t mEpisode;
bool mDemo;
......@@ -175,7 +175,7 @@ private:
EpisodeInfoStruct *pEpisodeInfo;
int mBwbLevel = 99;
// int mBwbLevel = 99;
};
#endif /* CBEHAVIORENGINE_H_ */
......@@ -23,8 +23,7 @@ const std::string EMPTY_TEXT = "EMPTY";
CSaveMenu::CSaveMenu(const GsControl::Style &style) :
GameMenu(GsRect<float>(0.1f, 0.0f, 0.8f, 1.0f), style ),
m_overwrite(false)
GameMenu(GsRect<float>(0.1f, 0.0f, 0.8f, 1.0f), style )
{
// Load the state-file list
std::vector<std::string> StateFileList;
......
......@@ -21,9 +21,10 @@ public:
void sendEvent(std::shared_ptr<CEvent> &command) override;
void release() override;
/*
private:
bool m_overwrite = false;
*/
};
#endif /* CSAVEMENU_H_ */
......@@ -113,7 +113,7 @@ private:
int mCurIdx = 0;
ComboSelection *mpComboSelection = nullptr;
//ComboSelection *mpComboSelection = nullptr;
GameButton *mpGameButton = nullptr;
GameButton *mpChangeButton = nullptr;
......
......@@ -42,19 +42,19 @@ CPlayerSpriteVarSelection(const GsControl::Style style) :
}
mpGameButton = new GameButton( "Start",
new SelectPlayerSpriteVarEvent(mCurIdx),
mpChangeButton = new GameButton( "Change",
new ChangeEvent(*this),
style);
mpMenuDialog->addControl( mpGameButton,
GsRect<float>(0.17f, 0.71f,
mpMenuDialog->addControl( mpChangeButton,
GsRect<float>(0.17f, 0.66f,
0.8f, 0.1f));
mpChangeButton = new GameButton( "Change",
new ChangeEvent(*this),
mpGameButton = new GameButton( "Start",
new SelectPlayerSpriteVarEvent(mCurIdx),
style);
mpMenuDialog->addControl( mpChangeButton,
mpMenuDialog->addControl( mpGameButton,
GsRect<float>(0.17f, 0.81f,
0.8f, 0.1f));
......
......@@ -6,7 +6,7 @@
#include <graphics/GsGraphics.h>
const int SLIDER_WIDTH = 16;
//const int SLIDER_WIDTH = 16;
NumberControl::NumberControl(const std::string &text,
const int startValue,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment