../src/map/Map.cpp \
../src/map/MapState.cpp \
../src/map/Tile.cpp \
+../src/map/TransitionState.cpp \
../src/map/Trigger.cpp
OBJS += \
./src/map/Map.o \
./src/map/MapState.o \
./src/map/Tile.o \
+./src/map/TransitionState.o \
./src/map/Trigger.o
CPP_DEPS += \
./src/map/Map.d \
./src/map/MapState.d \
./src/map/Tile.d \
+./src/map/TransitionState.d \
./src/map/Trigger.d
../src/map/Map.cpp \
../src/map/MapState.cpp \
../src/map/Tile.cpp \
+../src/map/TransitionState.cpp \
../src/map/Trigger.cpp
OBJS += \
./src/map/Map.o \
./src/map/MapState.o \
./src/map/Tile.o \
+./src/map/TransitionState.o \
./src/map/Trigger.o
CPP_DEPS += \
./src/map/Map.d \
./src/map/MapState.d \
./src/map/Tile.d \
+./src/map/TransitionState.d \
./src/map/Trigger.d
#include "Map.h"
#include "Tile.h"
+#include "TransitionState.h"
#include "Trigger.h"
#include "../app/Application.h"
#include "../app/Input.h"
+#include "../graphics/ColorFade.h"
#include <algorithm>
using app::Application;
using app::Input;
using geometry::Vector;
+using graphics::ColorFade;
namespace map {
MapState::MapState(Map *map)
-: map(map)
+: ctrl(0)
+, map(map)
, controlled(0)
, tempTarget(20, 20)
, camera(100, 100, &tempTarget)
}
-void MapState::EnterState(Application &ctrl, SDL_Surface *screen) {
+void MapState::EnterState(Application &c, SDL_Surface *screen) {
+ ctrl = &c;
camera.Resize(screen->w, screen->h);
LoadMap(map);
}
if (trigger) {
// TODO: run trigger script
if (trigger->map) {
- Transition(trigger->map, trigger->target);
+ ctrl->PushState(new ColorFade(this, 0, 500, true));
+ ctrl->PushState(new TransitionState(this, trigger->map, trigger->target));
+ ctrl->PushState(new ColorFade(this, 0, 500, false));
}
}
void CheckTrigger();
private:
+ app::Application *ctrl;
Map *map;
Entity *controlled;
app::Timer<float> moveTimer;
--- /dev/null
+/*
+ * TransitionState.cpp
+ *
+ * Created on: Oct 7, 2012
+ * Author: holy
+ */
+
+#include "TransitionState.h"
+
+#include "MapState.h"
+#include "../app/Application.h"
+
+using app::Application;
+using app::State;
+using app::Input;
+using geometry::Vector;
+
+namespace map {
+
+TransitionState::TransitionState(MapState *ms, Map *map, const Vector<int> &coordinates)
+: ctrl(0)
+, ms(ms)
+, map(map)
+, coordinates(coordinates) {
+
+}
+
+void TransitionState::EnterState(Application &c, SDL_Surface *screen) {
+ ctrl = &c;
+}
+
+void TransitionState::ExitState(Application &, SDL_Surface *screen) {
+
+}
+
+void TransitionState::ResumeState(Application &ctrl, SDL_Surface *screen) {
+
+}
+
+void TransitionState::PauseState(Application &ctrl, SDL_Surface *screen) {
+
+}
+
+
+void TransitionState::Resize(int width, int height) {
+
+}
+
+
+void TransitionState::HandleEvents(const Input &input) {
+ ms->Transition(map, coordinates);
+ ctrl->PopState();
+}
+
+
+void TransitionState::UpdateWorld(float deltaT) {
+
+}
+
+void TransitionState::Render(SDL_Surface *screen) {
+// ms->Render(screen);
+}
+
+}
--- /dev/null
+/*
+ * TransitionState.h
+ *
+ * Created on: Oct 7, 2012
+ * Author: holy
+ */
+
+#ifndef MAP_TRANSITIONSTATE_H_
+#define MAP_TRANSITIONSTATE_H_
+
+#include "fwd.h"
+#include "../app/State.h"
+#include "../geometry/Vector.h"
+
+namespace map {
+
+class TransitionState
+: public app::State {
+
+public:
+ TransitionState(MapState *, Map *, const geometry::Vector<int> &);
+ virtual ~TransitionState() { }
+
+public:
+ virtual void EnterState(app::Application &ctrl, SDL_Surface *screen);
+ virtual void ExitState(app::Application &ctrl, SDL_Surface *screen);
+ virtual void ResumeState(app::Application &ctrl, SDL_Surface *screen);
+ virtual void PauseState(app::Application &ctrl, SDL_Surface *screen);
+
+ virtual void Resize(int width, int height);
+
+ virtual void HandleEvents(const app::Input &);
+ virtual void UpdateWorld(float deltaT);
+ virtual void Render(SDL_Surface *);
+
+private:
+ app::Application *ctrl;
+ MapState *ms;
+ Map *map;
+ const geometry::Vector<int> &coordinates;
+
+};
+
+}
+
+#endif /* MAP_TRANSITIONSTATE_H_ */
class Map;
class MapState;
class Tile;
+class TransitionState;
class Trigger;
}