J :
* Input fix. * A lot of code cleaning spread across a lot of files.
This commit is contained in:
@@ -34,7 +34,7 @@ class ActionElement: public JGuiObject{
|
||||
virtual void Render(){};
|
||||
virtual int testDestroy(){return 0;};
|
||||
virtual int destroy(){return 0;};
|
||||
virtual void CheckUserInput(float dt){};
|
||||
virtual bool CheckUserInput(u32 key){return false;};
|
||||
ActionElement(int id);
|
||||
virtual int isReactingToTargetClick(Targetable * card);
|
||||
virtual int reactToTargetClick(Targetable * card);
|
||||
|
||||
@@ -21,14 +21,13 @@ class ActionLayer: public GuiLayer, public JGuiListener{
|
||||
virtual void Render();
|
||||
virtual void Update(float dt);
|
||||
int unstopableRenderInProgress();
|
||||
void CheckUserInput(float dt);
|
||||
bool CheckUserInput(u32 key);
|
||||
ActionLayer(int id, GameObserver* _game):GuiLayer(id, _game){ menuObject = NULL; abilitiesMenu = NULL;};
|
||||
int isWaitingForAnswer();
|
||||
int isReactingToTargetClick(Targetable * card);
|
||||
int reactToTargetClick(Targetable * card);
|
||||
int isReactingToClick(MTGCardInstance * card);
|
||||
int reactToClick(MTGCardInstance * card);
|
||||
int isModal();
|
||||
void setMenuObject(Targetable * object);
|
||||
void ButtonPressed(int controllerid, int controlid);
|
||||
TargetChooser * getCurrentTargetChooser();
|
||||
|
||||
@@ -104,7 +104,7 @@ class DrawAction: public Interruptible {
|
||||
class ActionStack :public GuiLayer{
|
||||
protected:
|
||||
int interruptDecision[2];
|
||||
int timer;
|
||||
float timer;
|
||||
int currentState;
|
||||
int mode;
|
||||
int checked;
|
||||
@@ -135,7 +135,7 @@ class ActionStack :public GuiLayer{
|
||||
int addDamage(MTGCardInstance * _source, Damageable * target, int _damage);
|
||||
int addAbility(MTGAbility * ability);
|
||||
void Update(float dt);
|
||||
void CheckUserInput(float dt);
|
||||
bool CheckUserInput(u32 key);
|
||||
virtual void Render();
|
||||
ActionStack(int id, GameObserver* _game);
|
||||
int resolve();
|
||||
|
||||
@@ -1228,7 +1228,7 @@ class AAladdinsLamp: public TargetAbility{
|
||||
init = 1;
|
||||
}
|
||||
cd.Update(dt);
|
||||
cd.CheckUserInput(dt);
|
||||
// cd.CheckUserInput(dt);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1604,28 +1604,30 @@ class AFarmstead:public ActivatedAbility{
|
||||
class AGlassesOfUrza:public MTGAbility{
|
||||
public:
|
||||
CardDisplay * display;
|
||||
AGlassesOfUrza(int _id, MTGCardInstance * _source):MTGAbility(_id, _source){
|
||||
bool isActive;
|
||||
AGlassesOfUrza(int _id, MTGCardInstance * _source):MTGAbility(_id, _source),isActive(false){
|
||||
display = NEW CardDisplay(0, game,SCREEN_WIDTH/2, SCREEN_HEIGHT/2,NULL);
|
||||
}
|
||||
|
||||
void Update(float dt){
|
||||
if(modal){
|
||||
if(isActive){
|
||||
display->Update(dt);
|
||||
}
|
||||
}
|
||||
|
||||
void CheckUserInput(float dt){
|
||||
if (modal){
|
||||
display->CheckUserInput(dt);
|
||||
JGE * mEngine = JGE::GetInstance();
|
||||
if (mEngine->GetButtonClick(PSP_CTRL_CROSS)){
|
||||
modal = 0;
|
||||
bool CheckUserInput(u32 key){
|
||||
if (isActive){
|
||||
if (display->CheckUserInput(key)) return true;
|
||||
if (PSP_CTRL_CROSS == key){
|
||||
isActive = false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void Render(float dt){
|
||||
if (modal){
|
||||
if (isActive){
|
||||
display->Render();
|
||||
}
|
||||
|
||||
@@ -1642,7 +1644,7 @@ class AGlassesOfUrza:public MTGAbility{
|
||||
int reactToClick(MTGCardInstance * card){
|
||||
if (!isReactingToClick(card)) return 0;
|
||||
source->tapped = 1;
|
||||
modal = 1;
|
||||
isActive = true;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ class CardDisplay:public PlayGuiObjectController{
|
||||
void AddCard(MTGCardInstance * _card);
|
||||
void rotateLeft();
|
||||
void rotateRight();
|
||||
void CheckUserInput(float dt);
|
||||
bool CheckUserInput(u32 key);
|
||||
void Render();
|
||||
void init(MTGGameZone * zone);
|
||||
};
|
||||
|
||||
@@ -31,7 +31,7 @@ class DamageResolverLayer:public PlayGuiObjectController{
|
||||
int isOpponent(DamagerDamaged * a, DamagerDamaged * b);
|
||||
void nextPlayer();
|
||||
virtual void Update(float dt);
|
||||
virtual void CheckUserInput(float dt);
|
||||
virtual bool CheckUserInput(u32 key);
|
||||
virtual void Render();
|
||||
};
|
||||
|
||||
|
||||
@@ -17,14 +17,17 @@
|
||||
#define NO_USER_ACTIVITY_HELP_DELAY 10
|
||||
#define NO_USER_ACTIVITY_SHOWCARD_DELAY 0.1
|
||||
|
||||
#define STAGE_WAITING 2
|
||||
#define STAGE_TRANSITION_LEFT 1
|
||||
#define STAGE_TRANSITION_RIGHT 0
|
||||
#define STAGE_TRANSITION_UP 3
|
||||
#define STAGE_TRANSITION_DOWN 4
|
||||
#define STAGE_ONSCREEN_MENU 5
|
||||
#define STAGE_WELCOME 6
|
||||
#define STAGE_MENU 7
|
||||
enum
|
||||
{
|
||||
STAGE_TRANSITION_RIGHT = 0,
|
||||
STAGE_TRANSITION_LEFT = 1,
|
||||
STAGE_WAITING = 2,
|
||||
STAGE_TRANSITION_UP = 3,
|
||||
STAGE_TRANSITION_DOWN = 4,
|
||||
STAGE_ONSCREEN_MENU = 5,
|
||||
STAGE_WELCOME = 6,
|
||||
STAGE_MENU = 7
|
||||
};
|
||||
|
||||
|
||||
#define ALL_COLORS -1
|
||||
@@ -32,7 +35,9 @@
|
||||
#define ROTATE_LEFT 1;
|
||||
#define ROTATE_RIGHT 0;
|
||||
|
||||
|
||||
#define HIGH_SPEED 15.0
|
||||
#define MED_SPEED 5.0
|
||||
#define LOW_SPEED 1.5
|
||||
|
||||
|
||||
class GameStateDeckViewer: public GameState, public JGuiListener
|
||||
@@ -72,7 +77,7 @@ class GameStateDeckViewer: public GameState, public JGuiListener
|
||||
|
||||
GameStateDeckViewer(GameApp* parent): GameState(parent) {
|
||||
bgMusic = NULL;
|
||||
scrollSpeed = 10.0;
|
||||
scrollSpeed = HIGH_SPEED;
|
||||
}
|
||||
virtual ~GameStateDeckViewer() {
|
||||
SAFE_DELETE(bgMusic);
|
||||
@@ -289,7 +294,7 @@ class GameStateDeckViewer: public GameState, public JGuiListener
|
||||
case PSP_CTRL_UP :
|
||||
last_user_activity = 0;
|
||||
mStage = STAGE_TRANSITION_UP;
|
||||
colorFilter --;
|
||||
colorFilter--;
|
||||
if (colorFilter < -1) colorFilter = MTG_COLOR_LAND;
|
||||
break;
|
||||
case PSP_CTRL_DOWN :
|
||||
@@ -338,13 +343,12 @@ class GameStateDeckViewer: public GameState, public JGuiListener
|
||||
mStage = STAGE_MENU;
|
||||
break;
|
||||
case PSP_CTRL_SELECT :
|
||||
printf("%f\n", scrollSpeed);
|
||||
if (scrollSpeed == 10.0)
|
||||
scrollSpeed = 5.0;
|
||||
else if (scrollSpeed == 5.0)
|
||||
scrollSpeed = 1.0;
|
||||
if (scrollSpeed == HIGH_SPEED)
|
||||
scrollSpeed = MED_SPEED;
|
||||
else if (scrollSpeed == MED_SPEED)
|
||||
scrollSpeed = LOW_SPEED;
|
||||
else
|
||||
scrollSpeed = 10.0;
|
||||
scrollSpeed = HIGH_SPEED;
|
||||
break;
|
||||
default : // no keypress
|
||||
if (last_user_activity > NO_USER_ACTIVITY_HELP_DELAY){
|
||||
@@ -790,7 +794,4 @@ class GameStateDeckViewer: public GameState, public JGuiListener
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -6,17 +6,19 @@
|
||||
#include "_includeAll.h"
|
||||
#include "../include/SimpleMenu.h"
|
||||
|
||||
enum
|
||||
{
|
||||
DUEL_START,
|
||||
DUEL_END,
|
||||
DUEL_CHOOSE_DECK1,
|
||||
DUEL_CHOOSE_DECK2,
|
||||
ERROR_NO_DECK,
|
||||
DUEL_PLAY,
|
||||
DUEL_MENU
|
||||
};
|
||||
|
||||
#define DUEL_START 0
|
||||
#define DUEL_END 1
|
||||
#define DUEL_CHOOSE_DECK1 2
|
||||
#define DUEL_CHOOSE_DECK2 3
|
||||
#define ERROR_NO_DECK 4
|
||||
#define DUEL_PLAY 5
|
||||
#define DUEL_MENU 6
|
||||
#define CHOOSE_OPPONENT 7
|
||||
|
||||
|
||||
#ifdef TESTSUITE
|
||||
class TestSuite;
|
||||
#endif
|
||||
|
||||
@@ -25,11 +25,9 @@ class GuiLayer: public JGuiController{
|
||||
void RenderMessageBackground(float x0, float y0, float width, int height);
|
||||
void RenderMessageBackground(float y0, int height);
|
||||
GuiLayer(int id, GameObserver* _game);
|
||||
virtual int isModal();
|
||||
void setModal(int _modal);
|
||||
virtual ~GuiLayer();
|
||||
virtual void Update(float dt);
|
||||
virtual void CheckUserInput(float dt){};
|
||||
virtual bool CheckUserInput(u32 key){ return false; };
|
||||
virtual int unstopableRenderInProgress(){return 0;};
|
||||
int getIndexOf(JGuiObject * object);
|
||||
JGuiObject * getByIndex (int index);
|
||||
|
||||
@@ -17,7 +17,7 @@ class MTGGamePhase: public ActionElement {
|
||||
MTGGamePhase(int id);
|
||||
virtual void Render();
|
||||
virtual void Update(float dt);
|
||||
void CheckUserInput(float dt);
|
||||
bool CheckUserInput(u32 key);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ class MTGGuiHand: public GuiCardsController{
|
||||
public:
|
||||
MTGGuiHand(int id, GameObserver * _game);
|
||||
void Update(float dt);
|
||||
void CheckUserInput(float dt);
|
||||
bool CheckUserInput(u32 key);
|
||||
virtual void Render();
|
||||
void updateCards();
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ class MTGGuiPlay: public PlayGuiObjectController {
|
||||
MTGGuiPlay(int id, GameObserver * game);
|
||||
~MTGGuiPlay();
|
||||
void Update(float dt);
|
||||
void CheckUserInput(float dt);
|
||||
bool CheckUserInput(u32 key);
|
||||
virtual void Render();
|
||||
void updateCards();
|
||||
};
|
||||
|
||||
@@ -13,7 +13,7 @@ class PlayGuiObjectController : public GuiLayer{
|
||||
static int showBigCards;// 0 hide, 1 show, 2 show text
|
||||
public:
|
||||
virtual void Update(float dt);
|
||||
virtual void CheckUserInput(float dt);
|
||||
virtual bool CheckUserInput(u32 key);
|
||||
PlayGuiObjectController(int id, GameObserver* _game):GuiLayer(id, _game){last_user_move=0;};
|
||||
virtual void Render(){GuiLayer::Render();};
|
||||
};
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#ifndef _SIMPLEMENU_ITEM_H
|
||||
#define _SIMPLEMENU_ITEM_H
|
||||
|
||||
#include <string>
|
||||
#include <JLBFont.h>
|
||||
#include <JGui.h>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user