diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..dfe0770 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Auto detect text files and perform LF normalization +* text=auto diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..48c2b37 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +Debug +Release +x64 \ No newline at end of file diff --git a/AbstractedAccess.cpp b/AbstractedAccess.cpp new file mode 100644 index 0000000..1dc1e2d --- /dev/null +++ b/AbstractedAccess.cpp @@ -0,0 +1,3 @@ +#include "AbstractedAccess.h" + +std::vector Updater::sources = std::vector(); \ No newline at end of file diff --git a/AbstractedAccess.h b/AbstractedAccess.h new file mode 100644 index 0000000..2bcf57b --- /dev/null +++ b/AbstractedAccess.h @@ -0,0 +1,284 @@ +#pragma once + +#include + +struct ValueContainer { + size_t ownerships; + ValueContainer() { + ownerships = 1; + } + void addPtr() { + ownerships++; + } + void removePtr() { + ownerships--; + } +}; + +template +class EasyPointer { +public: + ValueContainer* internalPtr = NULL; + T* ptr = NULL; + + EasyPointer() {} + EasyPointer(T* val) : internalPtr(new ValueContainer()), ptr(val) { } + EasyPointer(const EasyPointer& val) : internalPtr(val.internalPtr), ptr(val.ptr) { + internalPtr->addPtr(); + } + template + EasyPointer(const EasyPointer& val) : internalPtr(val.internalPtr), ptr((T*)val.ptr) { + internalPtr->addPtr(); + } + ~EasyPointer() { + RemovePointer(); + } + + T& operator* () + { + return *ptr; + } + T* operator-> () + { + return ptr; + } + operator T* () { + return ptr; + } + + void operator= (const EasyPointer& p) { + RemovePointer(); + + internalPtr = p.internalPtr; + ptr = p.ptr; + + if (internalPtr != NULL) internalPtr->addPtr(); + else ptr = NULL; + } + template + void operator= (const EasyPointer& p) { + RemovePointer(); + + internalPtr = p.internalPtr; + ptr = (T*)p.ptr; + + if (internalPtr != NULL) internalPtr->addPtr(); + else ptr = NULL; + } + + bool isSet() { + return internalPtr != NULL; + } + void RemovePointer() { + if (internalPtr == NULL) return; + + internalPtr->removePtr(); + + if (internalPtr->ownerships == 0) { + delete ptr; + delete internalPtr; + } + internalPtr = NULL; + ptr = NULL; + } +}; + +template +class GetVal { +public: + virtual T Get() = 0; +}; + +template +class SetVal { +public: + virtual void Set(T input) = 0; +}; + +class Updater { +private: + static std::vector sources; +public: + Updater() { + sources.push_back(this); + } + ~Updater() { + auto it = std::find(sources.begin(), sources.end(), this); + sources.erase(it, it + 1); + } + virtual void reset() {} + virtual void frameUpdate() {} + + static void updateAllSources() { + for (auto s : sources) s->frameUpdate(); + } +}; + +template +class Source : public GetVal, public Updater {}; + +template +class Val : public Source, public SetVal { +private: + T val; +public: + Val(T v) { + val = v; + } + T Get() { + return val; + } + void Set(T input) { + val = input; + }; + void reset() {} +}; + +template +class pVal : public Source, public SetVal { +private: + T* val; +public: + pVal(T* v) { + val = v; + } + T Get() { + return *val; + } + T& Get() { + return *val; + } + void Set(T input) { + *val = input; + } + void reset() {} +}; + +typedef Val fVal; +typedef EasyPointer> epSource; + +/*#pragma once + +template +class GetVal { +public: + virtual T Get() { + return T(); + }; +}; + +template +class SetVal { +public: + virtual void Set(T input) = 0; +}; + +template +class Source : public GetVal { +public: + virtual void reset() = 0; +}; + +template +class Val : public Source, public SetVal { +private: + T val; +public: + Val(T v) { + val = v; + } + T Get() { + return val; + } + void Set(T input) { + val = input; + }; + void reset() {} +}; + +template +class pVal : public Source, public SetVal { +private: + T* val; +public: + pVal(T* v) { + val = v; + } + T Get() { + return *val; + } + T& Get() { + return *val; + } + void Set(T input) { + *val = input; + } + void reset() {} +}; + +template +struct ValueContainer { + T* val; + size_t ownerships; + ValueContainer(T* val) { + this->val = val; + ownerships = 1; + } + ~ValueContainer() { + delete val; + } + void addPtr() { + ownerships++; + } + void removePtr() { + ownerships--; + if (ownerships == 0) delete this; + } +}; + +template +class EasyPointer { +public: + ValueContainer* internalPtr = NULL; + EasyPointer() {} + EasyPointer(T* val) { + internalPtr = new ValueContainer(val); + internalPtr->addPtr(); + } + template + EasyPointer(EasyPointer& val) { + internalPtr = (ValueContainer*)val.internalPtr; + internalPtr->addPtr(); + } + ~EasyPointer() { + if (internalPtr == NULL) return; + + internalPtr->removePtr(); + internalPtr = NULL; + } + void NewPointer(T* val) { + if (internalPtr != NULL) internalPtr->removePtr(); + internalPtr = new ValueContainer(val); + } + void NewPointer() { + NewPointer(new T); + } + T& operator* () + { + return *internalPtr->val; + } + T* operator-> () + { + return internalPtr->val; + } + void operator= (const EasyPointer& D) { + if (internalPtr != NULL) internalPtr->removePtr(); + + internalPtr = D.internalPtr; + + if (internalPtr != NULL) internalPtr->addPtr(); + } + bool isSet() { + return !(internalPtr == NULL); + } +};*/ \ No newline at end of file diff --git a/Generic.h b/Generic.h new file mode 100644 index 0000000..56e2084 --- /dev/null +++ b/Generic.h @@ -0,0 +1,37 @@ +#pragma once + +#include +#include "AbstractedAccess.h" + +static constexpr bool InBounds(SDL_Rect bounds, int x, int y) { + return + x >= bounds.x && + x < bounds.x + bounds.w && + y >= bounds.y && + y < bounds.y + bounds.h; +} +static constexpr bool InBounds(SDL_Rect bounds, SDL_Point coord) { return InBounds(bounds, coord.x, coord.y); } + +SDL_Rect ToRect(SDL_FRect rect) { + return { (int)rect.x, (int)rect.y, (int)rect.w, (int)rect.h }; +} + +template +using ep = EasyPointer; + +struct frame { + SDL_FPoint parentRelativeOrigin; // Origin point within parent + SDL_FPoint selfRelativeOrigin; // Origin point within own rect + + SDL_FPoint relativeScale; // Scale compared to parent + + SDL_FPoint absoluteScale; // A constant scale, added to the relative scale + SDL_FPoint absoluteOffset; // Rect offset from origin + + frame* parent = NULL; +}; + +struct sprite { + SDL_Rect src; + SDL_Texture** texture; +}; \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..be46ae3 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 DDunda + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/SDL2/.gitignore b/SDL2/.gitignore new file mode 100644 index 0000000..ade4684 --- /dev/null +++ b/SDL2/.gitignore @@ -0,0 +1,4 @@ +* +!.gitignore +!include +!lib \ No newline at end of file diff --git a/SDL2/include/.gitignore b/SDL2/include/.gitignore new file mode 100644 index 0000000..c96a04f --- /dev/null +++ b/SDL2/include/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore \ No newline at end of file diff --git a/SDL2/lib/.gitignore b/SDL2/lib/.gitignore new file mode 100644 index 0000000..80f5ae4 --- /dev/null +++ b/SDL2/lib/.gitignore @@ -0,0 +1,4 @@ +* +!.gitignore +!x64 +!x86 \ No newline at end of file diff --git a/SDL2/lib/x64/.gitignore b/SDL2/lib/x64/.gitignore new file mode 100644 index 0000000..c96a04f --- /dev/null +++ b/SDL2/lib/x64/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore \ No newline at end of file diff --git a/SDL2/lib/x86/.gitignore b/SDL2/lib/x86/.gitignore new file mode 100644 index 0000000..c96a04f --- /dev/null +++ b/SDL2/lib/x86/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore \ No newline at end of file diff --git a/SDL2_image/.gitignore b/SDL2_image/.gitignore new file mode 100644 index 0000000..ade4684 --- /dev/null +++ b/SDL2_image/.gitignore @@ -0,0 +1,4 @@ +* +!.gitignore +!include +!lib \ No newline at end of file diff --git a/SDL2_image/include/.gitignore b/SDL2_image/include/.gitignore new file mode 100644 index 0000000..c96a04f --- /dev/null +++ b/SDL2_image/include/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore \ No newline at end of file diff --git a/SDL2_image/lib/.gitignore b/SDL2_image/lib/.gitignore new file mode 100644 index 0000000..80f5ae4 --- /dev/null +++ b/SDL2_image/lib/.gitignore @@ -0,0 +1,4 @@ +* +!.gitignore +!x64 +!x86 \ No newline at end of file diff --git a/SDL2_image/lib/x64/.gitignore b/SDL2_image/lib/x64/.gitignore new file mode 100644 index 0000000..c96a04f --- /dev/null +++ b/SDL2_image/lib/x64/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore \ No newline at end of file diff --git a/SDL2_image/lib/x86/.gitignore b/SDL2_image/lib/x86/.gitignore new file mode 100644 index 0000000..c96a04f --- /dev/null +++ b/SDL2_image/lib/x86/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore \ No newline at end of file diff --git a/SDL2_mixer/.gitignore b/SDL2_mixer/.gitignore new file mode 100644 index 0000000..ade4684 --- /dev/null +++ b/SDL2_mixer/.gitignore @@ -0,0 +1,4 @@ +* +!.gitignore +!include +!lib \ No newline at end of file diff --git a/SDL2_mixer/include/.gitignore b/SDL2_mixer/include/.gitignore new file mode 100644 index 0000000..c96a04f --- /dev/null +++ b/SDL2_mixer/include/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore \ No newline at end of file diff --git a/SDL2_mixer/lib/.gitignore b/SDL2_mixer/lib/.gitignore new file mode 100644 index 0000000..80f5ae4 --- /dev/null +++ b/SDL2_mixer/lib/.gitignore @@ -0,0 +1,4 @@ +* +!.gitignore +!x64 +!x86 \ No newline at end of file diff --git a/SDL2_mixer/lib/x64/.gitignore b/SDL2_mixer/lib/x64/.gitignore new file mode 100644 index 0000000..c96a04f --- /dev/null +++ b/SDL2_mixer/lib/x64/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore \ No newline at end of file diff --git a/SDL2_mixer/lib/x86/.gitignore b/SDL2_mixer/lib/x86/.gitignore new file mode 100644 index 0000000..c96a04f --- /dev/null +++ b/SDL2_mixer/lib/x86/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore \ No newline at end of file diff --git a/SDLG.h b/SDLG.h new file mode 100644 index 0000000..039d7fc --- /dev/null +++ b/SDLG.h @@ -0,0 +1,388 @@ +#pragma once + +#include +#include +#include "Generic.h" + +#ifdef ERROR_LOGGING +#include +#include +#endif + +#ifndef INPUT_HANDLED +#include +#include +#endif + +// SDL-GAME +namespace SDLG +{ + + typedef Uint32 millitime; + + // Programmer has own game loop +#ifndef LOOP_HANDLED + +// Called every frame + void OnFrame(); + +#endif //!LOOP_HANDLED + + // Called upon initialisation + void OnStart(); + // Called upon exit + void OnQuit(); + + static bool gameRunning = true; + + static int windowWidth = SCALING_FACTOR * 20; + static int windowHeight = SCALING_FACTOR * 19; + + static int windowX = 0; + static int windowY = 0; + + static SDL_Window* gameWindow = nullptr; + static SDL_Renderer* gameRenderer = nullptr; + static Uint32 gameWindowID = 0; + const static char* windowTitle = ""; + + static Uint32 windowFlags = 0 + //| SDL_WINDOW_FULLSCREEN /**< fullscreen window */ + //| SDL_WINDOW_OPENGL /**< window usable with OpenGL context */ + //| SDL_WINDOW_SHOWN /**< window is visible */ + //| SDL_WINDOW_HIDDEN /**< window is not visible */ + | SDL_WINDOW_BORDERLESS /**< no window decoration */ + //| SDL_WINDOW_RESIZABLE /**< window can be resized */ + //| SDL_WINDOW_MINIMIZED /**< window is minimized */ + //| SDL_WINDOW_MAXIMIZED /**< window is maximized */ + //| SDL_WINDOW_INPUT_GRABBED /**< window has grabbed input focus */ + //| SDL_WINDOW_INPUT_FOCUS /**< window has input focus */ + //| SDL_WINDOW_MOUSE_FOCUS /**< window has mouse focus */ + //| SDL_WINDOW_FULLSCREEN_DESKTOP + //| SDL_WINDOW_FOREIGN /**< window not created by SDL */ + //| SDL_WINDOW_ALLOW_HIGHDPI /**< window should be created in high-DPI mode if supported. + // On macOS NSHighResolutionCapable must be set true in the + // application's Info.plist for this to have any effect. */ + //| SDL_WINDOW_MOUSE_CAPTURE /**< window has mouse captured (unrelated to INPUT_GRABBED) */ + | SDL_WINDOW_ALWAYS_ON_TOP /**< window should always be above others */ + //| SDL_WINDOW_SKIP_TASKBAR /**< window should not be added to the taskbar */ + //| SDL_WINDOW_UTILITY /**< window should be treated as a utility window */ + //| SDL_WINDOW_TOOLTIP /**< window should be treated as a tooltip */ + //| SDL_WINDOW_POPUP_MENU /**< window should be treated as a popup menu */ + //| SDL_WINDOW_VULKAN + ; + + /* + :SDL_WINDOW_OPENGL, ::SDL_WINDOW_INPUT_GRABBED, + ::SDL_WINDOW_HIDDEN, ::SDL_WINDOW_RESIZABLE, + ::SDL_WINDOW_MAXIMIZED, ::SDL_WINDOW_MINIMIZED, + */ + + // Programmer handles time stuff +#ifndef TIME_HANDLED + static millitime currentTime = 0; + static millitime previousTime = 0; + static millitime deltaTime = 0; + + static millitime minFrameDelta = 1000 / 60; + + static void HandleTime() { + previousTime = currentTime; + currentTime = SDL_GetTicks(); + deltaTime = currentTime - previousTime; + + // FPS is capped when a min delta time is given + if (minFrameDelta > 0 && deltaTime < minFrameDelta) { + millitime delayTime = minFrameDelta - deltaTime; + + deltaTime = minFrameDelta; + currentTime = previousTime + deltaTime; + + SDL_Delay(delayTime); + } + } +#endif // !TIME_HANDLED + +#ifdef ERROR_LOGGING + + static void MakeLog(std::string message) { + std::cout << message; + SDL_Log(message.c_str()); + } + +#endif // ERROR_LOGGING + +#ifndef INPUT_HANDLED + + static int mouseXPrev; + static int mouseX; + static int mouseXDelta; + + static int mouseYPrev; + static int mouseY; + static int mouseYDelta; + + static int mouseWheelYPrev; + static int mouseWheelY; + static int mouseWheelYDelta; + + static int mouseWheelXPrev; + static int mouseWheelX; + static int mouseWheelXDelta; + + struct keystate { + Uint32 down = 0; + Uint32 up = 0; + }; + + struct buttonState { + Uint32 down = 0; + Sint32 downX = 0, downY = 0; + Uint32 up = 0; + Sint32 upX = 0, upY = 0; + }; + + struct keyboardData { + Uint32 lastUpdated = 0; + std::map last_keys_scancode; + std::map last_keys_keycode; + std::map keys_scancode; + std::map keys_keycode; + }; + + struct mouseData { + std::map last_mouse_buttons; + std::map mouse_buttons; + }; + + static keyboardData globalKeyboard; + static mouseData globalMouseData; + + typedef Uint32 eventType; + + class EventCallback { + public: + bool active = true; + virtual void Callback(SDL_Event&) = 0; + }; + + static std::map> callbacks; + + static void TriggerEventCallbacks(SDL_Event& e) { + auto it = callbacks.find(e.type); + if (it == callbacks.end()) return; + + for (auto callback : it->second) + if (callback->active) callback->Callback(e); + } + + static bool keyPressed(SDL_Keycode key, keyboardData* pipe = &globalKeyboard) { + return pipe->keys_keycode[key].down > pipe->last_keys_keycode[key].down; + } + static bool keyReleased(SDL_Keycode key, keyboardData* pipe = &globalKeyboard) { + return pipe->keys_keycode[key].up > pipe->last_keys_keycode[key].up; + } + static bool keyDown(SDL_Keycode key, keyboardData* pipe = &globalKeyboard) { + return pipe->keys_keycode[key].down > pipe->keys_keycode[key].up; + } + static bool keyUp(SDL_Keycode key, keyboardData* pipe = &globalKeyboard) { + return pipe->keys_keycode[key].up > pipe->keys_keycode[key].down; + } + + static bool scancodePressed(SDL_Scancode key, keyboardData* pipe = &globalKeyboard) { + return pipe->keys_scancode[key].down > pipe->last_keys_scancode[key].down; + } + static bool scancodeReleased(SDL_Scancode key, keyboardData* pipe = &globalKeyboard) { + return pipe->keys_scancode[key].up > pipe->last_keys_scancode[key].up; + } + static bool scancodeDown(SDL_Scancode key, keyboardData* pipe = &globalKeyboard) { + return pipe->keys_scancode[key].down > pipe->keys_scancode[key].up; + } + static bool scancodeUp(SDL_Scancode key, keyboardData* pipe = &globalKeyboard) { + return pipe->keys_scancode[key].up > pipe->keys_scancode[key].down; + } + + static bool buttonPressed(Uint8 button) { + return globalMouseData.mouse_buttons[button].down > globalMouseData.last_mouse_buttons[button].down; + } + static bool buttonReleased(Uint8 button) { + return globalMouseData.mouse_buttons[button].up > globalMouseData.last_mouse_buttons[button].up; + } + static bool buttonDown(Uint8 button) { + return globalMouseData.mouse_buttons[button].down > globalMouseData.mouse_buttons[button].up; + } + static bool buttonUp(Uint8 button) { + return globalMouseData.mouse_buttons[button].up > globalMouseData.mouse_buttons[button].down; + } + + static void HandleInput() { + mouseXPrev = mouseX; + mouseYPrev = mouseY; + + mouseWheelXPrev = mouseWheelX; + mouseWheelYPrev = mouseWheelY; + + for (const auto& pair : globalMouseData.mouse_buttons) + globalMouseData.last_mouse_buttons[pair.first] = globalMouseData.mouse_buttons[pair.first]; + + for (const auto& pair : globalKeyboard.keys_scancode) + globalKeyboard.last_keys_scancode[pair.first] = globalKeyboard.keys_scancode[pair.first]; + + for (const auto& pair : globalKeyboard.keys_keycode) + globalKeyboard.last_keys_keycode[pair.first] = globalKeyboard.keys_keycode[pair.first]; + + SDL_Event e; + while (SDL_PollEvent(&e)) { + switch (e.type) { + case SDL_QUIT: + gameRunning = false; + return; // Exit immediately + + case SDL_KEYDOWN: + if (e.key.windowID != gameWindowID) break; + globalKeyboard.keys_scancode[e.key.keysym.scancode].down = e.key.timestamp; + globalKeyboard.keys_keycode[e.key.keysym.sym].down = e.key.timestamp; + globalKeyboard.lastUpdated = e.key.timestamp; + break; + + case SDL_KEYUP: + if (e.key.windowID != gameWindowID) break; + globalKeyboard.keys_scancode[e.key.keysym.scancode].up = e.key.timestamp; + globalKeyboard.keys_keycode[e.key.keysym.sym].up = e.key.timestamp; + globalKeyboard.lastUpdated = e.key.timestamp; + break; + + case SDL_MOUSEMOTION: + if (e.motion.windowID != gameWindowID) break; + mouseX = e.motion.x; + mouseY = e.motion.y; + + printf("Actual: %i, %i\n", mouseX, mouseY); + break; + + case SDL_MOUSEBUTTONDOWN: + if (e.button.windowID != gameWindowID) break; + globalMouseData.mouse_buttons[e.button.button].down = e.button.timestamp; + globalMouseData.mouse_buttons[e.button.button].downX = e.button.x; + globalMouseData.mouse_buttons[e.button.button].downY = e.button.y; + break; + + case SDL_MOUSEBUTTONUP: + if (e.button.windowID != gameWindowID) break; + globalMouseData.mouse_buttons[e.button.button].up = e.button.timestamp; + globalMouseData.mouse_buttons[e.button.button].upX = e.button.x; + globalMouseData.mouse_buttons[e.button.button].upY = e.button.y; + break; + + case SDL_MOUSEWHEEL: + if (e.wheel.windowID != gameWindowID) break; + if (e.wheel.direction == SDL_MOUSEWHEEL_FLIPPED) { + mouseWheelX -= e.wheel.x; + mouseWheelY -= e.wheel.y; + } + else { + mouseWheelX += e.wheel.x; + mouseWheelY += e.wheel.y; + } + break; + + case SDL_WINDOWEVENT: + if (e.window.windowID != gameWindowID) break; + switch (e.window.event) + { + case SDL_WINDOWEVENT_SIZE_CHANGED: + case SDL_WINDOWEVENT_RESIZED: + windowWidth = e.window.data1; + windowHeight = e.window.data2; + break; + + case SDL_WINDOWEVENT_CLOSE: + e.type = SDL_QUIT; + SDL_PushEvent(&e); + break; + } + } + + TriggerEventCallbacks(e); + } + + SDL_GetGlobalMouseState(&mouseX, &mouseY); + + SDL_GetWindowPosition(gameWindow, &windowX, &windowY); + + mouseX -= windowX; + mouseY -= windowY; + + mouseXDelta = mouseX - mouseXPrev; + mouseYDelta = mouseY - mouseYPrev; + mouseWheelXDelta = mouseWheelX - mouseWheelXPrev; + mouseWheelYDelta = mouseWheelY - mouseWheelYPrev; + } +#endif // !INPUT_HANDLED + + + static void CleanupSDL() { + if (gameWindow != nullptr) SDL_DestroyWindow(gameWindow); + if (gameRenderer != nullptr) SDL_DestroyRenderer(gameRenderer); + gameWindow = nullptr; + gameRenderer = nullptr; + + if (SDL_WasInit(NULL)) SDL_Quit(); + } + + static int StartSDL() { + + if (SDL_Init(SDL_INIT_EVERYTHING) < 0) { +#ifdef ERROR_LOGGING + MakeLog("Unable to initialise SDL: " + std::string(SDL_GetError())); +#endif // !ERROR_LOGGING + CleanupSDL(); + return 1; + } + + if ((gameWindow = SDL_CreateShapedWindow(windowTitle, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, windowWidth, windowHeight, windowFlags)) == NULL) { + //if ((gameWindow = SDL_CreateWindow(windowTitle, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, windowWidth, windowHeight, windowFlags)) == NULL) { +#ifdef ERROR_LOGGING + MakeLog("Unable to create window: " + std::string(SDL_GetError())); +#endif // !ERROR_LOGGING + CleanupSDL(); + return 2; + } + + if ((gameRenderer = SDL_CreateRenderer(gameWindow, -1, 0)) == NULL) { +#ifdef ERROR_LOGGING + MakeLog("Unable to create renderer: " + std::string(SDL_GetError())); +#endif // !ERROR_LOGGING + CleanupSDL(); + return 3; + } + + gameWindowID = SDL_GetWindowID(gameWindow); + + OnStart(); + + currentTime = SDL_GetTicks(); + deltaTime = currentTime; + +#ifndef LOOP_HANDLED + while (gameRunning) { + + HandleInput(); + + OnFrame(); + +#ifndef TIME_HANDLED + HandleTime(); +#endif // !TIME_HANDLED + + } +#endif // !LOOP_HANDLED + + OnQuit(); + + CleanupSDL(); + + return 0; + } + +} \ No newline at end of file diff --git a/Source.cpp b/Source.cpp new file mode 100644 index 0000000..a6d4d30 --- /dev/null +++ b/Source.cpp @@ -0,0 +1,349 @@ +#include +#include + +#define SCALING_FACTOR (4) +#define ERROR_LOGGING +#include "SDLG.h" + +#include "AbstractedAccess.h" +#include "Generic.h" + +using namespace SDLG; + +int main(int argc, char* argv[]) { return StartSDL(); } + +template +struct paletteImage { + Uint8 data[w * h]; + SDL_Palette* palette = NULL; +}; + +SDL_FPoint GetPointInRect(SDL_FRect rect, float x, float y) { + return { rect.x + rect.w * x, rect.y + rect.h * y }; +} + +SDL_FRect GetFrameRect(frame* f) { + SDL_FRect parentRect; + + if (f->parent == NULL) parentRect = { 0, 0, (float)windowWidth, (float)windowHeight }; + else parentRect = GetFrameRect(f->parent); + + float width = f->relativeScale.x * parentRect.w + f->absoluteScale.x; + float height = f->relativeScale.y * parentRect.h + f->absoluteScale.y; + float x = parentRect.x + parentRect.w * f->parentRelativeOrigin.x - width * f->selfRelativeOrigin.x + f->absoluteOffset.x; + float y = parentRect.y + parentRect.h * f->parentRelativeOrigin.y - height * f->selfRelativeOrigin.y + f->absoluteOffset.y; + + return { x,y,width,height }; +} + +SDL_Colour tobyColours[3] = { {0,0,0,0}, {0,0,0,255}, {255,255,255,255} }; + +paletteImage<20, 19> Toby{ + { + 0,0,1,0,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0, //1 + 0,1,2,1,2,2,2,2,1,2,1,0,0,0,0,0,0,0,0,0, //2 + 0,1,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0, //3 + 0,1,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,1,0, //4 + 1,2,2,2,2,2,2,2,2,2,2,1,1,0,0,0,0,1,2,1, //5 + 1,2,2,2,2,2,2,2,2,2,2,2,2,1,1,0,0,1,2,1, //6 + 1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,2,1, //7 + 1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1, //8 + 1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1, //9 + 1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1, //10 + 1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1, //11 + 1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1, //12 + 1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1, //13 + 1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,0, //14 + 0,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,0, //15 + 0,1,2,2,1,1,2,2,1,1,1,1,2,2,1,1,2,2,1,0, //16 + 0,1,2,2,1,1,2,2,1,0,0,1,2,2,1,1,2,2,1,0, //17 + 0,1,2,1,0,1,2,1,0,0,0,1,2,1,0,1,2,1,0,0, //18 + 0,0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,0,0, //19 + } +}; + +paletteImage<6, 5> TobyFace{ + { + 0,1,0,0,1,0, + 0,0,0,0,0,0, + 0,0,1,1,0,0, + 1,0,1,0,0,1, + 0,1,1,1,1,0, + } +}; + +paletteImage<11, 8> ScaredTobyFace{ + { + 0,1,1,1,0,0,0,1,1,1,0, + 1,2,2,2,1,0,1,2,2,2,1, + 1,2,1,2,1,0,1,2,1,2,1, + 1,2,2,2,1,0,1,2,2,2,1, + 0,1,1,1,0,0,0,1,1,1,0, + 0,0,0,0,0,1,1,0,0,0,0, + 0,0,0,1,0,1,0,0,1,0,0, + 0,0,0,0,1,1,1,1,0,0,0 + } +}; + +template +SDL_Surface* ConstructSurface(paletteImage& source) { + SDL_Surface* surface = SDL_CreateRGBSurfaceFrom(source.data, w, h, 8, w, 0, 0, 0, 0); + SDL_SetSurfacePalette(surface, source.palette); + + SDL_Surface* surface2 = SDL_CreateRGBSurfaceWithFormat(0, w, h, 32, SDL_PIXELFORMAT_RGBA32); + SDL_FillRect(surface2, NULL, 0); + SDL_Rect src{ 0,0,w,h }; + SDL_BlitSurface(surface, &src, surface2, &src); + + SDL_FreeSurface(surface); + return surface2; +} + +template +SDL_Texture* RenderWithPalette(paletteImage& source) { + SDL_Surface* surface = ConstructSurface(source); + + SDL_Texture* finalTexture = SDL_CreateTextureFromSurface(gameRenderer, surface); + SDL_SetTextureBlendMode(finalTexture, SDL_BlendMode::SDL_BLENDMODE_BLEND); + SDL_FreeSurface(surface); + return finalTexture; +} + +/* +..#.####.#.......... +.# # # #......... +.# #......... +.# #......#. +# # # ##....# # +# ##..# # +# ## ### # +# # # # # +# #### # +# # +# # +# # +# #. +.# #. +.# ## #### ## #. +.# ## #..# ## #. +.# #.# #...# #.# #.. +..#...#.....#...#... + +0,0,1,0,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0, +0,1,2,1,2,2,2,2,1,2,1,0,0,0,0,0,0,0,0,0, +0,1,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0, +0,1,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,1,0, +1,2,2,2,2,2,2,2,2,2,2,1,1,0,0,0,0,1,2,1, +1,2,2,2,2,2,2,2,2,2,2,2,2,1,1,0,0,1,2,1, +1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,2,1, +1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1, +1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1, +1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1, +1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1, +1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1, +1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,0, +0,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,0, +0,1,2,2,1,1,2,2,1,1,1,1,2,2,1,1,2,2,1,0, +0,1,2,2,1,1,2,2,1,0,0,1,2,2,1,1,2,2,1,0, +0,1,2,1,0,1,2,1,0,0,0,1,2,1,0,1,2,1,0,0, +0,0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,0,0, +*/ + +/* +.#..#. +...... +..##.. +#.#..# +.####. + +0,1,0,0,1,0, +0,0,0,0,0,0, +0,0,1,1,0,0, +1,0,1,0,0,1, +0,1,1,1,1,0, +*/ + +SDL_Texture* TobyTexture; +SDL_Texture* TobyFaceTexture; +SDL_Texture* ScaredFaceTexture; + +float gradient; + +SDL_Palette* palette; + +void SDLG::OnStart() { + SDL_SetRenderDrawBlendMode(gameRenderer, SDL_BLENDMODE_BLEND); + palette = SDL_AllocPalette(3); + SDL_SetPaletteColors(palette, tobyColours, 0, 3); + + Toby.palette = palette; + TobyFace.palette = palette; + ScaredTobyFace.palette = palette; + + TobyTexture = RenderWithPalette(Toby); + TobyFaceTexture = RenderWithPalette(TobyFace); + ScaredFaceTexture = RenderWithPalette(ScaredTobyFace); + + gradient = SDL_tanf(22.5 / 180 * M_PI); + + if (SDL_IsShapedWindow(gameWindow) == SDL_TRUE) { + SDL_Surface* tobyShape1 = ConstructSurface(Toby); + SDL_Surface* tobyShape2 = SDL_CreateRGBSurfaceWithFormat(0, windowWidth, windowHeight, 32, SDL_PIXELFORMAT_RGBA32); + SDL_FillRect(tobyShape2, NULL, 0); + SDL_Rect src{ 0,0,20,19 }; + SDL_Rect dst{ 0,0,20 * SCALING_FACTOR - 1,19 * SCALING_FACTOR - 1 }; + SDL_BlitScaled(tobyShape1, &src, tobyShape2, &dst); + SDL_WindowShapeMode shapemode = { + WindowShapeMode::ShapeModeBinarizeAlpha + }; + shapemode.parameters.binarizationCutoff = 255; + SDL_SetWindowShape(gameWindow, tobyShape2, &shapemode); + + SDL_FreeSurface(tobyShape1); + SDL_FreeSurface(tobyShape2); + } +} + +#define FOV_GRADIENT 0.2 + +int windowDragOffsetX; +int windowDragOffsetY; + +bool tobyHeld = false; + +frame tobyFrame = { + {0.5,0.5}, + {0.5,0.5}, + + {0,0}, + + {20 * SCALING_FACTOR, 19 * SCALING_FACTOR}, + {0,0} +}; + +frame tobyFaceFrame = { + {6.0 / 20.0, 6.5 / 19.0}, + {0.5,0.5}, + + {0,0}, + + {6 * SCALING_FACTOR, 5 * SCALING_FACTOR}, + {0,0}, + + &tobyFrame +}; + +frame scaredFaceFrame = { + {5.5 / 20.0, 5.0 / 19.0}, + {0.5,0.5}, + + {0,0}, + + {11 * SCALING_FACTOR, 8 * SCALING_FACTOR}, + {0,0}, + + &tobyFrame +}; + +void SDLG::OnFrame() { + if (SDL_IsShapedWindow(gameWindow) == SDL_TRUE) SDL_SetRenderDrawColor(gameRenderer, 0, 0, 0, 255); + else SDL_SetRenderDrawColor(gameRenderer, 63, 63, 63, 255); + SDL_RenderClear(gameRenderer); + + SDL_FRect tobyRect = GetFrameRect(&tobyFrame); + SDL_FPoint center = GetPointInRect(tobyRect, 5.0 / 20.0, 6.5 / 19.0); + + float offsetX = mouseX - center.x; + float offsetY = mouseY - center.y; + + float directionX = (abs(offsetX) < abs(offsetY) * FOV_GRADIENT ? 0 : SCALING_FACTOR) * (offsetX < 0 ? -1 : 1); + float directionY = (abs(offsetY) < abs(offsetX) * FOV_GRADIENT ? 0 : SCALING_FACTOR) * (offsetY < 0 ? -1 : 1); + + // Gross + //float magnitude = sqrtf(offsetX * offsetX + offsetY * offsetY); + //float directionX = offsetX / magnitude * SCALING_FACTOR; + //float directionY = offsetY / magnitude * SCALING_FACTOR; + + tobyFaceFrame.absoluteOffset = { 0, 0 }; + + if (InBounds(ToRect(GetFrameRect(&tobyFaceFrame)), mouseX, mouseY)) { + directionX = 0; + directionY = 0; + } + else if(InBounds(ToRect(GetFrameRect(&tobyFrame)),mouseX,mouseY)) { + if (buttonPressed(SDL_BUTTON_LEFT)) { + windowDragOffsetX = mouseX; + windowDragOffsetY = mouseY; + + tobyHeld = true; + } + } + + if (tobyHeld) { + if (buttonDown(SDL_BUTTON_LEFT)) { + int cx, cy; + SDL_GetGlobalMouseState(&cx, &cy); + SDL_SetWindowPosition(gameWindow, + cx - windowDragOffsetX, + cy - windowDragOffsetY + ); + } + else { + tobyHeld = false; + } + } + + if (keyDown(SDLK_ESCAPE)) gameRunning = false; + + tobyFaceFrame.absoluteOffset = { directionX, directionY }; + + SDL_FRect tobyFaceRect = GetFrameRect(&tobyFaceFrame); + + SDL_SetRenderDrawBlendMode(gameRenderer, SDL_BLENDMODE_BLEND); + SDL_RenderCopyF(gameRenderer, TobyTexture, NULL, &tobyRect); + SDL_RenderCopyF(gameRenderer, TobyFaceTexture, NULL, &tobyFaceRect); + + SDL_RenderPresent(gameRenderer); +} + +void SDLG::OnQuit() { + if (SDL_IsShapedWindow(gameWindow) == SDL_TRUE) { + SDL_Rect srcToby{ 0,0,20,19 }; + SDL_Rect dstToby{ 0,0,20 * SCALING_FACTOR, 19 * SCALING_FACTOR }; + + SDL_Rect srcFace{ 0,0,11,8 }; + SDL_Rect dstFace{ 0,1 * SCALING_FACTOR, 11 * SCALING_FACTOR, 8 * SCALING_FACTOR }; + + SDL_Surface* toby = ConstructSurface(Toby); + SDL_Surface* tobyFace = ConstructSurface(ScaredTobyFace); + SDL_Surface* tobyShape = SDL_CreateRGBSurfaceWithFormat(0, windowWidth, windowHeight, 32, SDL_PIXELFORMAT_RGBA32); + SDL_FillRect(tobyShape, NULL, 0); + + SDL_BlitScaled(toby, &srcToby, tobyShape, &dstToby); + SDL_BlitScaled(tobyFace, &srcFace, tobyShape, &dstFace); + SDL_WindowShapeMode shapemode = { + WindowShapeMode::ShapeModeBinarizeAlpha + }; + shapemode.parameters.binarizationCutoff = 1; + SDL_SetWindowShape(gameWindow, tobyShape, &shapemode); + + SDL_FreeSurface(toby); + SDL_FreeSurface(tobyFace); + SDL_FreeSurface(tobyShape); + } + SDL_FreePalette(palette); + + SDL_FRect tobyRect = GetFrameRect(&tobyFrame); + SDL_FRect faceRect = GetFrameRect(&scaredFaceFrame); + + SDL_SetRenderDrawBlendMode(gameRenderer, SDL_BLENDMODE_BLEND); + SDL_RenderCopyF(gameRenderer, TobyTexture, NULL, &tobyRect); + SDL_RenderCopyF(gameRenderer, ScaredFaceTexture, NULL, &faceRect); + SDL_RenderPresent(gameRenderer); + + SDL_DestroyTexture(ScaredFaceTexture); + SDL_DestroyTexture(TobyTexture); + SDL_DestroyTexture(TobyFaceTexture); + + SDL_Delay(750); // Comedy +} \ No newline at end of file diff --git a/Toby.vcxproj b/Toby.vcxproj new file mode 100644 index 0000000..8fb0520 --- /dev/null +++ b/Toby.vcxproj @@ -0,0 +1,1551 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 16.0 + Win32Proj + {3349cb25-6a1b-4a36-b9d2-ba3112d450cd} + Toby + 10.0 + + + + Application + true + v142 + Unicode + + + Application + false + v142 + true + Unicode + + + Application + true + v142 + Unicode + + + Application + false + v142 + true + Unicode + + + + + + + + + + + + + + + + + + + + + true + .\SDL2\include;.\SDL2_mixer\include;.\SDL2_image\include;$(IncludePath) + .\SDL2\lib\x86;.\SDL2_mixer\lib\x86;.\SDL2_image\lib\x86;$(LibraryPath) + + + false + .\SDL2\include;.\SDL2_mixer\include;.\SDL2_image\include;$(IncludePath) + .\SDL2\lib\x86;.\SDL2_mixer\lib\x86;.\SDL2_image\lib\x86;$(LibraryPath) + + + true + .\SDL2\include;.\SDL2_mixer\include;.\SDL2_image\include;$(IncludePath) + .\SDL2\lib\x64;.\SDL2_mixer\lib\x64;.\SDL2_image\lib\x64;$(LibraryPath) + + + false + .\SDL2\include;.\SDL2_mixer\include;.\SDL2_image\include;$(IncludePath) + .\SDL2\lib\x64;.\SDL2_mixer\lib\x64;.\SDL2_image\lib\x64;$(LibraryPath) + + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + .\SDL2\lib\x86;.\SDL2_mixer\lib\x86;.\SDL2_image\lib\x86;%(AdditionalLibraryDirectories) + SDL2.lib;SDL2main.lib;SDL2_mixer.lib;SDL2_image.lib;%(AdditionalDependencies) + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Windows + true + true + true + .\SDL2\lib\x86;.\SDL2_mixer\lib\x86;.\SDL2_image\lib\x86;%(AdditionalLibraryDirectories) + SDL2.lib;SDL2main.lib;SDL2_mixer.lib;SDL2_image.lib;%(AdditionalDependencies) + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + SDL2.lib;SDL2main.lib;SDL2_mixer.lib;SDL2_image.lib;%(AdditionalDependencies) + .\SDL2\lib\x64;.\SDL2_mixer\lib\x64;.\SDL2_image\lib\x64;%(AdditionalLibraryDirectories) + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Windows + true + true + true + SDL2.lib;SDL2main.lib;SDL2_mixer.lib;SDL2_image.lib;%(AdditionalDependencies) + .\SDL2\lib\x64;.\SDL2_mixer\lib\x64;.\SDL2_image\lib\x64;%(AdditionalLibraryDirectories) + + + + + false + true + Document + false + true + true + false + true + false + + + false + true + Document + false + true + true + false + true + false + + + + + false + true + Document + false + true + true + false + true + false + + + false + true + Document + false + true + true + false + true + false + + + false + true + Document + false + true + true + false + true + false + + + false + true + Document + false + true + true + false + true + false + + + false + true + Document + false + true + true + false + true + false + + + false + true + Document + false + true + true + false + true + false + + + false + true + Document + false + true + true + false + true + false + + + false + true + Document + false + true + true + false + true + false + + + false + true + Document + false + true + true + false + true + false + + + false + true + Document + false + true + true + false + true + false + + + false + true + Document + false + true + true + false + true + false + + + false + true + Document + false + true + true + false + true + false + + + false + true + Document + false + true + true + false + true + false + + + false + true + Document + false + true + true + false + true + false + + + false + true + Document + false + true + true + false + true + false + + + + + false + true + Document + false + true + true + false + true + false + + + false + true + Document + false + true + true + false + true + false + + + false + true + Document + false + true + true + false + true + false + + + false + true + Document + false + true + true + false + true + false + + + false + true + Document + false + true + true + false + true + false + + + false + true + Document + false + true + true + false + true + false + + + false + true + Document + false + true + true + false + true + false + + + false + true + Document + false + true + true + false + true + false + + + false + true + Document + false + true + true + false + true + false + + + false + true + Document + false + true + true + false + true + false + + + false + true + Document + false + true + true + false + true + false + + + false + true + Document + false + true + true + false + true + false + + + false + true + Document + false + true + true + false + true + false + + + false + true + Document + false + true + true + false + true + false + + + false + true + Document + false + true + true + false + true + false + + + + + + + + + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + false + false + true + true + false + true + true + + + false + true + false + true + false + true + false + true + + + false + true + false + true + false + true + false + true + + + + + + true + false + true + false + true + false + true + false + + + true + false + true + false + true + false + true + false + + + true + false + true + false + true + false + true + false + + + true + false + true + false + true + false + true + false + + + true + false + true + false + true + false + true + false + + + true + false + true + false + true + false + true + false + + + true + false + true + false + true + false + true + false + + + true + false + true + false + true + false + true + false + + + true + false + true + false + true + false + true + false + + + true + false + true + false + true + false + true + false + + + true + false + true + false + true + false + true + false + + + true + false + true + false + true + false + true + false + + + true + false + true + false + true + false + true + false + + + true + false + true + false + true + false + true + false + + + true + false + true + false + true + false + true + false + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Toby.vcxproj.filters b/Toby.vcxproj.filters new file mode 100644 index 0000000..3058bf4 --- /dev/null +++ b/Toby.vcxproj.filters @@ -0,0 +1,501 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + {04f64f4f-8a93-4da2-a4ce-4c830e819b73} + + + {0a0343fc-e71c-4b0e-a1e4-7db05cb6a5da} + + + {ee531e7a-02e1-4fe5-8589-c4079b9abc4d} + + + {2d7f25c2-6e23-43f2-a295-3d44b5217dc5} + + + {9bb8dba9-18b2-4abc-824f-99782803d153} + + + {9dfe893d-e5fc-4f2e-a239-fffb0f6ee401} + + + {71e2cd0f-b274-47de-a8e8-8d0f7ce06186} + + + {78240b97-d79a-4667-9551-6cd5a644db5a} + + + {ee6ff54b-8745-4dca-b044-4e184406c65e} + + + {49fd8d6a-6534-4d02-8814-65c0c97e2ca0} + + + + + Resource Files\SDL2\lib + + + Resource Files\SDL2\lib + + + Resource Files\SDL2_image\lib + + + Resource Files\SDL2_image\lib + + + Resource Files\SDL2_image\lib + + + Resource Files\SDL2_image\lib + + + Resource Files\SDL2_image\lib + + + Resource Files\SDL2_image\lib + + + Resource Files\SDL2_image\lib + + + Resource Files\SDL2_image\lib + + + Resource Files\SDL2_image\lib + + + Resource Files\SDL2_image\lib + + + Resource Files\SDL2_image\lib + + + Resource Files\SDL2_image\lib + + + Resource Files\SDL2_mixer\lib + + + Resource Files\SDL2_mixer\lib + + + Resource Files\SDL2_mixer\lib + + + Resource Files\SDL2_mixer\lib + + + Resource Files\SDL2_mixer\lib + + + Resource Files\SDL2_mixer\lib + + + Resource Files\SDL2_mixer\lib + + + Resource Files\SDL2_mixer\lib + + + Resource Files\SDL2_mixer\lib + + + Resource Files\SDL2_mixer\lib + + + Resource Files\SDL2_mixer\lib + + + Resource Files\SDL2_mixer\lib + + + Resource Files\SDL2_mixer\lib + + + Resource Files\SDL2_mixer\lib + + + Resource Files\SDL2_mixer\lib + + + Resource Files\SDL2_mixer\lib + + + Resource Files\SDL2_mixer\lib + + + Resource Files\SDL2_mixer\lib + + + + + Source Files + + + Source Files + + + + + Header Files + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2\include + + + Resource Files\SDL2_image\include + + + Resource Files\SDL2_mixer\include + + + Header Files + + + Header Files + + + + + Resource Files\Gitignores + + + Resource Files\Gitignores + + + Resource Files\Gitignores + + + Resource Files\Gitignores + + + Resource Files\Gitignores + + + Resource Files\Gitignores + + + Resource Files\Gitignores + + + Resource Files\Gitignores + + + Resource Files\Gitignores + + + Resource Files\Gitignores + + + Resource Files\Gitignores + + + Resource Files\Gitignores + + + Resource Files\Gitignores + + + Resource Files\Gitignores + + + Resource Files\Gitignores + + + + + Resource Files\SDL2\lib + + + Resource Files\SDL2\lib + + + Resource Files\SDL2\lib + + + Resource Files\SDL2\lib + + + Resource Files\SDL2\lib + + + Resource Files\SDL2\lib + + + Resource Files\SDL2_image\lib + + + Resource Files\SDL2_image\lib + + + Resource Files\SDL2_mixer\lib + + + Resource Files\SDL2_mixer\lib + + + \ No newline at end of file diff --git a/Toby.vcxproj.user b/Toby.vcxproj.user new file mode 100644 index 0000000..966b4ff --- /dev/null +++ b/Toby.vcxproj.user @@ -0,0 +1,6 @@ + + + + true + + \ No newline at end of file