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
|
||||
|
||||
@ -32,6 +32,8 @@ add_library(${PROJECT_NAME} SHARED
|
||||
|
||||
# PUBLIC API
|
||||
|
||||
"include/export.h"
|
||||
|
||||
"include/log.hpp"
|
||||
|
||||
"include/window.hpp"
|
||||
@ -59,16 +61,18 @@ add_library(${PROJECT_NAME} SHARED
|
||||
|
||||
"include/resource_manager.hpp"
|
||||
|
||||
)
|
||||
)
|
||||
|
||||
# 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_REQUIRED ON)
|
||||
|
||||
if (MSVC)
|
||||
target_compile_options(${PROJECT_NAME} PRIVATE /W3)
|
||||
target_compile_options(${PROJECT_NAME} PRIVATE /M3)
|
||||
target_compile_options(${PROJECT_NAME} PRIVATE /MP)
|
||||
endif()
|
||||
|
||||
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
|
||||
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:
|
||||
|
||||
@ -94,11 +98,6 @@ add_subdirectory(dependencies/SDL)
|
||||
target_include_directories(${PROJECT_NAME} PUBLIC dependencies/SDL/include)
|
||||
target_link_libraries(${PROJECT_NAME} PUBLIC SDL2::SDL2)
|
||||
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:
|
||||
add_subdirectory(dependencies/glm)
|
||||
@ -124,14 +123,11 @@ add_subdirectory(dependencies/spdlog)
|
||||
target_link_libraries(${PROJECT_NAME} PUBLIC spdlog)
|
||||
target_include_directories(${PROJECT_NAME} PUBLIC dependencies/spdlog/include)
|
||||
|
||||
|
||||
|
||||
# freetype
|
||||
set(BUILD_SHARED_LIBS ON)
|
||||
add_subdirectory(dependencies/freetype)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE freetype)
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE dependencies/freetype/include)
|
||||
set(BUILD_SHARED_LIBS OFF)
|
||||
|
||||
# stb
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE dependencies/stb)
|
||||
@ -139,4 +135,3 @@ target_include_directories(${PROJECT_NAME} PRIVATE dependencies/stb)
|
||||
|
||||
|
||||
# public API:
|
||||
|
||||
|
@ -1,3 +1,3 @@
|
||||
#pragma once
|
||||
|
||||
#define SDLTEST_VERSION @PROJECT_VERSION@
|
||||
#define ENGINE_VERSION @PROJECT_VERSION@
|
||||
|
@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "export.h"
|
||||
|
||||
#include "component.hpp"
|
||||
|
||||
#include "object.hpp"
|
||||
@ -11,7 +13,7 @@
|
||||
|
||||
namespace components {
|
||||
|
||||
class Camera : public Component {
|
||||
class DECLSPEC Camera : public Component {
|
||||
|
||||
public:
|
||||
Camera(Object* parent);
|
||||
|
@ -1,11 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
#include "export.h"
|
||||
|
||||
class Object;
|
||||
class Window;
|
||||
class Input;
|
||||
class ResourceManager;
|
||||
|
||||
class Component {
|
||||
class DECLSPEC Component {
|
||||
|
||||
public:
|
||||
|
||||
|
@ -1,12 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
#include "export.h"
|
||||
|
||||
#include "component.hpp"
|
||||
|
||||
#include <glm/mat4x4.hpp>
|
||||
|
||||
namespace components {
|
||||
|
||||
class CustomComponent : public Component {
|
||||
class DECLSPEC CustomComponent : public Component {
|
||||
|
||||
public:
|
||||
CustomComponent(Object* parent);
|
||||
|
@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "export.h"
|
||||
|
||||
#include "component.hpp"
|
||||
|
||||
#include "resources/shader.hpp"
|
||||
@ -12,7 +14,7 @@
|
||||
|
||||
namespace components {
|
||||
|
||||
class Renderer : public Component {
|
||||
class DECLSPEC Renderer : public Component {
|
||||
|
||||
public:
|
||||
Renderer(Object*);
|
||||
|
@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "export.h"
|
||||
|
||||
#include "component.hpp"
|
||||
|
||||
#include "resources/font.hpp"
|
||||
@ -9,7 +11,7 @@
|
||||
|
||||
namespace components {
|
||||
|
||||
class UI : public Component {
|
||||
class DECLSPEC UI : public Component {
|
||||
|
||||
public:
|
||||
UI(Object*);
|
||||
|
@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "export.h"
|
||||
|
||||
#include "component.hpp"
|
||||
|
||||
#include <glm/mat4x4.hpp>
|
||||
@ -12,7 +14,7 @@
|
||||
|
||||
namespace components {
|
||||
|
||||
class Transform : public Component {
|
||||
class DECLSPEC Transform : public Component {
|
||||
|
||||
// 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
|
||||
|
||||
#include "export.h"
|
||||
|
||||
#include "inputs/mouse.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
|
||||
class Input {
|
||||
class DECLSPEC Input {
|
||||
|
||||
public:
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "export.h"
|
||||
|
||||
#include <glm/mat4x4.hpp>
|
||||
|
||||
#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.
|
||||
// Therefore it is safe to return raw pointers
|
||||
class Object {
|
||||
class DECLSPEC Object {
|
||||
|
||||
public:
|
||||
Object(std::string name, Object* parent, SceneRoot& root, struct GameIO things);
|
||||
|
@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "export.h"
|
||||
|
||||
#include "resources/resource.hpp"
|
||||
|
||||
#include <vector>
|
||||
@ -7,7 +9,7 @@
|
||||
|
||||
// Doesn't own resources, only holds weak_ptrs
|
||||
|
||||
class ResourceManager {
|
||||
class DECLSPEC ResourceManager {
|
||||
|
||||
public:
|
||||
ResourceManager();
|
||||
|
@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "export.h"
|
||||
|
||||
#include "resource.hpp"
|
||||
|
||||
#include <glad/glad.h>
|
||||
@ -10,7 +12,7 @@
|
||||
|
||||
namespace resources {
|
||||
|
||||
class Font : public Resource {
|
||||
class DECLSPEC Font : public Resource {
|
||||
|
||||
public:
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "export.h"
|
||||
|
||||
#include "resource.hpp"
|
||||
|
||||
#include "resources/shader.hpp"
|
||||
@ -20,7 +22,7 @@ struct Vertex {
|
||||
|
||||
namespace resources {
|
||||
|
||||
class Mesh : public Resource {
|
||||
class DECLSPEC Mesh : public Resource {
|
||||
|
||||
public:
|
||||
Mesh(const std::vector<Vertex>& vertices);
|
||||
|
@ -1,9 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include "export.h"
|
||||
|
||||
#include <string>
|
||||
#include <filesystem>
|
||||
|
||||
class Resource {
|
||||
class DECLSPEC Resource {
|
||||
|
||||
public:
|
||||
Resource(const std::filesystem::path& resPath, const std::string& type);
|
||||
|
@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "export.h"
|
||||
|
||||
#include "resource.hpp"
|
||||
|
||||
#include <glad/glad.h>
|
||||
@ -11,7 +13,7 @@
|
||||
|
||||
namespace resources {
|
||||
|
||||
class Shader : public Resource {
|
||||
class DECLSPEC Shader : public Resource {
|
||||
|
||||
public:
|
||||
Shader(const std::filesystem::path& resPath);
|
||||
|
@ -1,12 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
#include "export.h"
|
||||
|
||||
#include "resource.hpp"
|
||||
|
||||
#include <glad/glad.h>
|
||||
|
||||
namespace resources {
|
||||
|
||||
class Texture : public Resource {
|
||||
class DECLSPEC Texture : public Resource {
|
||||
|
||||
private:
|
||||
|
||||
|
@ -1,11 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
#include "export.h"
|
||||
|
||||
#include "object.hpp"
|
||||
|
||||
#include <filesystem>
|
||||
|
||||
// Holds everything you would expect to find in a game scene
|
||||
class SceneRoot : public Object {
|
||||
class DECLSPEC SceneRoot : public Object {
|
||||
|
||||
public:
|
||||
// create a new empty scene
|
||||
|
@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "export.h"
|
||||
|
||||
#include "inputs/keyboard.hpp"
|
||||
#include "inputs/mouse.hpp"
|
||||
|
||||
@ -12,9 +14,9 @@
|
||||
#include <array>
|
||||
#include <string>
|
||||
|
||||
extern const uint64_t BILLION;
|
||||
DECLSPEC extern const uint64_t BILLION;
|
||||
|
||||
class Window {
|
||||
class DECLSPEC Window {
|
||||
|
||||
public:
|
||||
Window(const std::string& title);
|
||||
|
Loading…
Reference in New Issue
Block a user