mirror of
https://github.com/bailwillharr/engine.git
synced 2024-09-21 04:51:18 +00:00
Do some stuff
This commit is contained in:
parent
aaaf52a0ba
commit
f0433f145c
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
namespace components {
|
namespace components {
|
||||||
|
|
||||||
class DECLSPEC Camera : public Component {
|
class ENGINE_API Camera : public Component {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Camera(Object* parent);
|
Camera(Object* parent);
|
||||||
|
@ -7,7 +7,7 @@ class Window;
|
|||||||
class Input;
|
class Input;
|
||||||
class ResourceManager;
|
class ResourceManager;
|
||||||
|
|
||||||
class DECLSPEC Component {
|
class ENGINE_API Component {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
namespace components {
|
namespace components {
|
||||||
|
|
||||||
class DECLSPEC CustomComponent : public Component {
|
class ENGINE_API CustomComponent : public Component {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CustomComponent(Object* parent);
|
CustomComponent(Object* parent);
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
namespace components {
|
namespace components {
|
||||||
|
|
||||||
class DECLSPEC Renderer : public Component {
|
class ENGINE_API Renderer : public Component {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Renderer(Object*);
|
Renderer(Object*);
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
namespace components {
|
namespace components {
|
||||||
|
|
||||||
class DECLSPEC UI : public Component {
|
class ENGINE_API UI : public Component {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
UI(Object*);
|
UI(Object*);
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
namespace components {
|
namespace components {
|
||||||
|
|
||||||
class DECLSPEC Transform : public Component {
|
class ENGINE_API Transform : public Component {
|
||||||
|
|
||||||
// Scale, rotate (XYZ), translate
|
// Scale, rotate (XYZ), translate
|
||||||
|
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef DECLSPEC
|
#ifndef ENGINE_API
|
||||||
# ifdef _MSC_VER
|
# ifdef _MSC_VER
|
||||||
# ifdef ENGINE_EXPORTS
|
# ifdef ENGINE_EXPORTS
|
||||||
# define DECLSPEC __declspec(dllexport)
|
# define ENGINE_API __declspec(dllexport)
|
||||||
# else
|
# else
|
||||||
# define DECLSPEC __declspec(dllimport)
|
# define ENGINE_API __declspec(dllimport)
|
||||||
# endif
|
# endif
|
||||||
# else
|
# else
|
||||||
# define DECLSPEC
|
# define ENGINE_API
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
@ -19,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 DECLSPEC Input {
|
class ENGINE_API Input {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -33,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 DECLSPEC Object {
|
class ENGINE_API 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);
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
// Doesn't own resources, only holds weak_ptrs
|
// Doesn't own resources, only holds weak_ptrs
|
||||||
|
|
||||||
class DECLSPEC ResourceManager {
|
class ENGINE_API ResourceManager {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ResourceManager();
|
ResourceManager();
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
namespace resources {
|
namespace resources {
|
||||||
|
|
||||||
class DECLSPEC Font : public Resource {
|
class ENGINE_API Font : public Resource {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ struct Vertex {
|
|||||||
|
|
||||||
namespace resources {
|
namespace resources {
|
||||||
|
|
||||||
class DECLSPEC Mesh : public Resource {
|
class ENGINE_API Mesh : public Resource {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Mesh(const std::vector<Vertex>& vertices);
|
Mesh(const std::vector<Vertex>& vertices);
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
|
|
||||||
class DECLSPEC Resource {
|
class ENGINE_API Resource {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Resource(const std::filesystem::path& resPath, const std::string& type);
|
Resource(const std::filesystem::path& resPath, const std::string& type);
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
namespace resources {
|
namespace resources {
|
||||||
|
|
||||||
class DECLSPEC Shader : public Resource {
|
class ENGINE_API Shader : public Resource {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Shader(const std::filesystem::path& resPath);
|
Shader(const std::filesystem::path& resPath);
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
namespace resources {
|
namespace resources {
|
||||||
|
|
||||||
class DECLSPEC Texture : public Resource {
|
class ENGINE_API Texture : public Resource {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
#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 DECLSPEC SceneRoot : public Object {
|
class ENGINE_API SceneRoot : public Object {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// create a new empty scene
|
// create a new empty scene
|
||||||
|
@ -14,9 +14,9 @@
|
|||||||
#include <array>
|
#include <array>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
DECLSPEC extern const uint64_t BILLION;
|
ENGINE_API extern const uint64_t BILLION;
|
||||||
|
|
||||||
class DECLSPEC Window {
|
class ENGINE_API Window {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Window(const std::string& title);
|
Window(const std::string& title);
|
||||||
|
97
renderer/CMakeLists.txt
Normal file
97
renderer/CMakeLists.txt
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.4)
|
||||||
|
|
||||||
|
# options
|
||||||
|
|
||||||
|
project(
|
||||||
|
engine_renderer
|
||||||
|
LANGUAGES CXX
|
||||||
|
VERSION "0.1.0"
|
||||||
|
)
|
||||||
|
|
||||||
|
add_library(${PROJECT_NAME} SHARED
|
||||||
|
|
||||||
|
src/renderer.cpp
|
||||||
|
|
||||||
|
# API
|
||||||
|
|
||||||
|
include/renderer.hpp
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
# compiling options:
|
||||||
|
|
||||||
|
target_compile_definitions(${PROJECT_NAME} PRIVATE DEFINITIONS "PROJECT_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 /MP)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
target_include_directories(${PROJECT_NAME} PUBLIC include)
|
||||||
|
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} PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
|
||||||
|
# libraries:
|
||||||
|
|
||||||
|
# MinGW library if using it
|
||||||
|
if (MINGW)
|
||||||
|
target_link_libraries(${PROJECT_NAME} PUBLIC mingw32)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# SDL2:
|
||||||
|
set(SDL2_DISABLE_INSTALL ON CACHE INTERNAL "" FORCE)
|
||||||
|
set(SDL_SHARED ON CACHE INTERNAL "" FORCE)
|
||||||
|
set(SDL_STATIC OFF CACHE INTERNAL "" FORCE)
|
||||||
|
set(SDL_TEST OFF CACHE INTERNAL "" FORCE)
|
||||||
|
set(BUILD_SHARED_LIBS ON)
|
||||||
|
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)
|
||||||
|
|
||||||
|
# GLM:
|
||||||
|
set(BUILD_SHARED_LIBS OFF)
|
||||||
|
add_subdirectory(dependencies/glm)
|
||||||
|
target_include_directories(${PROJECT_NAME} PUBLIC dependencies/glm)
|
||||||
|
|
||||||
|
# GLAD:
|
||||||
|
set(GLAD_PROFILE "core" CACHE INTERNAL "" FORCE)
|
||||||
|
set(GLAD_API "gl=3.3" CACHE INTERNAL "" FORCE)
|
||||||
|
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||||
|
set(GLAD_GENERATOR "c-debug" CACHE INTERNAL "" FORCE)
|
||||||
|
else()
|
||||||
|
set(GLAD_GENERATOR "c" CACHE INTERNAL "" FORCE)
|
||||||
|
endif()
|
||||||
|
set(GLAD_SPEC "gl" CACHE INTERNAL "" FORCE)
|
||||||
|
set(BUILD_SHARED_LIBS OFF)
|
||||||
|
add_subdirectory(dependencies/glad)
|
||||||
|
set_property(TARGET glad PROPERTY POSITION_INDEPENDENT_CODE ON)
|
||||||
|
target_link_libraries(${PROJECT_NAME} PUBLIC glad)
|
||||||
|
target_include_directories(${PROJECT_NAME} PUBLIC dependencies/glad/include)
|
||||||
|
|
||||||
|
# spdlog
|
||||||
|
set(SPDLOG_BUILD_SHARED ON CACHE INTERNAL "" FORCE)
|
||||||
|
set(BUILD_SHARED_LIBS ON)
|
||||||
|
add_subdirectory(dependencies/spdlog)
|
||||||
|
target_link_libraries(${PROJECT_NAME} PUBLIC spdlog)
|
||||||
|
target_include_directories(${PROJECT_NAME} PUBLIC dependencies/spdlog/include)
|
||||||
|
|
||||||
|
# freetype
|
||||||
|
set(FT_DISABLE_ZLIB TRUE CACHE INTERNAL "" FORCE)
|
||||||
|
set(FT_DISABLE_BZIP2 TRUE CACHE INTERNAL "" FORCE)
|
||||||
|
set(FT_DISABLE_PNG TRUE CACHE INTERNAL "" FORCE)
|
||||||
|
set(FT_DISABLE_HARFBUZZ TRUE CACHE INTERNAL "" FORCE)
|
||||||
|
set(FT_DISABLE_BROTLI TRUE CACHE INTERNAL "" FORCE)
|
||||||
|
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)
|
||||||
|
|
||||||
|
# stb
|
||||||
|
target_include_directories(${PROJECT_NAME} PRIVATE dependencies/stb)
|
Loading…
Reference in New Issue
Block a user