mirror of
https://github.com/bailwillharr/engine.git
synced 2024-09-21 04:51:18 +00:00
Change stuff
This commit is contained in:
parent
2984402f2d
commit
1b8507e21f
@ -1,4 +1,4 @@
|
|||||||
cmake_minimum_required(VERSION 3.12)
|
cmake_minimum_required(VERSION 3.4)
|
||||||
|
|
||||||
# options
|
# options
|
||||||
|
|
||||||
@ -32,6 +32,8 @@ add_library(${PROJECT_NAME} SHARED
|
|||||||
|
|
||||||
# PUBLIC API
|
# PUBLIC API
|
||||||
|
|
||||||
|
"include/export.h"
|
||||||
|
|
||||||
"include/log.hpp"
|
"include/log.hpp"
|
||||||
|
|
||||||
"include/window.hpp"
|
"include/window.hpp"
|
||||||
@ -59,16 +61,18 @@ add_library(${PROJECT_NAME} SHARED
|
|||||||
|
|
||||||
"include/resource_manager.hpp"
|
"include/resource_manager.hpp"
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# compiling options:
|
# compiling options:
|
||||||
|
|
||||||
|
target_compile_definitions(${PROJECT_NAME} PRIVATE DEFINITIONS "ENGINE_EXPORTS")
|
||||||
|
|
||||||
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 20)
|
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 20)
|
||||||
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD_REQUIRED ON)
|
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD_REQUIRED ON)
|
||||||
|
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
target_compile_options(${PROJECT_NAME} PRIVATE /W3)
|
target_compile_options(${PROJECT_NAME} PRIVATE /W3)
|
||||||
target_compile_options(${PROJECT_NAME} PRIVATE /M3)
|
target_compile_options(${PROJECT_NAME} PRIVATE /MP)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_include_directories(${PROJECT_NAME} PUBLIC include)
|
target_include_directories(${PROJECT_NAME} PUBLIC include)
|
||||||
@ -76,7 +80,7 @@ target_include_directories(${PROJECT_NAME} PRIVATE src)
|
|||||||
|
|
||||||
# Pass some project information into the source code
|
# Pass some project information into the source code
|
||||||
configure_file(config.h.in config.h)
|
configure_file(config.h.in config.h)
|
||||||
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
|
target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
|
||||||
# libraries:
|
# libraries:
|
||||||
|
|
||||||
@ -94,11 +98,6 @@ add_subdirectory(dependencies/SDL)
|
|||||||
target_include_directories(${PROJECT_NAME} PUBLIC dependencies/SDL/include)
|
target_include_directories(${PROJECT_NAME} PUBLIC dependencies/SDL/include)
|
||||||
target_link_libraries(${PROJECT_NAME} PUBLIC SDL2::SDL2)
|
target_link_libraries(${PROJECT_NAME} PUBLIC SDL2::SDL2)
|
||||||
target_link_libraries(${PROJECT_NAME} PUBLIC SDL2::SDL2main)
|
target_link_libraries(${PROJECT_NAME} PUBLIC SDL2::SDL2main)
|
||||||
# copy over SDL2 library:
|
|
||||||
add_custom_command(
|
|
||||||
TARGET ${PROJECT_NAME} PRE_BUILD
|
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
|
||||||
$<TARGET_FILE:SDL2::SDL2> $<TARGET_FILE_DIR:${PROJECT_NAME}>)
|
|
||||||
|
|
||||||
# GLM:
|
# GLM:
|
||||||
add_subdirectory(dependencies/glm)
|
add_subdirectory(dependencies/glm)
|
||||||
@ -124,19 +123,15 @@ add_subdirectory(dependencies/spdlog)
|
|||||||
target_link_libraries(${PROJECT_NAME} PUBLIC spdlog)
|
target_link_libraries(${PROJECT_NAME} PUBLIC spdlog)
|
||||||
target_include_directories(${PROJECT_NAME} PUBLIC dependencies/spdlog/include)
|
target_include_directories(${PROJECT_NAME} PUBLIC dependencies/spdlog/include)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# freetype
|
# freetype
|
||||||
set(BUILD_SHARED_LIBS ON)
|
set(BUILD_SHARED_LIBS ON)
|
||||||
add_subdirectory(dependencies/freetype)
|
add_subdirectory(dependencies/freetype)
|
||||||
target_link_libraries(${PROJECT_NAME} PRIVATE freetype)
|
target_link_libraries(${PROJECT_NAME} PRIVATE freetype)
|
||||||
target_include_directories(${PROJECT_NAME} PRIVATE dependencies/freetype/include)
|
target_include_directories(${PROJECT_NAME} PRIVATE dependencies/freetype/include)
|
||||||
set(BUILD_SHARED_LIBS OFF)
|
|
||||||
|
|
||||||
# stb
|
# stb
|
||||||
target_include_directories(${PROJECT_NAME} PRIVATE dependencies/stb)
|
target_include_directories(${PROJECT_NAME} PRIVATE dependencies/stb)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# public API:
|
# public API:
|
||||||
|
|
@ -1,3 +1,3 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#define SDLTEST_VERSION @PROJECT_VERSION@
|
#define ENGINE_VERSION @PROJECT_VERSION@
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "export.h"
|
||||||
|
|
||||||
#include "component.hpp"
|
#include "component.hpp"
|
||||||
|
|
||||||
#include "object.hpp"
|
#include "object.hpp"
|
||||||
@ -11,7 +13,7 @@
|
|||||||
|
|
||||||
namespace components {
|
namespace components {
|
||||||
|
|
||||||
class Camera : public Component {
|
class DECLSPEC Camera : public Component {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Camera(Object* parent);
|
Camera(Object* parent);
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "export.h"
|
||||||
|
|
||||||
class Object;
|
class Object;
|
||||||
class Window;
|
class Window;
|
||||||
class Input;
|
class Input;
|
||||||
class ResourceManager;
|
class ResourceManager;
|
||||||
|
|
||||||
class Component {
|
class DECLSPEC Component {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -1,12 +1,14 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "export.h"
|
||||||
|
|
||||||
#include "component.hpp"
|
#include "component.hpp"
|
||||||
|
|
||||||
#include <glm/mat4x4.hpp>
|
#include <glm/mat4x4.hpp>
|
||||||
|
|
||||||
namespace components {
|
namespace components {
|
||||||
|
|
||||||
class CustomComponent : public Component {
|
class DECLSPEC CustomComponent : public Component {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CustomComponent(Object* parent);
|
CustomComponent(Object* parent);
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "export.h"
|
||||||
|
|
||||||
#include "component.hpp"
|
#include "component.hpp"
|
||||||
|
|
||||||
#include "resources/shader.hpp"
|
#include "resources/shader.hpp"
|
||||||
@ -12,7 +14,7 @@
|
|||||||
|
|
||||||
namespace components {
|
namespace components {
|
||||||
|
|
||||||
class Renderer : public Component {
|
class DECLSPEC Renderer : public Component {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Renderer(Object*);
|
Renderer(Object*);
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "export.h"
|
||||||
|
|
||||||
#include "component.hpp"
|
#include "component.hpp"
|
||||||
|
|
||||||
#include "resources/font.hpp"
|
#include "resources/font.hpp"
|
||||||
@ -9,7 +11,7 @@
|
|||||||
|
|
||||||
namespace components {
|
namespace components {
|
||||||
|
|
||||||
class UI : public Component {
|
class DECLSPEC UI : public Component {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
UI(Object*);
|
UI(Object*);
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "export.h"
|
||||||
|
|
||||||
#include "component.hpp"
|
#include "component.hpp"
|
||||||
|
|
||||||
#include <glm/mat4x4.hpp>
|
#include <glm/mat4x4.hpp>
|
||||||
@ -12,7 +14,7 @@
|
|||||||
|
|
||||||
namespace components {
|
namespace components {
|
||||||
|
|
||||||
class Transform : public Component {
|
class DECLSPEC Transform : public Component {
|
||||||
|
|
||||||
// Scale, rotate (XYZ), translate
|
// Scale, rotate (XYZ), translate
|
||||||
|
|
||||||
|
13
include/export.h
Normal file
13
include/export.h
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef DECLSPEC
|
||||||
|
# ifdef _MSC_VER
|
||||||
|
# ifdef ENGINE_EXPORTS
|
||||||
|
# define DECLSPEC __declspec(dllexport)
|
||||||
|
# else
|
||||||
|
# define DECLSPEC __declspec(dllimport)
|
||||||
|
# endif
|
||||||
|
# else
|
||||||
|
# define DECLSPEC
|
||||||
|
# endif
|
||||||
|
#endif
|
@ -1,5 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "export.h"
|
||||||
|
|
||||||
#include "inputs/mouse.hpp"
|
#include "inputs/mouse.hpp"
|
||||||
#include "inputs/keyboard.hpp"
|
#include "inputs/keyboard.hpp"
|
||||||
|
|
||||||
@ -17,7 +19,7 @@ enum class InputDevice : int {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// This class should be used to get platform/input-device independent input
|
// This class should be used to get platform/input-device independent input
|
||||||
class Input {
|
class DECLSPEC Input {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "export.h"
|
||||||
|
|
||||||
#include <glm/mat4x4.hpp>
|
#include <glm/mat4x4.hpp>
|
||||||
|
|
||||||
#include <list>
|
#include <list>
|
||||||
@ -31,7 +33,7 @@ struct GameIO {
|
|||||||
|
|
||||||
// This object lives until it is deleted by its parent(s) or finally when the "Scene" is destroyed.
|
// This object lives until it is deleted by its parent(s) or finally when the "Scene" is destroyed.
|
||||||
// Therefore it is safe to return raw pointers
|
// Therefore it is safe to return raw pointers
|
||||||
class Object {
|
class DECLSPEC Object {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Object(std::string name, Object* parent, SceneRoot& root, struct GameIO things);
|
Object(std::string name, Object* parent, SceneRoot& root, struct GameIO things);
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "export.h"
|
||||||
|
|
||||||
#include "resources/resource.hpp"
|
#include "resources/resource.hpp"
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@ -7,7 +9,7 @@
|
|||||||
|
|
||||||
// Doesn't own resources, only holds weak_ptrs
|
// Doesn't own resources, only holds weak_ptrs
|
||||||
|
|
||||||
class ResourceManager {
|
class DECLSPEC ResourceManager {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ResourceManager();
|
ResourceManager();
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "export.h"
|
||||||
|
|
||||||
#include "resource.hpp"
|
#include "resource.hpp"
|
||||||
|
|
||||||
#include <glad/glad.h>
|
#include <glad/glad.h>
|
||||||
@ -10,7 +12,7 @@
|
|||||||
|
|
||||||
namespace resources {
|
namespace resources {
|
||||||
|
|
||||||
class Font : public Resource {
|
class DECLSPEC Font : public Resource {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "export.h"
|
||||||
|
|
||||||
#include "resource.hpp"
|
#include "resource.hpp"
|
||||||
|
|
||||||
#include "resources/shader.hpp"
|
#include "resources/shader.hpp"
|
||||||
@ -20,7 +22,7 @@ struct Vertex {
|
|||||||
|
|
||||||
namespace resources {
|
namespace resources {
|
||||||
|
|
||||||
class Mesh : public Resource {
|
class DECLSPEC Mesh : public Resource {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Mesh(const std::vector<Vertex>& vertices);
|
Mesh(const std::vector<Vertex>& vertices);
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "export.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
|
|
||||||
class Resource {
|
class DECLSPEC Resource {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Resource(const std::filesystem::path& resPath, const std::string& type);
|
Resource(const std::filesystem::path& resPath, const std::string& type);
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "export.h"
|
||||||
|
|
||||||
#include "resource.hpp"
|
#include "resource.hpp"
|
||||||
|
|
||||||
#include <glad/glad.h>
|
#include <glad/glad.h>
|
||||||
@ -11,7 +13,7 @@
|
|||||||
|
|
||||||
namespace resources {
|
namespace resources {
|
||||||
|
|
||||||
class Shader : public Resource {
|
class DECLSPEC Shader : public Resource {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Shader(const std::filesystem::path& resPath);
|
Shader(const std::filesystem::path& resPath);
|
||||||
|
@ -1,12 +1,14 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "export.h"
|
||||||
|
|
||||||
#include "resource.hpp"
|
#include "resource.hpp"
|
||||||
|
|
||||||
#include <glad/glad.h>
|
#include <glad/glad.h>
|
||||||
|
|
||||||
namespace resources {
|
namespace resources {
|
||||||
|
|
||||||
class Texture : public Resource {
|
class DECLSPEC Texture : public Resource {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "export.h"
|
||||||
|
|
||||||
#include "object.hpp"
|
#include "object.hpp"
|
||||||
|
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
|
|
||||||
// Holds everything you would expect to find in a game scene
|
// Holds everything you would expect to find in a game scene
|
||||||
class SceneRoot : public Object {
|
class DECLSPEC SceneRoot : public Object {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// create a new empty scene
|
// create a new empty scene
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "export.h"
|
||||||
|
|
||||||
#include "inputs/keyboard.hpp"
|
#include "inputs/keyboard.hpp"
|
||||||
#include "inputs/mouse.hpp"
|
#include "inputs/mouse.hpp"
|
||||||
|
|
||||||
@ -12,9 +14,9 @@
|
|||||||
#include <array>
|
#include <array>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
extern const uint64_t BILLION;
|
DECLSPEC extern const uint64_t BILLION;
|
||||||
|
|
||||||
class Window {
|
class DECLSPEC Window {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Window(const std::string& title);
|
Window(const std::string& title);
|
||||||
|
Loading…
Reference in New Issue
Block a user