# Add inputs and outputs from these tool invocations to the build variables
CPP_SRCS += \
+../src/battle/BattleState.cpp \
../src/battle/Monster.cpp
OBJS += \
+./src/battle/BattleState.o \
./src/battle/Monster.o
CPP_DEPS += \
+./src/battle/BattleState.d \
./src/battle/Monster.d
# Add inputs and outputs from these tool invocations to the build variables
CPP_SRCS += \
+../src/battle/BattleState.cpp \
../src/battle/Monster.cpp
OBJS += \
+./src/battle/BattleState.o \
./src/battle/Monster.o
CPP_DEPS += \
+./src/battle/BattleState.d \
./src/battle/Monster.d
--- /dev/null
+/*
+ * BattleState.cpp
+ *
+ * Created on: Aug 5, 2012
+ * Author: holy
+ */
+
+#include "BattleState.h"
+
+using app::Application;
+
+namespace battle {
+
+void BattleState::EnterState(Application &ctrl, SDL_Surface *screen) {
+
+}
+
+void BattleState::ExitState() {
+
+}
+
+
+void BattleState::HandleEvent(const SDL_Event &) {
+
+}
+
+void BattleState::UpdateWorld(float deltaT) {
+
+}
+
+void BattleState::Render(SDL_Surface *screen) {
+ // TODO: center background if screen bigger
+ SDL_BlitSurface(background, 0, screen, 0);
+}
+
+}
--- /dev/null
+/*
+ * BattleState.h
+ *
+ * Created on: Aug 5, 2012
+ * Author: holy
+ */
+
+#ifndef BATTLE_BATTLESTATE_H_
+#define BATTLE_BATTLESTATE_H_
+
+#include "Monster.h"
+#include "../app/State.h"
+
+#include <vector>
+#include <SDL.h>
+
+namespace battle {
+
+class BattleState
+: public app::State {
+
+public:
+ explicit BattleState(SDL_Surface *background)
+ : background(background) { }
+
+public:
+ virtual void EnterState(app::Application &ctrl, SDL_Surface *screen);
+ virtual void ExitState();
+
+ virtual void HandleEvent(const SDL_Event &);
+ virtual void UpdateWorld(float deltaT);
+ virtual void Render(SDL_Surface *);
+
+private:
+ SDL_Surface *background;
+ std::vector<Monster> monsters;
+
+};
+
+}
+
+#endif /* BATTLE_BATTLESTATE_H_ */
* Author: holy
*/
+#include "app/Application.h"
+#include "battle/BattleState.h"
#include "sdl/InitScreen.h"
#include "sdl/InitSDL.h"
#include <exception>
#include <iostream>
+using app::Application;
+using battle::BattleState;
using sdl::InitScreen;
using sdl::InitSDL;
const int width = 800;
const int height = 480;
+ // temporary
+ SDL_Surface *bg(SDL_CreateRGBSurface(0, width, height, 32, 0xFF000000, 0xFF0000, 0xFF00, 0xFF));
+ SDL_FillRect(bg, 0, SDL_MapRGB(bg->format, 0, 0, 0));
+
try {
InitSDL sdl;
InitScreen screen(width, height);
+ Application app(screen.Screen(), new BattleState(bg));
+ app.Run();
+
return 0;
} catch (exception &e) {
cerr << "exception in main(): " << e.what() << endl;