diff --git a/client/base_scene.cpp b/client/base_scene.cpp new file mode 100644 index 0000000..19753a0 --- /dev/null +++ b/client/base_scene.cpp @@ -0,0 +1,139 @@ +/* Copyright: (c) Kayne Ruse 2013 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source + * distribution. +*/ +#include "base_scene.hpp" + +#include + +//------------------------- +//Static declarations +//------------------------- + +SDL_Surface* BaseScene::screen = nullptr; + +//------------------------- +//Public access members +//------------------------- + +BaseScene::BaseScene() { + // +} + +BaseScene::~BaseScene() { + // +} + +//------------------------- +//Program control +//------------------------- + +SDL_Surface* BaseScene::SetScreen(int w, int h, int bpp, Uint32 flags) { + if (!bpp) { + bpp = SDL_GetVideoInfo()->vfmt->BitsPerPixel; + } + + screen = SDL_SetVideoMode(w, h, bpp, flags); + + if (!screen) { + throw(std::runtime_error("Failed to create the screen surface")); + } + + return screen; +} + +SDL_Surface* BaseScene::GetScreen() { + return screen; +} + +SceneList BaseScene::SetNextScene(SceneList sceneIndex) { + return nextScene = sceneIndex; +} + +SceneList BaseScene::GetNextScene() const { + return nextScene; +} + +//------------------------- +//Frame loop +//------------------------- + +void BaseScene::RunFrame(double delta) { + FrameStart(); + HandleEvents(); + Update(delta); + FrameEnd(); +} + +void BaseScene::RenderFrame() { + SDL_FillRect(screen, 0, 0); + Render(screen); + SDL_Flip(screen); +} + +//------------------------- +//Event handlers +//------------------------- + +void BaseScene::HandleEvents() { + SDL_Event event; + + while(SDL_PollEvent(&event)) { + switch(event.type) { + case SDL_QUIT: + QuitEvent(); + break; + + case SDL_VIDEORESIZE: + SetScreen(event.resize.w, event.resize.h, 0, screen->flags); + break; + + case SDL_MOUSEMOTION: + MouseMotion(event.motion); + break; + + case SDL_MOUSEBUTTONDOWN: + MouseButtonDown(event.button); + break; + + case SDL_MOUSEBUTTONUP: + MouseButtonUp(event.button); + break; + + case SDL_KEYDOWN: + KeyDown(event.key); + break; + + case SDL_KEYUP: + KeyUp(event.key); + break; + +#ifdef USE_EVENT_JOYSTICK + //TODO: joystick/gamepad support +#endif + +#ifdef USE_EVENT_UNKNOWN + default: + UnknownEvent(event); + break; +#endif + }//switch + }//while +} diff --git a/client/base_scene.hpp b/client/base_scene.hpp new file mode 100644 index 0000000..44dfab8 --- /dev/null +++ b/client/base_scene.hpp @@ -0,0 +1,74 @@ +/* Copyright: (c) Kayne Ruse 2013 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source + * distribution. +*/ +#ifndef BASESCENE_HPP_ +#define BASESCENE_HPP_ + +#include "scene_list.hpp" + +#include "SDL/SDL.h" + +class BaseScene { +public: + //Public access members + BaseScene(); + virtual ~BaseScene(); + + //Program control + static SDL_Surface* SetScreen(int w, int h, int bpp = 0, Uint32 flags = SDL_HWSURFACE|SDL_DOUBLEBUF); + static SDL_Surface* GetScreen(); + + SceneList SetNextScene(SceneList sceneIndex); + SceneList GetNextScene() const; + + //Frame loop + virtual void RunFrame(double delta); + virtual void RenderFrame(); + +protected: + virtual void FrameStart() {} + virtual void HandleEvents(); + virtual void Update(double delta) {} + virtual void FrameEnd() {} + virtual void Render(SDL_Surface* const screen) {} + + //Event handlers + virtual void QuitEvent() { SetNextScene(SceneList::QUIT); } + 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&) {} + +#ifdef USE_EVENT_JOYSTICK + //TODO: joystick/gamepad support +#endif + +#ifdef USE_EVENT_UNKNOWN + virtual void UnknownEvent(SDL_Event const&) {} +#endif + +private: + static SDL_Surface* screen; + SceneList nextScene = SceneList::CONTINUE; +}; + +#endif diff --git a/client/client_application.cpp b/client/client_application.cpp new file mode 100644 index 0000000..0b215ca --- /dev/null +++ b/client/client_application.cpp @@ -0,0 +1,123 @@ +/* Copyright: (c) Kayne Ruse 2013 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial ClientApplications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source + * distribution. +*/ +#include "client_application.hpp" + +#include +#include + +//------------------------- +//Static declarations +//------------------------- + +ClientApplication ClientApplication::instance; + +//------------------------- +//Scene headers +//------------------------- + +//Add the custom scene headers here +#include "editor_scene.hpp" + +//------------------------- +//Public access members +//------------------------- + +ClientApplication::ClientApplication() { + // +} + +ClientApplication::~ClientApplication() { + // +} + +void ClientApplication::Init() { + if (SDL_Init(SDL_INIT_VIDEO)) + throw(std::runtime_error("Failed to initialize SDL")); + + BaseScene::SetScreen(800, 600); +} + +void ClientApplication::Proc() { + LoadScene(SceneList::FIRST); + + //prepare the time system + typedef std::chrono::steady_clock Clock; + + Clock::duration delta(16 * Clock::duration::period::den / std::milli::den); + Clock::time_point simTime = Clock::now(); + Clock::time_point realTime; + + //The main loop + while(activeScene->GetNextScene() != SceneList::QUIT) { + //switch scenes when necessary + if (activeScene->GetNextScene() != SceneList::CONTINUE) { + LoadScene(activeScene->GetNextScene()); + continue; + } + + //update the current time + realTime = Clock::now(); + + //simulate game time + while (simTime < realTime) { + //call each user defined function + activeScene->RunFrame(double(delta.count()) / Clock::duration::period::den); + simTime += delta; + } + + //draw the game to the screen + activeScene->RenderFrame(); + + //give the computer a break + SDL_Delay(10); + } + + UnloadScene(); +} + +void ClientApplication::Quit() { + SDL_Quit(); +} + +//------------------------- +//Private access members +//------------------------- + +void ClientApplication::LoadScene(SceneList sceneIndex) { + UnloadScene(); + + switch(sceneIndex) { + //add scene creation calls here + case SceneList::FIRST: + case SceneList::EDITORSCENE: + activeScene = new EditorScene(); + break; + + default: + throw(std::logic_error("Failed to recognize the scene index")); + } +} + +void ClientApplication::UnloadScene() { + delete activeScene; + activeScene = nullptr; +} diff --git a/client/client_application.hpp b/client/client_application.hpp new file mode 100644 index 0000000..861ef03 --- /dev/null +++ b/client/client_application.hpp @@ -0,0 +1,49 @@ +/* Copyright: (c) Kayne Ruse 2013 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source + * distribution. +*/ +#ifndef CLIENTAPPLICATION_HPP_ +#define CLIENTAPPLICATION_HPP_ + +#include "scene_list.hpp" +#include "base_scene.hpp" + +class ClientApplication { +private: + ClientApplication(); + ~ClientApplication(); + static ClientApplication instance; + +public: + static ClientApplication* GetInstance() { return &instance; } + + void Init(); + void Proc(); + void Quit(); + +private: + //Private access members + void LoadScene(SceneList sceneIndex); + void UnloadScene(); + + BaseScene* activeScene = nullptr; +}; + +#endif diff --git a/client/editor_scene.cpp b/client/editor_scene.cpp new file mode 100644 index 0000000..53bfd65 --- /dev/null +++ b/client/editor_scene.cpp @@ -0,0 +1,82 @@ +/* Copyright: (c) Kayne Ruse 2013 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source + * distribution. +*/ +#include "editor_scene.hpp" + +//------------------------- +//Public access members +//------------------------- + +EditorScene::EditorScene() { + // +} + +EditorScene::~EditorScene() { + // +} + +//------------------------- +//Frame loop +//------------------------- + +void EditorScene::FrameStart() { + // +} + +void EditorScene::Update(double delta) { + // +} + +void EditorScene::FrameEnd() { + // +} + +void EditorScene::Render(SDL_Surface* const screen) { + // +} + +//------------------------- +//Event handlers +//------------------------- + +void EditorScene::MouseMotion(SDL_MouseMotionEvent const& motion) { + // +} + +void EditorScene::MouseButtonDown(SDL_MouseButtonEvent const& button) { + // +} + +void EditorScene::MouseButtonUp(SDL_MouseButtonEvent const& button) { + // +} + +void EditorScene::KeyDown(SDL_KeyboardEvent const& key) { + switch(key.keysym.sym) { + case SDLK_ESCAPE: + QuitEvent(); + break; + } +} + +void EditorScene::KeyUp(SDL_KeyboardEvent const& key) { + // +} diff --git a/client/editor_scene.hpp b/client/editor_scene.hpp new file mode 100644 index 0000000..38ca16c --- /dev/null +++ b/client/editor_scene.hpp @@ -0,0 +1,48 @@ +/* Copyright: (c) Kayne Ruse 2013 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source + * distribution. +*/ +#ifndef EDITORSCENE_HPP_ +#define EDITORSCENE_HPP_ + +#include "base_scene.hpp" + +class EditorScene : public BaseScene { +public: + //Public access members + EditorScene(); + ~EditorScene(); + +protected: + //Frame loop + void FrameStart(); + void Update(double delta); + void FrameEnd(); + void Render(SDL_Surface* const); + + //Event handlers + void MouseMotion(SDL_MouseMotionEvent const&); + void MouseButtonDown(SDL_MouseButtonEvent const&); + void MouseButtonUp(SDL_MouseButtonEvent const&); + void KeyDown(SDL_KeyboardEvent const&); + void KeyUp(SDL_KeyboardEvent const&); +}; + +#endif diff --git a/client/main.cpp b/client/main.cpp new file mode 100644 index 0000000..d31c0a3 --- /dev/null +++ b/client/main.cpp @@ -0,0 +1,42 @@ +/* Copyright: (c) Kayne Ruse 2013 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source + * distribution. +*/ +#include "client_application.hpp" + +#include +#include + +using namespace std; + +int main(int, char**) { + cout << "Beginning client" << endl; + try { + ClientApplication::GetInstance()->Init(); + ClientApplication::GetInstance()->Proc(); + ClientApplication::GetInstance()->Quit(); + } + catch(exception& e) { + cerr << "Fatal exception thrown: " << e.what() << endl; + return 1; + } + cout << "Clean exit" << endl; + return 0; +} diff --git a/client/makefile b/client/makefile index fc62440..5e105bb 100644 --- a/client/makefile +++ b/client/makefile @@ -11,7 +11,7 @@ OBJ=$(addprefix $(OBJDIR)/,$(SRC:.cpp=.o)) #output OUTDIR=../out -OUT=$(addprefix $(OUTDIR)/,server) +OUT=$(addprefix $(OUTDIR)/,client) #targets all: $(OBJ) $(OUT) diff --git a/client/scene_list.hpp b/client/scene_list.hpp new file mode 100644 index 0000000..b3eb4dd --- /dev/null +++ b/client/scene_list.hpp @@ -0,0 +1,35 @@ +/* Copyright: (c) Kayne Ruse 2013 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source + * distribution. +*/ +#ifndef SCENELIST_HPP_ +#define SCENELIST_HPP_ + +enum class SceneList { + //these are reserved + QUIT, + CONTINUE, + FIRST, + + //custom indexes + EDITORSCENE, +}; + +#endif diff --git a/common/makefile b/common/makefile deleted file mode 100644 index fc62440..0000000 --- a/common/makefile +++ /dev/null @@ -1,36 +0,0 @@ -#config -LIB=-lmingw32 -lSDLmain -lSDL -llua -CXXFLAGS+=-std=c++11 -DDEBUG - -#source -SRC=$(wildcard *.cpp) - -#objects -OBJDIR=obj -OBJ=$(addprefix $(OBJDIR)/,$(SRC:.cpp=.o)) - -#output -OUTDIR=../out -OUT=$(addprefix $(OUTDIR)/,server) - -#targets -all: $(OBJ) $(OUT) - $(CXX) $(CXXFLAGS) -o $(OUT) $(OBJ) $(LIB) - -$(OBJ): | $(OBJDIR) - -$(OUT): | $(OUTDIR) - -$(OBJDIR): - mkdir $(OBJDIR) - -$(OUTDIR): - mkdir $(OUTDIR) - -$(OBJDIR)/%.o: %.cpp - $(CXX) $(CXXFLAGS) -c -o $@ $< - -clean: - $(RM) *.o *.a *.exe - -rebuild: clean all diff --git a/editor/base_scene.cpp b/editor/base_scene.cpp new file mode 100644 index 0000000..19753a0 --- /dev/null +++ b/editor/base_scene.cpp @@ -0,0 +1,139 @@ +/* Copyright: (c) Kayne Ruse 2013 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source + * distribution. +*/ +#include "base_scene.hpp" + +#include + +//------------------------- +//Static declarations +//------------------------- + +SDL_Surface* BaseScene::screen = nullptr; + +//------------------------- +//Public access members +//------------------------- + +BaseScene::BaseScene() { + // +} + +BaseScene::~BaseScene() { + // +} + +//------------------------- +//Program control +//------------------------- + +SDL_Surface* BaseScene::SetScreen(int w, int h, int bpp, Uint32 flags) { + if (!bpp) { + bpp = SDL_GetVideoInfo()->vfmt->BitsPerPixel; + } + + screen = SDL_SetVideoMode(w, h, bpp, flags); + + if (!screen) { + throw(std::runtime_error("Failed to create the screen surface")); + } + + return screen; +} + +SDL_Surface* BaseScene::GetScreen() { + return screen; +} + +SceneList BaseScene::SetNextScene(SceneList sceneIndex) { + return nextScene = sceneIndex; +} + +SceneList BaseScene::GetNextScene() const { + return nextScene; +} + +//------------------------- +//Frame loop +//------------------------- + +void BaseScene::RunFrame(double delta) { + FrameStart(); + HandleEvents(); + Update(delta); + FrameEnd(); +} + +void BaseScene::RenderFrame() { + SDL_FillRect(screen, 0, 0); + Render(screen); + SDL_Flip(screen); +} + +//------------------------- +//Event handlers +//------------------------- + +void BaseScene::HandleEvents() { + SDL_Event event; + + while(SDL_PollEvent(&event)) { + switch(event.type) { + case SDL_QUIT: + QuitEvent(); + break; + + case SDL_VIDEORESIZE: + SetScreen(event.resize.w, event.resize.h, 0, screen->flags); + break; + + case SDL_MOUSEMOTION: + MouseMotion(event.motion); + break; + + case SDL_MOUSEBUTTONDOWN: + MouseButtonDown(event.button); + break; + + case SDL_MOUSEBUTTONUP: + MouseButtonUp(event.button); + break; + + case SDL_KEYDOWN: + KeyDown(event.key); + break; + + case SDL_KEYUP: + KeyUp(event.key); + break; + +#ifdef USE_EVENT_JOYSTICK + //TODO: joystick/gamepad support +#endif + +#ifdef USE_EVENT_UNKNOWN + default: + UnknownEvent(event); + break; +#endif + }//switch + }//while +} diff --git a/editor/base_scene.hpp b/editor/base_scene.hpp new file mode 100644 index 0000000..44dfab8 --- /dev/null +++ b/editor/base_scene.hpp @@ -0,0 +1,74 @@ +/* Copyright: (c) Kayne Ruse 2013 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source + * distribution. +*/ +#ifndef BASESCENE_HPP_ +#define BASESCENE_HPP_ + +#include "scene_list.hpp" + +#include "SDL/SDL.h" + +class BaseScene { +public: + //Public access members + BaseScene(); + virtual ~BaseScene(); + + //Program control + static SDL_Surface* SetScreen(int w, int h, int bpp = 0, Uint32 flags = SDL_HWSURFACE|SDL_DOUBLEBUF); + static SDL_Surface* GetScreen(); + + SceneList SetNextScene(SceneList sceneIndex); + SceneList GetNextScene() const; + + //Frame loop + virtual void RunFrame(double delta); + virtual void RenderFrame(); + +protected: + virtual void FrameStart() {} + virtual void HandleEvents(); + virtual void Update(double delta) {} + virtual void FrameEnd() {} + virtual void Render(SDL_Surface* const screen) {} + + //Event handlers + virtual void QuitEvent() { SetNextScene(SceneList::QUIT); } + 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&) {} + +#ifdef USE_EVENT_JOYSTICK + //TODO: joystick/gamepad support +#endif + +#ifdef USE_EVENT_UNKNOWN + virtual void UnknownEvent(SDL_Event const&) {} +#endif + +private: + static SDL_Surface* screen; + SceneList nextScene = SceneList::CONTINUE; +}; + +#endif diff --git a/editor/editor_application.cpp b/editor/editor_application.cpp new file mode 100644 index 0000000..7092e53 --- /dev/null +++ b/editor/editor_application.cpp @@ -0,0 +1,123 @@ +/* Copyright: (c) Kayne Ruse 2013 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial EditorApplications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source + * distribution. +*/ +#include "editor_application.hpp" + +#include +#include + +//------------------------- +//Static declarations +//------------------------- + +EditorApplication EditorApplication::instance; + +//------------------------- +//Scene headers +//------------------------- + +//Add the custom scene headers here +#include "editor_scene.hpp" + +//------------------------- +//Public access members +//------------------------- + +EditorApplication::EditorApplication() { + // +} + +EditorApplication::~EditorApplication() { + // +} + +void EditorApplication::Init() { + if (SDL_Init(SDL_INIT_VIDEO)) + throw(std::runtime_error("Failed to initialize SDL")); + + BaseScene::SetScreen(800, 600); +} + +void EditorApplication::Proc() { + LoadScene(SceneList::FIRST); + + //prepare the time system + typedef std::chrono::steady_clock Clock; + + Clock::duration delta(16 * Clock::duration::period::den / std::milli::den); + Clock::time_point simTime = Clock::now(); + Clock::time_point realTime; + + //The main loop + while(activeScene->GetNextScene() != SceneList::QUIT) { + //switch scenes when necessary + if (activeScene->GetNextScene() != SceneList::CONTINUE) { + LoadScene(activeScene->GetNextScene()); + continue; + } + + //update the current time + realTime = Clock::now(); + + //simulate game time + while (simTime < realTime) { + //call each user defined function + activeScene->RunFrame(double(delta.count()) / Clock::duration::period::den); + simTime += delta; + } + + //draw the game to the screen + activeScene->RenderFrame(); + + //give the computer a break + SDL_Delay(10); + } + + UnloadScene(); +} + +void EditorApplication::Quit() { + SDL_Quit(); +} + +//------------------------- +//Private access members +//------------------------- + +void EditorApplication::LoadScene(SceneList sceneIndex) { + UnloadScene(); + + switch(sceneIndex) { + //add scene creation calls here + case SceneList::FIRST: + case SceneList::EDITORSCENE: + activeScene = new EditorScene(); + break; + + default: + throw(std::logic_error("Failed to recognize the scene index")); + } +} + +void EditorApplication::UnloadScene() { + delete activeScene; + activeScene = nullptr; +} diff --git a/editor/editor_application.hpp b/editor/editor_application.hpp new file mode 100644 index 0000000..e487e32 --- /dev/null +++ b/editor/editor_application.hpp @@ -0,0 +1,49 @@ +/* Copyright: (c) Kayne Ruse 2013 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source + * distribution. +*/ +#ifndef EDITORAPPLICATION_HPP_ +#define EDITORAPPLICATION_HPP_ + +#include "scene_list.hpp" +#include "base_scene.hpp" + +class EditorApplication { +private: + EditorApplication(); + ~EditorApplication(); + static EditorApplication instance; + +public: + static EditorApplication* GetInstance() { return &instance; } + + void Init(); + void Proc(); + void Quit(); + +private: + //Private access members + void LoadScene(SceneList sceneIndex); + void UnloadScene(); + + BaseScene* activeScene = nullptr; +}; + +#endif diff --git a/editor/editor_scene.cpp b/editor/editor_scene.cpp new file mode 100644 index 0000000..53bfd65 --- /dev/null +++ b/editor/editor_scene.cpp @@ -0,0 +1,82 @@ +/* Copyright: (c) Kayne Ruse 2013 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source + * distribution. +*/ +#include "editor_scene.hpp" + +//------------------------- +//Public access members +//------------------------- + +EditorScene::EditorScene() { + // +} + +EditorScene::~EditorScene() { + // +} + +//------------------------- +//Frame loop +//------------------------- + +void EditorScene::FrameStart() { + // +} + +void EditorScene::Update(double delta) { + // +} + +void EditorScene::FrameEnd() { + // +} + +void EditorScene::Render(SDL_Surface* const screen) { + // +} + +//------------------------- +//Event handlers +//------------------------- + +void EditorScene::MouseMotion(SDL_MouseMotionEvent const& motion) { + // +} + +void EditorScene::MouseButtonDown(SDL_MouseButtonEvent const& button) { + // +} + +void EditorScene::MouseButtonUp(SDL_MouseButtonEvent const& button) { + // +} + +void EditorScene::KeyDown(SDL_KeyboardEvent const& key) { + switch(key.keysym.sym) { + case SDLK_ESCAPE: + QuitEvent(); + break; + } +} + +void EditorScene::KeyUp(SDL_KeyboardEvent const& key) { + // +} diff --git a/editor/editor_scene.hpp b/editor/editor_scene.hpp new file mode 100644 index 0000000..38ca16c --- /dev/null +++ b/editor/editor_scene.hpp @@ -0,0 +1,48 @@ +/* Copyright: (c) Kayne Ruse 2013 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source + * distribution. +*/ +#ifndef EDITORSCENE_HPP_ +#define EDITORSCENE_HPP_ + +#include "base_scene.hpp" + +class EditorScene : public BaseScene { +public: + //Public access members + EditorScene(); + ~EditorScene(); + +protected: + //Frame loop + void FrameStart(); + void Update(double delta); + void FrameEnd(); + void Render(SDL_Surface* const); + + //Event handlers + void MouseMotion(SDL_MouseMotionEvent const&); + void MouseButtonDown(SDL_MouseButtonEvent const&); + void MouseButtonUp(SDL_MouseButtonEvent const&); + void KeyDown(SDL_KeyboardEvent const&); + void KeyUp(SDL_KeyboardEvent const&); +}; + +#endif diff --git a/editor/main.cpp b/editor/main.cpp new file mode 100644 index 0000000..c244c1e --- /dev/null +++ b/editor/main.cpp @@ -0,0 +1,42 @@ +/* Copyright: (c) Kayne Ruse 2013 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source + * distribution. +*/ +#include "editor_application.hpp" + +#include +#include + +using namespace std; + +int main(int, char**) { + cout << "Beginning editor" << endl; + try { + EditorApplication::GetInstance()->Init(); + EditorApplication::GetInstance()->Proc(); + EditorApplication::GetInstance()->Quit(); + } + catch(exception& e) { + cerr << "Fatal exception thrown: " << e.what() << endl; + return 1; + } + cout << "Clean exit" << endl; + return 0; +} diff --git a/editor/makefile b/editor/makefile index fc62440..fafa3ee 100644 --- a/editor/makefile +++ b/editor/makefile @@ -11,7 +11,7 @@ OBJ=$(addprefix $(OBJDIR)/,$(SRC:.cpp=.o)) #output OUTDIR=../out -OUT=$(addprefix $(OUTDIR)/,server) +OUT=$(addprefix $(OUTDIR)/,editor) #targets all: $(OBJ) $(OUT) diff --git a/editor/scene_list.hpp b/editor/scene_list.hpp new file mode 100644 index 0000000..b3eb4dd --- /dev/null +++ b/editor/scene_list.hpp @@ -0,0 +1,35 @@ +/* Copyright: (c) Kayne Ruse 2013 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source + * distribution. +*/ +#ifndef SCENELIST_HPP_ +#define SCENELIST_HPP_ + +enum class SceneList { + //these are reserved + QUIT, + CONTINUE, + FIRST, + + //custom indexes + EDITORSCENE, +}; + +#endif diff --git a/makefile b/makefile index c8ac88a..650ad70 100644 --- a/makefile +++ b/makefile @@ -1,11 +1,9 @@ -LIBDIR=lib OUTDIR=out -all: $(LIBDIR) $(OUTDIR) +all: $(OUTDIR) $(MAKE) -C server - -$(LIBDIR): - mkdir $(LIBDIR) + $(MAKE) -C client + $(MAKE) -C editor $(OUTDIR): mkdir $(OUTDIR) diff --git a/server/account_manager.cpp b/server/account_manager.cpp index 9212c4b..ec20cc0 100644 --- a/server/account_manager.cpp +++ b/server/account_manager.cpp @@ -1,3 +1,24 @@ +/* Copyright: (c) Kayne Ruse 2013 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source + * distribution. +*/ #include "account_manager.hpp" AccountManager AccountManager::instance; diff --git a/server/account_manager.hpp b/server/account_manager.hpp index a2b2969..298b8fa 100644 --- a/server/account_manager.hpp +++ b/server/account_manager.hpp @@ -1,3 +1,24 @@ +/* Copyright: (c) Kayne Ruse 2013 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source + * distribution. +*/ #ifndef ACCOUNTMANAGER_HPP_ #define ACCOUNTMANAGER_HPP_ diff --git a/server/base_room.hpp b/server/base_room.hpp index 1577381..58818b3 100644 --- a/server/base_room.hpp +++ b/server/base_room.hpp @@ -1,3 +1,24 @@ +/* Copyright: (c) Kayne Ruse 2013 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source + * distribution. +*/ #ifndef BASEROOM_HPP_ #define BASEROOM_HPP_ diff --git a/server/client_manager.cpp b/server/client_manager.cpp index 199f870..991e40a 100644 --- a/server/client_manager.cpp +++ b/server/client_manager.cpp @@ -1,3 +1,24 @@ +/* Copyright: (c) Kayne Ruse 2013 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source + * distribution. +*/ #include "client_manager.hpp" ClientManager ClientManager::instance; diff --git a/server/client_manager.hpp b/server/client_manager.hpp index 0749918..a84b8bb 100644 --- a/server/client_manager.hpp +++ b/server/client_manager.hpp @@ -1,3 +1,24 @@ +/* Copyright: (c) Kayne Ruse 2013 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source + * distribution. +*/ #ifndef CLIENTMANAGER_HPP_ #define CLIENTMANAGER_HPP_ diff --git a/server/combat_room.cpp b/server/combat_room.cpp index e1bbfc5..c4901e8 100644 --- a/server/combat_room.cpp +++ b/server/combat_room.cpp @@ -1,3 +1,24 @@ +/* Copyright: (c) Kayne Ruse 2013 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source + * distribution. +*/ #include "combat_room.hpp" CombatRoom::CombatRoom() { diff --git a/server/combat_room.hpp b/server/combat_room.hpp index 563e7c2..03858df 100644 --- a/server/combat_room.hpp +++ b/server/combat_room.hpp @@ -1,3 +1,24 @@ +/* Copyright: (c) Kayne Ruse 2013 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source + * distribution. +*/ #ifndef COMBATROOM_HPP_ #define COMBATROOM_HPP_ diff --git a/server/mail_box.cpp b/server/mail_box.cpp index 24e89b2..70d1386 100644 --- a/server/mail_box.cpp +++ b/server/mail_box.cpp @@ -1,3 +1,24 @@ +/* Copyright: (c) Kayne Ruse 2013 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source + * distribution. +*/ #include "mail_box.hpp" #include diff --git a/server/mail_box.hpp b/server/mail_box.hpp index 5cec33e..491101c 100644 --- a/server/mail_box.hpp +++ b/server/mail_box.hpp @@ -1,3 +1,24 @@ +/* Copyright: (c) Kayne Ruse 2013 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source + * distribution. +*/ #ifndef MAILBOX_HPP_ #define MAILBOX_HPP_ diff --git a/server/main.cpp b/server/main.cpp index ed67fd3..607d959 100644 --- a/server/main.cpp +++ b/server/main.cpp @@ -1,3 +1,24 @@ +/* Copyright: (c) Kayne Ruse 2013 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source + * distribution. +*/ #include "server_application.hpp" #include "SDL/SDL.h" @@ -8,9 +29,7 @@ using namespace std; int main(int, char**) { -#ifdef DEBUG cout << "Beginning server" << endl; -#endif try { ServerApplication::GetInstance()->Init(); ServerApplication::GetInstance()->Loop(); @@ -20,8 +39,6 @@ int main(int, char**) { cerr << "Fatal error: " << e.what() << endl; return 1; } -#ifdef DEBUG cout << "Clean exit" << endl; -#endif return 0; } diff --git a/server/player_manager.cpp b/server/player_manager.cpp index b0911e6..9ac6e2e 100644 --- a/server/player_manager.cpp +++ b/server/player_manager.cpp @@ -1,3 +1,24 @@ +/* Copyright: (c) Kayne Ruse 2013 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source + * distribution. +*/ #include "player_manager.hpp" PlayerManager PlayerManager::instance; diff --git a/server/player_manager.hpp b/server/player_manager.hpp index 46dcf3b..ff28a18 100644 --- a/server/player_manager.hpp +++ b/server/player_manager.hpp @@ -1,3 +1,24 @@ +/* Copyright: (c) Kayne Ruse 2013 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source + * distribution. +*/ #ifndef PLAYERMANAGER_HPP_ #define PLAYERMANAGER_HPP_ diff --git a/server/room_manager.cpp b/server/room_manager.cpp index 79f139e..613345a 100644 --- a/server/room_manager.cpp +++ b/server/room_manager.cpp @@ -1,3 +1,24 @@ +/* Copyright: (c) Kayne Ruse 2013 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source + * distribution. +*/ #include "room_manager.hpp" #include diff --git a/server/room_manager.hpp b/server/room_manager.hpp index 5178a7e..9edd9d9 100644 --- a/server/room_manager.hpp +++ b/server/room_manager.hpp @@ -1,3 +1,24 @@ +/* Copyright: (c) Kayne Ruse 2013 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source + * distribution. +*/ #ifndef ROOMMANAGER_HPP_ #define ROOMMANAGER_HPP_ diff --git a/server/server_application.cpp b/server/server_application.cpp index 5b0c40b..c6b2523 100644 --- a/server/server_application.cpp +++ b/server/server_application.cpp @@ -1,3 +1,24 @@ +/* Copyright: (c) Kayne Ruse 2013 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source + * distribution. +*/ #include "server_application.hpp" ServerApplication ServerApplication::instance; diff --git a/server/server_application.hpp b/server/server_application.hpp index e8a2b68..9f1e8c2 100644 --- a/server/server_application.hpp +++ b/server/server_application.hpp @@ -1,3 +1,24 @@ +/* Copyright: (c) Kayne Ruse 2013 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source + * distribution. +*/ #ifndef SERVERAPPLICATION_HPP_ #define SERVERAPPLICATION_HPP_ diff --git a/server/world_room.cpp b/server/world_room.cpp index c485b52..6ad7119 100644 --- a/server/world_room.cpp +++ b/server/world_room.cpp @@ -1,3 +1,24 @@ +/* Copyright: (c) Kayne Ruse 2013 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source + * distribution. +*/ #include "world_room.hpp" WorldRoom::WorldRoom() { diff --git a/server/world_room.hpp b/server/world_room.hpp index db496ca..70197d2 100644 --- a/server/world_room.hpp +++ b/server/world_room.hpp @@ -1,3 +1,24 @@ +/* Copyright: (c) Kayne Ruse 2013 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source + * distribution. +*/ #ifndef WORLDROOM_HPP_ #define WORLDROOM_HPP_