# All of the sources participating in the build are defined here
-include sources.mk
-include src/sdl/subdir.mk
+-include src/menu/subdir.mk
-include src/map/subdir.mk
-include src/loader/subdir.mk
-include src/graphics/subdir.mk
# Every subdirectory with source files must be described here
SUBDIRS := \
src/sdl \
+src/menu \
src/map \
src \
src/loader \
--- /dev/null
+################################################################################
+# Automatically-generated file. Do not edit!
+################################################################################
+
+# Add inputs and outputs from these tool invocations to the build variables
+CPP_SRCS += \
+../src/menu/PartyMenu.cpp \
+../src/menu/Resources.cpp
+
+OBJS += \
+./src/menu/PartyMenu.o \
+./src/menu/Resources.o
+
+CPP_DEPS += \
+./src/menu/PartyMenu.d \
+./src/menu/Resources.d
+
+
+# Each subdirectory must supply rules for building sources it contributes
+src/menu/%.o: ../src/menu/%.cpp
+ @echo 'Building file: $<'
+ @echo 'Invoking: GCC C++ Compiler'
+ g++ -I/usr/include/SDL -O0 -g3 -Wall -Werror -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<"
+ @echo 'Finished building: $<'
+ @echo ' '
+
+
# All of the sources participating in the build are defined here
-include sources.mk
-include src/sdl/subdir.mk
+-include src/menu/subdir.mk
-include src/map/subdir.mk
-include src/loader/subdir.mk
-include src/graphics/subdir.mk
# Every subdirectory with source files must be described here
SUBDIRS := \
src/sdl \
+src/menu \
src/map \
src \
src/loader \
--- /dev/null
+################################################################################
+# Automatically-generated file. Do not edit!
+################################################################################
+
+# Add inputs and outputs from these tool invocations to the build variables
+CPP_SRCS += \
+../src/menu/PartyMenu.cpp \
+../src/menu/Resources.cpp
+
+OBJS += \
+./src/menu/PartyMenu.o \
+./src/menu/Resources.o
+
+CPP_DEPS += \
+./src/menu/PartyMenu.d \
+./src/menu/Resources.d
+
+
+# Each subdirectory must supply rules for building sources it contributes
+src/menu/%.o: ../src/menu/%.cpp
+ @echo 'Building file: $<'
+ @echo 'Invoking: GCC C++ Compiler'
+ g++ -DNDEBUG -I/usr/include/SDL -O3 -Wall -Werror -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<"
+ @echo 'Finished building: $<'
+ @echo ' '
+
+
GameConfig::GameConfig()
: state(0)
, battleResources(0)
-, heroesLayout(0) {
+, heroesLayout(0)
+, menuResources(0) {
}
#include "fwd.h"
#include "../battle/fwd.h"
+#include "../menu/fwd.h"
namespace common {
battle::Resources *battleResources;
battle::PartyLayout *heroesLayout;
+ menu::Resources *menuResources;
+
};
}
#include "graphics/Menu.h"
#include "graphics/SimpleAnimation.h"
#include "graphics/Sprite.h"
+#include "graphics/Texture.h"
#include "loader/Caster.h"
#include "loader/Interpreter.h"
#include "loader/ParsedSource.h"
#include "map/MapState.h"
#include "map/Tile.h"
#include "map/Trigger.h"
+#include "menu/Resources.h"
#include "sdl/InitImage.h"
#include "sdl/InitScreen.h"
#include "sdl/InitSDL.h"
using common::GameState;
using common::Spell;
using geometry::Vector;
+using graphics::Texture;
using loader::Caster;
using loader::Interpreter;
using loader::ParsedSource;
gameState.heroes[3].MapEntity().SetFlags(Entity::FLAG_NONBLOCKING);
gameState.heroes[2].MapEntity().AddFollower(&gameState.heroes[3].MapEntity());
+ menu::Resources menuResources;
+ gameConfig.menuResources = &menuResources;
+
+ Texture menubg;
+ menubg.SetSurface(IMG_Load("test-data/menubg.png"));
+ menubg.SetSize(Vector<int>(64, 64));
+ menuResources.menubg = &menubg;
+
InitScreen screen(width, height);
app::State *state(0);
#include "../common/GameConfig.h"
#include "../common/GameState.h"
#include "../graphics/ColorFade.h"
+#include "../menu/PartyMenu.h"
#include <algorithm>
using common::GameConfig;
using geometry::Vector;
using graphics::ColorFade;
+using menu::PartyMenu;
namespace map {
void MapState::HandleEvents(const Input &input) {
+ if (input.JustPressed(Input::ACTION_X)) {
+ Ctrl().PushState(new PartyMenu(game));
+ return;
+ }
+
if (!controlled) return;
if (input.IsDown(Input::PAD_UP)) {
--- /dev/null
+/*
+ * PartyMenu.cpp
+ *
+ * Created on: Oct 21, 2012
+ * Author: holy
+ */
+
+#include "PartyMenu.h"
+
+#include "Resources.h"
+#include "../app/Application.h"
+#include "../app/Input.h"
+#include "../common/GameConfig.h"
+#include "../geometry/Vector.h"
+#include "../graphics/Texture.h"
+
+using app::Input;
+using common::GameConfig;
+using geometry::Vector;
+
+namespace menu {
+
+PartyMenu::PartyMenu(GameConfig *game)
+: game(game) {
+
+}
+
+PartyMenu::~PartyMenu() {
+
+}
+
+
+void PartyMenu::OnEnterState(SDL_Surface *) {
+
+}
+
+void PartyMenu::OnExitState(SDL_Surface *) {
+
+}
+
+void PartyMenu::OnResumeState(SDL_Surface *) {
+
+}
+
+void PartyMenu::OnPauseState(SDL_Surface *) {
+
+}
+
+
+void PartyMenu::OnResize(int width, int height) {
+
+}
+
+
+void PartyMenu::HandleEvents(const Input &input) {
+ if (input.JustPressed(Input::ACTION_B)) {
+ Ctrl().PopState();
+ return;
+ }
+}
+
+void PartyMenu::UpdateWorld(float deltaT) {
+
+}
+
+void PartyMenu::Render(SDL_Surface *screen) {
+ Res().menubg->Render(screen, Vector<int>(), Vector<int>(screen->w, screen->h));
+}
+
+
+Resources &PartyMenu::Res() {
+ return *game->menuResources;
+}
+
+const Resources &PartyMenu::Res() const {
+ return *game->menuResources;
+}
+
+}
--- /dev/null
+/*
+ * PartyMenu.h
+ *
+ * Created on: Oct 21, 2012
+ * Author: holy
+ */
+
+#ifndef MENU_PARTYMENU_H_
+#define MENU_PARTYMENU_H_
+
+#include "Resources.h"
+#include "../app/State.h"
+#include "../common/GameConfig.h"
+
+namespace menu {
+
+class PartyMenu
+: public app::State {
+
+public:
+ explicit PartyMenu(common::GameConfig *);
+ virtual ~PartyMenu();
+
+public:
+ virtual void HandleEvents(const app::Input &);
+ virtual void UpdateWorld(float deltaT);
+ virtual void Render(SDL_Surface *);
+
+public:
+ Resources &Res();
+ const Resources &Res() const;
+
+private:
+ virtual void OnEnterState(SDL_Surface *screen);
+ virtual void OnExitState(SDL_Surface *screen);
+ virtual void OnResumeState(SDL_Surface *screen);
+ virtual void OnPauseState(SDL_Surface *screen);
+
+ virtual void OnResize(int width, int height);
+
+private:
+ common::GameConfig *game;
+
+};
+
+}
+
+#endif /* MENU_PARTYMENU_H_ */
--- /dev/null
+/*
+ * Resources.cpp
+ *
+ * Created on: Oct 21, 2012
+ * Author: holy
+ */
+
+#include "Resources.h"
+
+namespace menu {
+
+Resources::Resources()
+: menubg(0) {
+
+}
+
+}
--- /dev/null
+/*
+ * Resources.h
+ *
+ * Created on: Oct 21, 2012
+ * Author: holy
+ */
+
+#ifndef MENU_RESOURCES_H_
+#define MENU_RESOURCES_H_
+
+#include "../graphics/fwd.h"
+
+namespace menu {
+
+struct Resources {
+
+ graphics::Texture *menubg;
+
+ Resources();
+
+};
+
+}
+
+#endif /* MENU_RESOURCES_H_ */
--- /dev/null
+/*
+ * fwd.h
+ *
+ * Created on: Oct 21, 2012
+ * Author: holy
+ */
+
+#ifndef MENU_FWD_H_
+#define MENU_FWD_H_
+
+namespace menu {
+
+class PartyMenu;
+struct Resources;
+
+}
+
+#endif /* MENU_FWD_H_ */