diff --git a/CMakeLists.txt b/CMakeLists.txt index af96384..f6e8831 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,115 +7,65 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) add_library(blah - public/blah.h - public/blah/app.cpp - public/blah/app.h - public/blah/filesystem.cpp - public/blah/filesystem.h - public/blah/log.cpp - public/blah/log.h - public/blah/time.cpp - public/blah/time.h + src/core/app.cpp + src/core/filesystem.cpp + src/core/log.cpp + src/core/time.cpp - public/blah/graphics/blend.h - public/blah/graphics/blend.cpp - public/blah/graphics/framebuffer.h - public/blah/graphics/framebuffer.cpp - public/blah/graphics/material.h - public/blah/graphics/material.cpp - public/blah/graphics/mesh.h - public/blah/graphics/mesh.cpp - public/blah/graphics/renderpass.h - public/blah/graphics/renderpass.cpp - public/blah/graphics/sampler.h - public/blah/graphics/shader.h - public/blah/graphics/shader.cpp - public/blah/graphics/texture.h - public/blah/graphics/texture.cpp + src/graphics/blend.cpp + src/graphics/framebuffer.cpp + src/graphics/material.cpp + src/graphics/mesh.cpp + src/graphics/renderpass.cpp + src/graphics/shader.cpp + src/graphics/texture.cpp - public/blah/input/input.cpp - public/blah/input/virtual_stick.cpp - public/blah/input/virtual_stick.h - public/blah/input/virtual_button.cpp - public/blah/input/virtual_button.h - public/blah/input/virtual_axis.cpp - public/blah/input/virtual_axis.h + src/input/input.cpp + src/input/virtual_stick.cpp + src/input/virtual_button.cpp + src/input/virtual_axis.cpp - public/blah/containers/vector.h - public/blah/containers/stackvector.h - public/blah/containers/str.cpp - public/blah/containers/str.h + src/containers/str.cpp - public/blah/drawing/batch.cpp - public/blah/drawing/batch.h - public/blah/drawing/spritefont.cpp - public/blah/drawing/spritefont.h - public/blah/drawing/subtexture.cpp - public/blah/drawing/subtexture.h + src/drawing/batch.cpp + src/drawing/spritefont.cpp + src/drawing/subtexture.cpp - public/blah/images/aseprite.cpp - public/blah/images/aseprite.h - public/blah/images/font.cpp - public/blah/images/font.h - public/blah/images/image.cpp - public/blah/images/image.h - public/blah/images/packer.cpp - public/blah/images/packer.h + src/images/aseprite.cpp + src/images/font.cpp + src/images/image.cpp + src/images/packer.cpp - public/blah/math/calc.cpp - public/blah/math/calc.h - public/blah/math/circle.cpp - public/blah/math/circle.h - public/blah/math/color.cpp - public/blah/math/color.h - public/blah/math/ease.h - public/blah/math/line.cpp - public/blah/math/line.h - public/blah/math/mat3x2.cpp - public/blah/math/mat3x2.h - public/blah/math/mat4x4.cpp - public/blah/math/mat4x4.h - public/blah/math/point.cpp - public/blah/math/point.h - public/blah/math/quad.h - public/blah/math/quad.cpp - public/blah/math/rect.cpp - public/blah/math/rect.h - public/blah/math/rectI.cpp - public/blah/math/rectI.h - public/blah/math/stopwatch.cpp - public/blah/math/stopwatch.h - public/blah/math/vec2.cpp - public/blah/math/vec2.h - public/blah/math/vec4.h + src/math/calc.cpp + src/math/circle.cpp + src/math/color.cpp + src/math/line.cpp + src/math/mat3x2.cpp + src/math/mat4x4.cpp + src/math/point.cpp + src/math/quad.cpp + src/math/rect.cpp + src/math/rectI.cpp + src/math/stopwatch.cpp + src/math/vec2.cpp - public/blah/streams/endian.h - public/blah/streams/bufferstream.cpp - public/blah/streams/bufferstream.h - public/blah/streams/filestream.cpp - public/blah/streams/filestream.h - public/blah/streams/memorystream.cpp - public/blah/streams/memorystream.h - public/blah/streams/stream.cpp - public/blah/streams/stream.h + src/streams/bufferstream.cpp + src/streams/filestream.cpp + src/streams/memorystream.cpp + src/streams/stream.cpp - private/blah/third_party/stb_image.h - private/blah/third_party/stb_image_write.h - private/blah/third_party/stb_truetype.h - private/blah/internal/graphics_backend.h - private/blah/internal/graphics_backend_gl.cpp - private/blah/internal/graphics_backend_d3d11.cpp - private/blah/internal/graphics_backend_dummy.cpp - private/blah/internal/input_backend.h - private/blah/internal/platform_backend.h - private/blah/internal/platform_backend_sdl2.cpp + + src/internal/graphics_backend_gl.cpp + src/internal/graphics_backend_d3d11.cpp + src/internal/graphics_backend_dummy.cpp + src/internal/platform_backend_sdl2.cpp ) target_include_directories(blah PUBLIC - $ + $ PRIVATE - $ + $ ) # Platform Variables @@ -127,12 +77,12 @@ set(D3D11_ENABLED false CACHE BOOL "Use D3D11 graphics implementation") set(LIBS "") -# add OpenGL definition if we're using OpenGL +# add OpenGL definition if we're using it if (OPENGL_ENABLED) add_compile_definitions(BLAH_USE_OPENGL) endif() -# add D3D11 definition if we're using D3D11 +# add D3D11 definition if we're using it if (D3D11_ENABLED) add_compile_definitions(BLAH_USE_D3D11) set(LIBS ${LIBS} d3d11.lib dxguid.lib D3Dcompiler.lib) @@ -145,4 +95,4 @@ if (SDL2_ENABLED) set(LIBS ${LIBS} ${SDL2_LIBRARIES}) endif() -target_link_libraries(blah PUBLIC ${LIBS}) +target_link_libraries(blah PUBLIC ${LIBS}) \ No newline at end of file diff --git a/include/blah.h b/include/blah.h new file mode 100644 index 0000000..920c3ef --- /dev/null +++ b/include/blah.h @@ -0,0 +1,54 @@ +#pragma once + +#include "blah/core/app.h" +#include "blah/core/filesystem.h" +#include "blah/core/log.h" +#include "blah/core/time.h" + +#include "blah/containers/vector.h" +#include "blah/containers/stackvector.h" +#include "blah/containers/str.h" + +#include "blah/drawing/batch.h" +#include "blah/drawing/spritefont.h" +#include "blah/drawing/subtexture.h" + +#include "blah/graphics/blend.h" +#include "blah/graphics/framebuffer.h" +#include "blah/graphics/material.h" +#include "blah/graphics/mesh.h" +#include "blah/graphics/renderpass.h" +#include "blah/graphics/sampler.h" +#include "blah/graphics/shader.h" +#include "blah/graphics/texture.h" + +#include "blah/images/aseprite.h" +#include "blah/images/font.h" +#include "blah/images/image.h" +#include "blah/images/packer.h" + +#include "blah/input/input.h" +#include "blah/input/virtual_stick.h" +#include "blah/input/virtual_button.h" +#include "blah/input/virtual_axis.h" + +#include "blah/math/calc.h" +#include "blah/math/circle.h" +#include "blah/math/color.h" +#include "blah/math/ease.h" +#include "blah/math/line.h" +#include "blah/math/mat3x2.h" +#include "blah/math/mat4x4.h" +#include "blah/math/point.h" +#include "blah/math/quad.h" +#include "blah/math/rect.h" +#include "blah/math/rectI.h" +#include "blah/math/stopwatch.h" +#include "blah/math/vec2.h" +#include "blah/math/vec4.h" + +#include "blah/streams/bufferstream.h" +#include "blah/streams/filestream.h" +#include "blah/streams/memorystream.h" +#include "blah/streams/stream.h" +#include "blah/streams/endian.h" \ No newline at end of file diff --git a/public/blah/containers/stackvector.h b/include/blah/containers/stackvector.h similarity index 99% rename from public/blah/containers/stackvector.h rename to include/blah/containers/stackvector.h index 0e44ca1..e1afe24 100644 --- a/public/blah/containers/stackvector.h +++ b/include/blah/containers/stackvector.h @@ -1,5 +1,5 @@ #pragma once -#include +#include #include namespace Blah diff --git a/public/blah/containers/str.h b/include/blah/containers/str.h similarity index 100% rename from public/blah/containers/str.h rename to include/blah/containers/str.h diff --git a/public/blah/containers/vector.h b/include/blah/containers/vector.h similarity index 99% rename from public/blah/containers/vector.h rename to include/blah/containers/vector.h index 210a9fc..b48f41e 100644 --- a/public/blah/containers/vector.h +++ b/include/blah/containers/vector.h @@ -1,5 +1,5 @@ #pragma once -#include +#include #include #include diff --git a/public/blah/app.h b/include/blah/core/app.h similarity index 94% rename from public/blah/app.h rename to include/blah/core/app.h index b0d5cdb..7256c31 100644 --- a/public/blah/app.h +++ b/include/blah/core/app.h @@ -1,5 +1,5 @@ #pragma once -#include +#include namespace Blah { @@ -40,6 +40,9 @@ namespace Blah int max_texture_size = 0; }; + class FrameBuffer; + using FrameBufferRef = std::shared_ptr; + namespace App { // Runs the application diff --git a/public/blah/filesystem.h b/include/blah/core/filesystem.h similarity index 100% rename from public/blah/filesystem.h rename to include/blah/core/filesystem.h diff --git a/public/blah/log.h b/include/blah/core/log.h similarity index 100% rename from public/blah/log.h rename to include/blah/core/log.h diff --git a/public/blah/time.h b/include/blah/core/time.h similarity index 100% rename from public/blah/time.h rename to include/blah/core/time.h diff --git a/public/blah/drawing/batch.h b/include/blah/drawing/batch.h similarity index 99% rename from public/blah/drawing/batch.h rename to include/blah/drawing/batch.h index 38eea63..30be4c3 100644 --- a/public/blah/drawing/batch.h +++ b/include/blah/drawing/batch.h @@ -11,7 +11,7 @@ #include #include #include -#include +#include namespace Blah { diff --git a/public/blah/drawing/spritefont.h b/include/blah/drawing/spritefont.h similarity index 100% rename from public/blah/drawing/spritefont.h rename to include/blah/drawing/spritefont.h diff --git a/public/blah/drawing/subtexture.h b/include/blah/drawing/subtexture.h similarity index 91% rename from public/blah/drawing/subtexture.h rename to include/blah/drawing/subtexture.h index c88b88a..43bd833 100644 --- a/public/blah/drawing/subtexture.h +++ b/include/blah/drawing/subtexture.h @@ -4,6 +4,8 @@ namespace Blah { + // Subtexture is a view into a texture, and can be used to + // easily represent sprites in a larger texture atlas. struct Subtexture { // Reference to our Texture diff --git a/public/blah/graphics/blend.h b/include/blah/graphics/blend.h similarity index 69% rename from public/blah/graphics/blend.h rename to include/blah/graphics/blend.h index 20611d8..654ee29 100644 --- a/public/blah/graphics/blend.h +++ b/include/blah/graphics/blend.h @@ -65,29 +65,28 @@ namespace Blah BlendMode() = default; - BlendMode(BlendOp op, BlendFactor src, BlendFactor dst) - { - color_op = op; - color_src = src; - color_dst = dst; - alpha_op = op; - alpha_src = src; - alpha_dst = dst; - mask = BlendMask::RGBA; - rgba = 0xffffffff; - } + BlendMode(BlendOp op, BlendFactor src, BlendFactor dst) : + color_op(op), + color_src(src), + color_dst(dst), + alpha_op(op), + alpha_src(src), + alpha_dst(dst), + mask(BlendMask::RGBA), + rgba(0xffffffff) {} - BlendMode(BlendOp rgbOp, BlendFactor rgbSrc, BlendFactor rgbDst, BlendOp aOp, BlendFactor aSrc, BlendFactor aDst, BlendMask blendMask, uint32_t blendColor) - { - color_op = rgbOp; - color_src = rgbSrc; - color_dst = rgbDst; - alpha_op = aOp; - alpha_src = aSrc; - alpha_dst = aDst; - mask = blendMask; - rgba = blendColor; - } + BlendMode( + BlendOp color_op, BlendFactor color_src, BlendFactor color_dst, + BlendOp alpha_op, BlendFactor alpha_src, BlendFactor alpha_dst, + BlendMask blend_mask, uint32_t blend_rgba) : + color_op(color_op), + color_src(color_src), + color_dst(color_dst), + alpha_op(alpha_op), + alpha_src(alpha_src), + alpha_dst(alpha_dst), + mask(blend_mask), + rgba(blend_rgba) {} bool operator==(const BlendMode& rhs) const { diff --git a/public/blah/graphics/framebuffer.h b/include/blah/graphics/framebuffer.h similarity index 100% rename from public/blah/graphics/framebuffer.h rename to include/blah/graphics/framebuffer.h diff --git a/public/blah/graphics/material.h b/include/blah/graphics/material.h similarity index 96% rename from public/blah/graphics/material.h rename to include/blah/graphics/material.h index a39b130..7347d2d 100644 --- a/public/blah/graphics/material.h +++ b/include/blah/graphics/material.h @@ -57,6 +57,8 @@ namespace Blah TextureSampler get_sampler(int slot, int array_index = 0) const; // Sets the value. `length` is the total number of floats to set + // For example if the uniform is a float2[4], a total of 8 float values + // can be set. void set_value(const char* name, const float* value, int64_t length); // Gets a pointer to the values of the given Uniform, or nullptr if it doesn't exist. diff --git a/public/blah/graphics/mesh.h b/include/blah/graphics/mesh.h similarity index 100% rename from public/blah/graphics/mesh.h rename to include/blah/graphics/mesh.h diff --git a/public/blah/graphics/renderpass.h b/include/blah/graphics/renderpass.h similarity index 100% rename from public/blah/graphics/renderpass.h rename to include/blah/graphics/renderpass.h diff --git a/public/blah/graphics/sampler.h b/include/blah/graphics/sampler.h similarity index 100% rename from public/blah/graphics/sampler.h rename to include/blah/graphics/sampler.h diff --git a/public/blah/graphics/shader.h b/include/blah/graphics/shader.h similarity index 100% rename from public/blah/graphics/shader.h rename to include/blah/graphics/shader.h diff --git a/public/blah/graphics/texture.h b/include/blah/graphics/texture.h similarity index 99% rename from public/blah/graphics/texture.h rename to include/blah/graphics/texture.h index 33c4368..38cecf5 100644 --- a/public/blah/graphics/texture.h +++ b/include/blah/graphics/texture.h @@ -3,7 +3,6 @@ namespace Blah { - enum class TextureFormat { None, diff --git a/public/blah/images/aseprite.h b/include/blah/images/aseprite.h similarity index 95% rename from public/blah/images/aseprite.h rename to include/blah/images/aseprite.h index cfa3d16..594136a 100644 --- a/public/blah/images/aseprite.h +++ b/include/blah/images/aseprite.h @@ -6,6 +6,9 @@ namespace Blah { + // A simple Aseprite file parser. + // This implementation does not support Aseprite blendmodes, + // besides the default blend mode. class Aseprite { public: diff --git a/public/blah/images/font.h b/include/blah/images/font.h similarity index 100% rename from public/blah/images/font.h rename to include/blah/images/font.h diff --git a/public/blah/images/image.h b/include/blah/images/image.h similarity index 100% rename from public/blah/images/image.h rename to include/blah/images/image.h diff --git a/public/blah/images/packer.h b/include/blah/images/packer.h similarity index 93% rename from public/blah/images/packer.h rename to include/blah/images/packer.h index 745fc72..da0a8f9 100644 --- a/public/blah/images/packer.h +++ b/include/blah/images/packer.h @@ -9,7 +9,8 @@ namespace Blah { - + // Texture Packer, which takes source images and combines + // them into a single large texture. class Packer { public: diff --git a/public/blah/input/input.h b/include/blah/input/input.h similarity index 90% rename from public/blah/input/input.h rename to include/blah/input/input.h index 4c8280c..f227a3d 100644 --- a/public/blah/input/input.h +++ b/include/blah/input/input.h @@ -412,13 +412,13 @@ namespace Blah // Gets the Mouse Wheel Point mouse_wheel(); - // Returns 1 if the keyboard key was pressed this frame, and 0 otherwise. + // Checks if the keyboard key was pressed this frame bool pressed(Key key); - // Returns 1 if the keyboard key was held this frame, and 0 otherwise. + // Checks if the keyboard key was held this frame bool down(Key key); - // Returns 1 if the keyboard key was released this frame, and 0 otherwise. + // Checks if the keyboard key was released this frame bool released(Key key); // Checks if the Left or Right Ctrl Key is down @@ -435,23 +435,28 @@ namespace Blah // Gets the controller info for the current controller index. // If the controller is not connected or the index it out of range, this will set an unconnected controller. - const ControllerState* controller(int controllerIndex); + const ControllerState* controller(int controller_index); - // Returns 1 if the button on the controller was pressed this frame, and 0 otherwise. - // If the controller is not connected, or the index is out of range, this will return 0. - bool pressed(int controllerIndex, Button button); + // Checks if the button on the controller was pressed this frame. + // If the controller is not connected, or the index is out of range, this will return false. + bool pressed(int controller_index, Button button); - // Returns 1 if the button on the controller was held this frame, and 0 otherwise. - // If the controller is not connected, or the index is out of range, this will return 0. - bool down(int controllerIndex, Button button); + // Checks if the button on the controller was held this frame. + // If the controller is not connected, or the index is out of range, this will return false. + bool down(int controller_index, Button button); - // Returns 1 if the button on the controller was released this frame, and 0 otherwise. - // If the controller is not connected, or the index is out of range, this will return 0. - bool released(int controllerIndex, Button button); + // Checks if the button on the controller was released this frame. + // If the controller is not connected, or the index is out of range, this will return false. + bool released(int controller_index, Button button); - float axis_check(int controllerIndex, Axis axis); - int axis_check(int prev, Key negative, Key positive); - int axis_check(int prev, int controllerIndex, Button negative, Button positive); + // returns the value of the given axis + float axis_check(int controller_index, Axis axis); + + // checks the given virtual axis, described by 2 keys. `fallback` is returned if both keys are held + int axis_check(int fallback, Key negative, Key positive); + + // checks the given virtual axis, described by 2 buttons. `fallback` is returned if both buttons are held + int axis_check(int fallback, int controller_index, Button negative, Button positive); // returns a string name of the given key const char* name_of(Key key); diff --git a/public/blah/input/virtual_axis.h b/include/blah/input/virtual_axis.h similarity index 93% rename from public/blah/input/virtual_axis.h rename to include/blah/input/virtual_axis.h index 9aa3335..21169f3 100644 --- a/public/blah/input/virtual_axis.h +++ b/include/blah/input/virtual_axis.h @@ -3,6 +3,8 @@ namespace Blah { + // A virtual controller axis, which can be used to map multiple + // inputs to an axis. Note that you must call `update` every frame! class VirtualAxis { private: diff --git a/public/blah/input/virtual_button.h b/include/blah/input/virtual_button.h similarity index 100% rename from public/blah/input/virtual_button.h rename to include/blah/input/virtual_button.h diff --git a/public/blah/input/virtual_stick.h b/include/blah/input/virtual_stick.h similarity index 94% rename from public/blah/input/virtual_stick.h rename to include/blah/input/virtual_stick.h index 534e9ec..b82be86 100644 --- a/public/blah/input/virtual_stick.h +++ b/include/blah/input/virtual_stick.h @@ -5,6 +5,8 @@ namespace Blah { + // A virtual controller stick, which can be used to map multiple + // inputs to a stick. Note that you must call `update` every frame! class VirtualStick { private: diff --git a/public/blah/math/calc.h b/include/blah/math/calc.h similarity index 100% rename from public/blah/math/calc.h rename to include/blah/math/calc.h diff --git a/public/blah/math/circle.h b/include/blah/math/circle.h similarity index 100% rename from public/blah/math/circle.h rename to include/blah/math/circle.h diff --git a/public/blah/math/color.h b/include/blah/math/color.h similarity index 100% rename from public/blah/math/color.h rename to include/blah/math/color.h diff --git a/public/blah/math/ease.h b/include/blah/math/ease.h similarity index 99% rename from public/blah/math/ease.h rename to include/blah/math/ease.h index acd507d..f2cdf24 100644 --- a/public/blah/math/ease.h +++ b/include/blah/math/ease.h @@ -1,6 +1,6 @@ #pragma once #include -#include +#include namespace Blah { diff --git a/public/blah/math/line.h b/include/blah/math/line.h similarity index 100% rename from public/blah/math/line.h rename to include/blah/math/line.h diff --git a/public/blah/math/mat3x2.h b/include/blah/math/mat3x2.h similarity index 100% rename from public/blah/math/mat3x2.h rename to include/blah/math/mat3x2.h diff --git a/public/blah/math/mat4x4.h b/include/blah/math/mat4x4.h similarity index 100% rename from public/blah/math/mat4x4.h rename to include/blah/math/mat4x4.h diff --git a/public/blah/math/point.h b/include/blah/math/point.h similarity index 100% rename from public/blah/math/point.h rename to include/blah/math/point.h diff --git a/public/blah/math/quad.h b/include/blah/math/quad.h similarity index 100% rename from public/blah/math/quad.h rename to include/blah/math/quad.h diff --git a/public/blah/math/rect.h b/include/blah/math/rect.h similarity index 100% rename from public/blah/math/rect.h rename to include/blah/math/rect.h diff --git a/public/blah/math/rectI.h b/include/blah/math/rectI.h similarity index 100% rename from public/blah/math/rectI.h rename to include/blah/math/rectI.h diff --git a/public/blah/math/stopwatch.h b/include/blah/math/stopwatch.h similarity index 100% rename from public/blah/math/stopwatch.h rename to include/blah/math/stopwatch.h diff --git a/public/blah/math/vec2.h b/include/blah/math/vec2.h similarity index 100% rename from public/blah/math/vec2.h rename to include/blah/math/vec2.h diff --git a/public/blah/math/vec4.h b/include/blah/math/vec4.h similarity index 100% rename from public/blah/math/vec4.h rename to include/blah/math/vec4.h diff --git a/public/blah/streams/bufferstream.h b/include/blah/streams/bufferstream.h similarity index 100% rename from public/blah/streams/bufferstream.h rename to include/blah/streams/bufferstream.h diff --git a/public/blah/streams/endian.h b/include/blah/streams/endian.h similarity index 100% rename from public/blah/streams/endian.h rename to include/blah/streams/endian.h diff --git a/public/blah/streams/filestream.h b/include/blah/streams/filestream.h similarity index 96% rename from public/blah/streams/filestream.h rename to include/blah/streams/filestream.h index 85d63a5..093ffae 100644 --- a/public/blah/streams/filestream.h +++ b/include/blah/streams/filestream.h @@ -1,6 +1,6 @@ #pragma once #include -#include +#include namespace Blah { diff --git a/public/blah/streams/memorystream.h b/include/blah/streams/memorystream.h similarity index 100% rename from public/blah/streams/memorystream.h rename to include/blah/streams/memorystream.h diff --git a/public/blah/streams/stream.h b/include/blah/streams/stream.h similarity index 100% rename from public/blah/streams/stream.h rename to include/blah/streams/stream.h diff --git a/public/blah.h b/public/blah.h deleted file mode 100644 index 8c9da8e..0000000 --- a/public/blah.h +++ /dev/null @@ -1,55 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include \ No newline at end of file diff --git a/public/blah/containers/str.cpp b/src/containers/str.cpp similarity index 100% rename from public/blah/containers/str.cpp rename to src/containers/str.cpp diff --git a/public/blah/app.cpp b/src/core/app.cpp similarity index 95% rename from public/blah/app.cpp rename to src/core/app.cpp index 3d96484..3153f0f 100644 --- a/public/blah/app.cpp +++ b/src/core/app.cpp @@ -1,11 +1,11 @@ -#include -#include -#include +#include +#include +#include #include - -#include -#include -#include +#include +#include "../internal/platform_backend.h" +#include "../internal/graphics_backend.h" +#include "../internal/input_backend.h" using namespace Blah; diff --git a/public/blah/filesystem.cpp b/src/core/filesystem.cpp similarity index 97% rename from public/blah/filesystem.cpp rename to src/core/filesystem.cpp index e6eb4ad..fa10728 100644 --- a/public/blah/filesystem.cpp +++ b/src/core/filesystem.cpp @@ -1,5 +1,5 @@ -#include -#include +#include +#include "../internal/platform_backend.h" using namespace Blah; diff --git a/public/blah/log.cpp b/src/core/log.cpp similarity index 95% rename from public/blah/log.cpp rename to src/core/log.cpp index 00c2def..75622d3 100644 --- a/public/blah/log.cpp +++ b/src/core/log.cpp @@ -1,5 +1,5 @@ -#include -#include +#include +#include #include // for logging methods #include // for sprintf diff --git a/public/blah/time.cpp b/src/core/time.cpp similarity index 97% rename from public/blah/time.cpp rename to src/core/time.cpp index d3f5128..8b67be2 100644 --- a/public/blah/time.cpp +++ b/src/core/time.cpp @@ -1,4 +1,4 @@ -#include +#include #include using namespace Blah; diff --git a/public/blah/drawing/batch.cpp b/src/drawing/batch.cpp similarity index 99% rename from public/blah/drawing/batch.cpp rename to src/drawing/batch.cpp index e889a2c..eeb3029 100644 --- a/public/blah/drawing/batch.cpp +++ b/src/drawing/batch.cpp @@ -5,7 +5,7 @@ #include #include #include -#include +#include using namespace Blah; namespace diff --git a/public/blah/drawing/spritefont.cpp b/src/drawing/spritefont.cpp similarity index 99% rename from public/blah/drawing/spritefont.cpp rename to src/drawing/spritefont.cpp index d533c8f..cff0a63 100644 --- a/public/blah/drawing/spritefont.cpp +++ b/src/drawing/spritefont.cpp @@ -1,7 +1,7 @@ #include #include #include -#include +#include using namespace Blah; diff --git a/public/blah/drawing/subtexture.cpp b/src/drawing/subtexture.cpp similarity index 100% rename from public/blah/drawing/subtexture.cpp rename to src/drawing/subtexture.cpp diff --git a/public/blah/graphics/blend.cpp b/src/graphics/blend.cpp similarity index 100% rename from public/blah/graphics/blend.cpp rename to src/graphics/blend.cpp diff --git a/public/blah/graphics/framebuffer.cpp b/src/graphics/framebuffer.cpp similarity index 96% rename from public/blah/graphics/framebuffer.cpp rename to src/graphics/framebuffer.cpp index 16eb100..4ed290b 100644 --- a/public/blah/graphics/framebuffer.cpp +++ b/src/graphics/framebuffer.cpp @@ -1,5 +1,5 @@ #include -#include +#include "../internal/graphics_backend.h" using namespace Blah; diff --git a/public/blah/graphics/material.cpp b/src/graphics/material.cpp similarity index 99% rename from public/blah/graphics/material.cpp rename to src/graphics/material.cpp index a4b6472..01139b7 100644 --- a/public/blah/graphics/material.cpp +++ b/src/graphics/material.cpp @@ -1,5 +1,5 @@ #include -#include +#include using namespace Blah; diff --git a/public/blah/graphics/mesh.cpp b/src/graphics/mesh.cpp similarity index 92% rename from public/blah/graphics/mesh.cpp rename to src/graphics/mesh.cpp index efc4ae9..dc7832a 100644 --- a/public/blah/graphics/mesh.cpp +++ b/src/graphics/mesh.cpp @@ -1,5 +1,5 @@ -#include "mesh.h" -#include +#include +#include "../internal/graphics_backend.h" using namespace Blah; diff --git a/public/blah/graphics/renderpass.cpp b/src/graphics/renderpass.cpp similarity index 97% rename from public/blah/graphics/renderpass.cpp rename to src/graphics/renderpass.cpp index 61a3db0..61bb766 100644 --- a/public/blah/graphics/renderpass.cpp +++ b/src/graphics/renderpass.cpp @@ -1,6 +1,6 @@ #include -#include -#include +#include +#include "../internal/graphics_backend.h" using namespace Blah; diff --git a/public/blah/graphics/shader.cpp b/src/graphics/shader.cpp similarity index 94% rename from public/blah/graphics/shader.cpp rename to src/graphics/shader.cpp index d9a7a97..5c7ed02 100644 --- a/public/blah/graphics/shader.cpp +++ b/src/graphics/shader.cpp @@ -1,5 +1,6 @@ #include -#include +#include +#include "../internal/graphics_backend.h" using namespace Blah; diff --git a/public/blah/graphics/texture.cpp b/src/graphics/texture.cpp similarity index 95% rename from public/blah/graphics/texture.cpp rename to src/graphics/texture.cpp index 619d61f..ff17353 100644 --- a/public/blah/graphics/texture.cpp +++ b/src/graphics/texture.cpp @@ -1,8 +1,8 @@ #include #include #include -#include -#include +#include +#include "../internal/graphics_backend.h" using namespace Blah; diff --git a/public/blah/images/aseprite.cpp b/src/images/aseprite.cpp similarity index 99% rename from public/blah/images/aseprite.cpp rename to src/images/aseprite.cpp index 363a01f..b346156 100644 --- a/public/blah/images/aseprite.cpp +++ b/src/images/aseprite.cpp @@ -1,10 +1,11 @@ #include #include -#include +#include +#include #define STBI_NO_STDIO #define STBI_ONLY_ZLIB -#include +#include "../third_party/stb_image.h" #define MAX(a, b) ((a) > (b) ? (a) : (b)) #define MIN(a, b) ((a) < (b) ? (a) : (b)) diff --git a/public/blah/images/font.cpp b/src/images/font.cpp similarity index 98% rename from public/blah/images/font.cpp rename to src/images/font.cpp index 745382f..af6268c 100644 --- a/public/blah/images/font.cpp +++ b/src/images/font.cpp @@ -1,13 +1,13 @@ #include #include #include -#include +#include using namespace Blah; #define STBTT_STATIC #define STB_TRUETYPE_IMPLEMENTATION -#include +#include "../third_party/stb_truetype.h" String GetName(stbtt_fontinfo* font, int nameId) { diff --git a/public/blah/images/image.cpp b/src/images/image.cpp similarity index 98% rename from public/blah/images/image.cpp rename to src/images/image.cpp index 3f32831..33f1d18 100644 --- a/public/blah/images/image.cpp +++ b/src/images/image.cpp @@ -1,7 +1,7 @@ #include #include #include -#include +#include using namespace Blah; @@ -9,10 +9,10 @@ using namespace Blah; #define STBI_ONLY_JPEG #define STBI_ONLY_PNG #define STBI_ONLY_BMP -#include +#include "../third_party/stb_image.h" #define STB_IMAGE_WRITE_IMPLEMENTATION -#include +#include "../third_party/stb_image_write.h" namespace { diff --git a/public/blah/images/packer.cpp b/src/images/packer.cpp similarity index 99% rename from public/blah/images/packer.cpp rename to src/images/packer.cpp index 6ed1adf..623c99a 100644 --- a/public/blah/images/packer.cpp +++ b/src/images/packer.cpp @@ -1,5 +1,5 @@ #include -#include +#include #include #include diff --git a/public/blah/input/input.cpp b/src/input/input.cpp similarity index 96% rename from public/blah/input/input.cpp rename to src/input/input.cpp index 6b8cdfd..7603a54 100644 --- a/public/blah/input/input.cpp +++ b/src/input/input.cpp @@ -1,9 +1,9 @@ #include -#include -#include -#include +#include +#include +#include #include -#include +#include "../internal/input_backend.h" #include using namespace Blah; @@ -334,7 +334,7 @@ float Input::axis_check(int controllerIndex, Axis axis) return 0; } -int Input::axis_check(int prev, Key negative, Key positive) +int Input::axis_check(int fallback, Key negative, Key positive) { if (Input::pressed(positive)) return 1; @@ -346,7 +346,7 @@ int Input::axis_check(int prev, Key negative, Key positive) bool neg = Input::down(negative); if (pos && neg) - return prev; + return fallback; else if (pos) return 1; else if (neg) @@ -356,7 +356,7 @@ int Input::axis_check(int prev, Key negative, Key positive) } } -int Input::axis_check(int prev, int controllerIndex, Button negative, Button positive) +int Input::axis_check(int fallback, int controllerIndex, Button negative, Button positive) { if (Input::pressed(controllerIndex, positive)) return 1; @@ -368,7 +368,7 @@ int Input::axis_check(int prev, int controllerIndex, Button negative, Button pos bool neg = Input::down(controllerIndex, negative); if (pos && neg) - return prev; + return fallback; else if (pos) return 1; else if (neg) diff --git a/public/blah/input/virtual_axis.cpp b/src/input/virtual_axis.cpp similarity index 98% rename from public/blah/input/virtual_axis.cpp rename to src/input/virtual_axis.cpp index 8c3481a..83c5193 100644 --- a/public/blah/input/virtual_axis.cpp +++ b/src/input/virtual_axis.cpp @@ -1,6 +1,6 @@ #include -#include -#include +#include +#include using namespace Blah; diff --git a/public/blah/input/virtual_button.cpp b/src/input/virtual_button.cpp similarity index 98% rename from public/blah/input/virtual_button.cpp rename to src/input/virtual_button.cpp index 38bcccf..e68d2a3 100644 --- a/public/blah/input/virtual_button.cpp +++ b/src/input/virtual_button.cpp @@ -1,6 +1,6 @@ #include -#include -#include +#include +#include using namespace Blah; diff --git a/public/blah/input/virtual_stick.cpp b/src/input/virtual_stick.cpp similarity index 98% rename from public/blah/input/virtual_stick.cpp rename to src/input/virtual_stick.cpp index 1cf797c..36fce4e 100644 --- a/public/blah/input/virtual_stick.cpp +++ b/src/input/virtual_stick.cpp @@ -1,6 +1,6 @@ #include -#include -#include +#include +#include using namespace Blah; diff --git a/private/blah/internal/graphics_backend.h b/src/internal/graphics_backend.h similarity index 98% rename from private/blah/internal/graphics_backend.h rename to src/internal/graphics_backend.h index 87cc1ad..dd69a4e 100644 --- a/private/blah/internal/graphics_backend.h +++ b/src/internal/graphics_backend.h @@ -1,5 +1,5 @@ #pragma once -#include +#include #include #include #include diff --git a/private/blah/internal/graphics_backend_d3d11.cpp b/src/internal/graphics_backend_d3d11.cpp similarity index 99% rename from private/blah/internal/graphics_backend_d3d11.cpp rename to src/internal/graphics_backend_d3d11.cpp index c35ef19..34ac61d 100644 --- a/private/blah/internal/graphics_backend_d3d11.cpp +++ b/src/internal/graphics_backend_d3d11.cpp @@ -3,10 +3,9 @@ // TODO: // Note the D3D11 Implementation is still a work-in-progress -#include -#include -#include -#include +#include "../internal/graphics_backend.h" +#include "../internal/platform_backend.h" +#include #include #include #include diff --git a/private/blah/internal/graphics_backend_dummy.cpp b/src/internal/graphics_backend_dummy.cpp similarity index 97% rename from private/blah/internal/graphics_backend_dummy.cpp rename to src/internal/graphics_backend_dummy.cpp index 6db69cd..8e5c2dc 100644 --- a/private/blah/internal/graphics_backend_dummy.cpp +++ b/src/internal/graphics_backend_dummy.cpp @@ -1,6 +1,8 @@ #if !(defined(BLAH_USE_OPENGL) || defined(BLAH_USE_D3D11)) -#include +#include "../internal/graphics_backend.h" +#include "../internal/platform_backend.h" +#include namespace Blah { diff --git a/private/blah/internal/graphics_backend_gl.cpp b/src/internal/graphics_backend_gl.cpp similarity index 99% rename from private/blah/internal/graphics_backend_gl.cpp rename to src/internal/graphics_backend_gl.cpp index d96b3a2..be1456c 100644 --- a/private/blah/internal/graphics_backend_gl.cpp +++ b/src/internal/graphics_backend_gl.cpp @@ -1,9 +1,8 @@ #ifdef BLAH_USE_OPENGL -#include -#include -#include -#include +#include "../internal/graphics_backend.h" +#include "../internal/platform_backend.h" +#include #include #include #include diff --git a/private/blah/internal/input_backend.h b/src/internal/input_backend.h similarity index 100% rename from private/blah/internal/input_backend.h rename to src/internal/input_backend.h diff --git a/private/blah/internal/platform_backend.h b/src/internal/platform_backend.h similarity index 99% rename from private/blah/internal/platform_backend.h rename to src/internal/platform_backend.h index 8918b5e..0f2b09f 100644 --- a/private/blah/internal/platform_backend.h +++ b/src/internal/platform_backend.h @@ -1,6 +1,6 @@ #pragma once #include -#include +#include #include namespace Blah diff --git a/private/blah/internal/platform_backend_sdl2.cpp b/src/internal/platform_backend_sdl2.cpp similarity index 98% rename from private/blah/internal/platform_backend_sdl2.cpp rename to src/internal/platform_backend_sdl2.cpp index 3085455..ea51a60 100644 --- a/private/blah/internal/platform_backend_sdl2.cpp +++ b/src/internal/platform_backend_sdl2.cpp @@ -1,12 +1,12 @@ #ifdef BLAH_USE_SDL2 -#include -#include -#include +#include "../internal/platform_backend.h" +#include "../internal/input_backend.h" +#include "../internal/graphics_backend.h" #include -#include -#include -#include +#include +#include +#include #include #include diff --git a/public/blah/math/calc.cpp b/src/math/calc.cpp similarity index 100% rename from public/blah/math/calc.cpp rename to src/math/calc.cpp diff --git a/public/blah/math/circle.cpp b/src/math/circle.cpp similarity index 100% rename from public/blah/math/circle.cpp rename to src/math/circle.cpp diff --git a/public/blah/math/color.cpp b/src/math/color.cpp similarity index 100% rename from public/blah/math/color.cpp rename to src/math/color.cpp diff --git a/public/blah/math/line.cpp b/src/math/line.cpp similarity index 100% rename from public/blah/math/line.cpp rename to src/math/line.cpp diff --git a/public/blah/math/mat3x2.cpp b/src/math/mat3x2.cpp similarity index 100% rename from public/blah/math/mat3x2.cpp rename to src/math/mat3x2.cpp diff --git a/public/blah/math/mat4x4.cpp b/src/math/mat4x4.cpp similarity index 100% rename from public/blah/math/mat4x4.cpp rename to src/math/mat4x4.cpp diff --git a/public/blah/math/point.cpp b/src/math/point.cpp similarity index 100% rename from public/blah/math/point.cpp rename to src/math/point.cpp diff --git a/public/blah/math/quad.cpp b/src/math/quad.cpp similarity index 100% rename from public/blah/math/quad.cpp rename to src/math/quad.cpp diff --git a/public/blah/math/rect.cpp b/src/math/rect.cpp similarity index 100% rename from public/blah/math/rect.cpp rename to src/math/rect.cpp diff --git a/public/blah/math/rectI.cpp b/src/math/rectI.cpp similarity index 100% rename from public/blah/math/rectI.cpp rename to src/math/rectI.cpp diff --git a/public/blah/math/stopwatch.cpp b/src/math/stopwatch.cpp similarity index 100% rename from public/blah/math/stopwatch.cpp rename to src/math/stopwatch.cpp diff --git a/public/blah/math/vec2.cpp b/src/math/vec2.cpp similarity index 100% rename from public/blah/math/vec2.cpp rename to src/math/vec2.cpp diff --git a/public/blah/streams/bufferstream.cpp b/src/streams/bufferstream.cpp similarity index 100% rename from public/blah/streams/bufferstream.cpp rename to src/streams/bufferstream.cpp diff --git a/public/blah/streams/filestream.cpp b/src/streams/filestream.cpp similarity index 96% rename from public/blah/streams/filestream.cpp rename to src/streams/filestream.cpp index 822f7ba..36f5ca7 100644 --- a/public/blah/streams/filestream.cpp +++ b/src/streams/filestream.cpp @@ -1,6 +1,6 @@ #include -#include -#include +#include +#include "../internal/platform_backend.h" #include using namespace Blah; diff --git a/public/blah/streams/memorystream.cpp b/src/streams/memorystream.cpp similarity index 100% rename from public/blah/streams/memorystream.cpp rename to src/streams/memorystream.cpp diff --git a/public/blah/streams/stream.cpp b/src/streams/stream.cpp similarity index 100% rename from public/blah/streams/stream.cpp rename to src/streams/stream.cpp diff --git a/private/blah/third_party/stb_image.h b/src/third_party/stb_image.h similarity index 100% rename from private/blah/third_party/stb_image.h rename to src/third_party/stb_image.h diff --git a/private/blah/third_party/stb_image_write.h b/src/third_party/stb_image_write.h similarity index 100% rename from private/blah/third_party/stb_image_write.h rename to src/third_party/stb_image_write.h diff --git a/private/blah/third_party/stb_truetype.h b/src/third_party/stb_truetype.h similarity index 100% rename from private/blah/third_party/stb_truetype.h rename to src/third_party/stb_truetype.h