diff --git a/client/combat.cpp b/client/combat.cpp new file mode 100644 index 0000000..a40b144 --- /dev/null +++ b/client/combat.cpp @@ -0,0 +1,69 @@ +#include "combat.hpp" + +#include + +using namespace std; + +//------------------------- +//Public access members +//------------------------- + +Combat::Combat() { +#ifdef DEBUG + cout << "entering Combat" << endl; +#endif +} + +Combat::~Combat() { +#ifdef DEBUG + cout << "leaving Combat" << endl; +#endif +} + +//------------------------- +//Frame loop +//------------------------- + +void Combat::FrameStart() { + // +} + +void Combat::FrameEnd() { + // +} + +void Combat::Update() { + // +} + +void Combat::Render(SDL_Surface* const screen) { + // +} + +//------------------------- +//Event handlers +//------------------------- + +void Combat::MouseMotion(SDL_MouseMotionEvent const& motion) { + // +} + +void Combat::MouseButtonDown(SDL_MouseButtonEvent const& button) { + // +} + +void Combat::MouseButtonUp(SDL_MouseButtonEvent const& button) { + // +} + +void Combat::KeyDown(SDL_KeyboardEvent const& key) { + switch(key.keysym.sym) { + case SDLK_ESCAPE: + QuitEvent(); + break; + } +} + +void Combat::KeyUp(SDL_KeyboardEvent const& key) { + // +} diff --git a/client/combat.hpp b/client/combat.hpp new file mode 100644 index 0000000..ad73ca9 --- /dev/null +++ b/client/combat.hpp @@ -0,0 +1,27 @@ +#ifndef COMBAT_HPP_ +#define COMBAT_HPP_ + +#include "base_scene.hpp" + +class Combat : public BaseScene { +public: + /* Public access members */ + Combat(); + virtual ~Combat(); + +protected: + /* Frame loop */ + virtual void FrameStart(); + virtual void FrameEnd(); + virtual void Update(); + virtual void Render(SDL_Surface* const); + + /* Event handlers */ + virtual void MouseMotion(SDL_MouseMotionEvent const&); + virtual void MouseButtonDown(SDL_MouseButtonEvent const&); + virtual void MouseButtonUp(SDL_MouseButtonEvent const&); + virtual void KeyDown(SDL_KeyboardEvent const&); + virtual void KeyUp(SDL_KeyboardEvent const&); +}; + +#endif diff --git a/client/lobby.cpp b/client/lobby.cpp new file mode 100644 index 0000000..26591ab --- /dev/null +++ b/client/lobby.cpp @@ -0,0 +1,71 @@ +#include "lobby.hpp" + +#include + +using namespace std; + +//------------------------- +//Public access members +//------------------------- + +Lobby::Lobby() { +#ifdef DEBUG + cout << "entering Lobby" << endl; +#endif +} + +Lobby::~Lobby() { +#ifdef DEBUG + cout << "leaving Lobby" << endl; +#endif +} + +//------------------------- +//Frame loop +//------------------------- + +void Lobby::FrameStart() { + // +} + +void Lobby::FrameEnd() { + // +} + +void Lobby::Update() { + // +} + +void Lobby::Render(SDL_Surface* const screen) { + // +} + +//------------------------- +//Event handlers +//------------------------- + +void Lobby::MouseMotion(SDL_MouseMotionEvent const& motion) { + // +} + +void Lobby::MouseButtonDown(SDL_MouseButtonEvent const& button) { + // +} + +void Lobby::MouseButtonUp(SDL_MouseButtonEvent const& button) { + // +} + +void Lobby::KeyDown(SDL_KeyboardEvent const& key) { + switch(key.keysym.sym) { + case SDLK_ESCAPE: + QuitEvent(); + break; + } +} + +void Lobby::KeyUp(SDL_KeyboardEvent const& key) { + // +} + + diff --git a/client/lobby.hpp b/client/lobby.hpp new file mode 100644 index 0000000..8749ab9 --- /dev/null +++ b/client/lobby.hpp @@ -0,0 +1,27 @@ +#ifndef LOBBY_HPP_ +#define LOBBY_HPP_ + +#include "base_scene.hpp" + +class Lobby : public BaseScene { +public: + /* Public access members */ + Lobby(); + virtual ~Lobby(); + +protected: + /* Frame loop */ + virtual void FrameStart(); + virtual void FrameEnd(); + virtual void Update(); + virtual void Render(SDL_Surface* const); + + /* Event handlers */ + virtual void MouseMotion(SDL_MouseMotionEvent const&); + virtual void MouseButtonDown(SDL_MouseButtonEvent const&); + virtual void MouseButtonUp(SDL_MouseButtonEvent const&); + virtual void KeyDown(SDL_KeyboardEvent const&); + virtual void KeyUp(SDL_KeyboardEvent const&); +}; + +#endif diff --git a/client/main_menu.cpp b/client/main_menu.cpp new file mode 100644 index 0000000..69820bc --- /dev/null +++ b/client/main_menu.cpp @@ -0,0 +1,69 @@ +#include "main_menu.hpp" + +#include + +using namespace std; + +//------------------------- +//Public access members +//------------------------- + +MainMenu::MainMenu() { +#ifdef DEBUG + cout << "entering MainMenu" << endl; +#endif +} + +MainMenu::~MainMenu() { +#ifdef DEBUG + cout << "leaving MainMenu" << endl; +#endif +} + +//------------------------- +//Frame loop +//------------------------- + +void MainMenu::FrameStart() { + // +} + +void MainMenu::FrameEnd() { + // +} + +void MainMenu::Update() { + // +} + +void MainMenu::Render(SDL_Surface* const screen) { + // +} + +//------------------------- +//Event handlers +//------------------------- + +void MainMenu::MouseMotion(SDL_MouseMotionEvent const& motion) { + // +} + +void MainMenu::MouseButtonDown(SDL_MouseButtonEvent const& button) { + // +} + +void MainMenu::MouseButtonUp(SDL_MouseButtonEvent const& button) { + // +} + +void MainMenu::KeyDown(SDL_KeyboardEvent const& key) { + switch(key.keysym.sym) { + case SDLK_ESCAPE: + QuitEvent(); + break; + } +} + +void MainMenu::KeyUp(SDL_KeyboardEvent const& key) { + // +} diff --git a/client/main_menu.hpp b/client/main_menu.hpp new file mode 100644 index 0000000..1b26b3a --- /dev/null +++ b/client/main_menu.hpp @@ -0,0 +1,27 @@ +#ifndef MAINMENU_HPP_ +#define MAINMENU_HPP_ + +#include "base_scene.hpp" + +class MainMenu : public BaseScene { +public: + /* Public access members */ + MainMenu(); + virtual ~MainMenu(); + +protected: + /* Frame loop */ + virtual void FrameStart(); + virtual void FrameEnd(); + virtual void Update(); + virtual void Render(SDL_Surface* const); + + /* Event handlers */ + virtual void MouseMotion(SDL_MouseMotionEvent const&); + virtual void MouseButtonDown(SDL_MouseButtonEvent const&); + virtual void MouseButtonUp(SDL_MouseButtonEvent const&); + virtual void KeyDown(SDL_KeyboardEvent const&); + virtual void KeyUp(SDL_KeyboardEvent const&); +}; + +#endif diff --git a/client/makefile b/client/makefile index bdc723f..406cede 100644 --- a/client/makefile +++ b/client/makefile @@ -2,20 +2,36 @@ CXXFLAGS+=-std=c++11 -DDEBUG LIB=-lmingw32 -lSDLmain -lSDL -lwsock32 -lWS2_32 +#source +SRC=base_scene.cpp \ + scene_manager.cpp \ + test_systems.cpp \ + splash.cpp \ + main_menu.cpp \ + in_game.cpp \ + lobby.cpp \ + combat.cpp \ + surface_manager.cpp \ + image.cpp \ + sprite_sheet.cpp \ + player.cpp \ + player_manager.cpp \ + config_utility.cpp \ + network.cpp \ + network_tcp.cpp \ + main.cpp + #objects OBJDIR=obj -OBJ=$(addprefix $(OBJDIR)/,base_scene.o scene_manager.o surface_manager.o image.o sprite_sheet.o player.o player_manager.o config_utility.o network.o network_tcp.o) +OBJ=$(addprefix $(OBJDIR)/,$(SRC:.cpp=.o)) #output OUTDIR=out OUT=$(addprefix $(OUTDIR)/,a) -#source -SRC=test_systems.cpp in_game.cpp main.cpp - #targets all: $(OBJ) $(OUT) - $(CXX) $(CXXFLAGS) -o $(OUT) $(SRC) $(OBJ) $(LIB) + $(CXX) $(CXXFLAGS) -o $(OUT) $(OBJ) $(LIB) $(OBJ): | $(OBJDIR) diff --git a/client/scene_list.hpp b/client/scene_list.hpp index f873f39..7327c8a 100644 --- a/client/scene_list.hpp +++ b/client/scene_list.hpp @@ -3,13 +3,19 @@ enum class SceneList { //these are reserved - QUIT, + QUIT, //doubles as "up one scene" in nested scenes CONTINUE, FIRST, //custom indexes TESTSYSTEMS, + SPLASH, + MAINMENU, INGAME, + + //subscenes + LOBBY, + COMBAT, }; #endif diff --git a/client/scene_manager.cpp b/client/scene_manager.cpp index a9f2522..d2651da 100644 --- a/client/scene_manager.cpp +++ b/client/scene_manager.cpp @@ -7,9 +7,19 @@ //------------------------- //Add the custom scene headers here +#ifdef DEBUG #include "test_systems.hpp" +#endif + +#include "splash.hpp" +#include "main_menu.hpp" #include "in_game.hpp" +#ifdef DEBUG +#include "lobby.hpp" +#include "combat.hpp" +#endif + //------------------------- //Public access members //------------------------- @@ -61,13 +71,31 @@ void SceneManager::LoadScene(SceneList sceneIndex) { switch(sceneIndex) { //add scene creation calls here - case SceneList::FIRST: - case SceneList::INGAME: - activeScene = new InGame(); - break; +#ifdef DEBUG case SceneList::TESTSYSTEMS: activeScene = new TestSystems(); break; +#endif + + case SceneList::FIRST: + case SceneList::SPLASH: + activeScene = new Splash(); + break; + case SceneList::MAINMENU: + activeScene = new MainMenu(); + break; + case SceneList::INGAME: + activeScene = new InGame(); + break; + +#ifdef DEBUG + case SceneList::LOBBY: + activeScene = new Lobby(); + break; + case SceneList::COMBAT: + activeScene = new Combat(); + break; +#endif default: throw(std::logic_error("Failed to recognize the scene index")); diff --git a/client/splash.cpp b/client/splash.cpp new file mode 100644 index 0000000..ddd3917 --- /dev/null +++ b/client/splash.cpp @@ -0,0 +1,69 @@ +#include "splash.hpp" + +#include + +using namespace std; + +//------------------------- +//Public access members +//------------------------- + +Splash::Splash() { +#ifdef DEBUG + cout << "entering Splash" << endl; +#endif +} + +Splash::~Splash() { +#ifdef DEBUG + cout << "leaving Splash" << endl; +#endif +} + +//------------------------- +//Frame loop +//------------------------- + +void Splash::FrameStart() { + // +} + +void Splash::FrameEnd() { + // +} + +void Splash::Update() { + // +} + +void Splash::Render(SDL_Surface* const screen) { + // +} + +//------------------------- +//Event handlers +//------------------------- + +void Splash::MouseMotion(SDL_MouseMotionEvent const& motion) { + // +} + +void Splash::MouseButtonDown(SDL_MouseButtonEvent const& button) { + // +} + +void Splash::MouseButtonUp(SDL_MouseButtonEvent const& button) { + // +} + +void Splash::KeyDown(SDL_KeyboardEvent const& key) { + switch(key.keysym.sym) { + case SDLK_ESCAPE: + QuitEvent(); + break; + } +} + +void Splash::KeyUp(SDL_KeyboardEvent const& key) { + // +} diff --git a/client/splash.hpp b/client/splash.hpp new file mode 100644 index 0000000..9522c11 --- /dev/null +++ b/client/splash.hpp @@ -0,0 +1,27 @@ +#ifndef SPLASH_HPP_ +#define SPLASH_HPP_ + +#include "base_scene.hpp" + +class Splash : public BaseScene { +public: + /* Public access members */ + Splash(); + virtual ~Splash(); + +protected: + /* Frame loop */ + virtual void FrameStart(); + virtual void FrameEnd(); + virtual void Update(); + virtual void Render(SDL_Surface* const); + + /* Event handlers */ + virtual void MouseMotion(SDL_MouseMotionEvent const&); + virtual void MouseButtonDown(SDL_MouseButtonEvent const&); + virtual void MouseButtonUp(SDL_MouseButtonEvent const&); + virtual void KeyDown(SDL_KeyboardEvent const&); + virtual void KeyUp(SDL_KeyboardEvent const&); +}; + +#endif diff --git a/client/test_systems.cpp b/client/test_systems.cpp index 09aac09..d276055 100644 --- a/client/test_systems.cpp +++ b/client/test_systems.cpp @@ -1,15 +1,23 @@ #include "test_systems.hpp" +#include + +using namespace std; + //------------------------- //Public access members //------------------------- TestSystems::TestSystems() { - // +#ifdef DEBUG + cout << "entering TestSystems" << endl; +#endif } TestSystems::~TestSystems() { - // +#ifdef DEBUG + cout << "leaving TestSystems" << endl; +#endif } //------------------------- diff --git a/client/test_systems.hpp b/client/test_systems.hpp index 6f058ef..9193478 100644 --- a/client/test_systems.hpp +++ b/client/test_systems.hpp @@ -17,11 +17,11 @@ protected: virtual void Render(SDL_Surface* const); /* Event handlers */ - virtual void MouseMotion (SDL_MouseMotionEvent const&); - virtual void MouseButtonDown (SDL_MouseButtonEvent const&); - virtual void MouseButtonUp (SDL_MouseButtonEvent const&); - virtual void KeyDown (SDL_KeyboardEvent const&); - virtual void KeyUp (SDL_KeyboardEvent const&); + virtual void MouseMotion(SDL_MouseMotionEvent const&); + virtual void MouseButtonDown(SDL_MouseButtonEvent const&); + virtual void MouseButtonUp(SDL_MouseButtonEvent const&); + virtual void KeyDown(SDL_KeyboardEvent const&); + virtual void KeyUp(SDL_KeyboardEvent const&); }; #endif diff --git a/docs/client.txt b/docs/client.txt index e69de29..2c05482 100644 --- a/docs/client.txt +++ b/docs/client.txt @@ -0,0 +1,9 @@ +Architecture + +SceneManager: +- Splash +- MainMenu + - Lobby +- InGame + - Combat +- TestSystems (debug scene) \ No newline at end of file diff --git a/rsc/graphics/logos/krstudios.bmp b/rsc/graphics/logos/krstudios.bmp new file mode 100644 index 0000000..ca07226 Binary files /dev/null and b/rsc/graphics/logos/krstudios.bmp differ diff --git a/screenshots/hello net.png b/screenshots/hello net.png new file mode 100644 index 0000000..f69a5f5 Binary files /dev/null and b/screenshots/hello net.png differ