Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 10 additions & 21 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,45 +1,32 @@
cmake_minimum_required(VERSION 3.12.0)

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")

project(VulkanTutorials)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -DNOMINMAX=1")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(CMAKE_CXX_STANDARD 11)

# res data
add_definitions(-DDEMO_RES_PATH=\"${CMAKE_SOURCE_DIR}/examples/\")
add_definitions(-DNOMINMAX=1)
add_definitions(-DMONKEY_DEBUG=1)

if (WIN32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DPLATFORM_WINDOWS=1 -DMONKEY_DEBUG=1")
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
find_library(Vulkan_LIBRARY NAMES vulkan-1 HINTS "${CMAKE_SOURCE_DIR}/external/vulkan/windows/libs/x64" REQUIRED)
else (CMAKE_SIZEOF_VOID_P EQUAL 8)
find_library(Vulkan_LIBRARY NAMES vulkan-1 HINTS "${CMAKE_SOURCE_DIR}/external/vulkan/windows/libs/x86" REQUIRED)
endif (CMAKE_SIZEOF_VOID_P EQUAL 8)
add_definitions(-DPLATFORM_WINDOWS=1)
include_directories(
external/vulkan/windows/include/
)
elseif (IOS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DPLATFORM_IOS=1")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -framework Metal -framework Foundation -framework QuartzCore -framework IOKit -framework UIKit -framework IOSurface")
set(Vulkan_LIBRARY "${CMAKE_SOURCE_DIR}/external/vulkan/ios/lib/libMoltenVK.a")
include_directories(
external/vulkan/ios/include/
)
elseif (APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DPLATFORM_MAC=1 -DMONKEY_DEBUG=1")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DPLATFORM_MAC=1")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -framework Cocoa -framework QuartzCore")
set(CMAKE_XCODE_GENERATE_SCHEME ON)
set(XCODE_SCHEME_ENVIRONMENT ON)
find_library(Vulkan_LIBRARY NAMES vulkan HINTS "${CMAKE_SOURCE_DIR}/external/vulkan/macos/lib" REQUIRED)
include_directories(
external/vulkan/macos/include/
)
elseif (UNIX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DPLATFORM_LINUX=1 -DMONKEY_DEBUG=1")
find_library(Vulkan_LIBRARY NAMES vulkan HINTS "${CMAKE_SOURCE_DIR}/external/vulkan/linux/lib" REQUIRED)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DPLATFORM_LINUX=1")
include_directories(
external/vulkan/linux/include/
)
Expand All @@ -49,6 +36,8 @@ elseif (UNIX)
)
endif ()

find_package(Vulkan)

set(ALL_LIBS
${Vulkan_LIBRARY}
imgui
Expand Down
10 changes: 5 additions & 5 deletions Engine/Monkey/Application/AppModuleBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,28 +35,28 @@ class AppModuleBase

}

inline void SetSize(int32 width, int32 height)
FORCE_INLINE void SetSize(int32 width, int32 height)
{
m_Width = width;
m_Height = height;
}

inline std::shared_ptr<VulkanRHI> GetVulkanRHI() const
FORCE_INLINE std::shared_ptr<VulkanRHI> GetVulkanRHI() const
{
return Engine::Get()->GetVulkanRHI();
}

inline int32 GetWidth() const
FORCE_INLINE int32 GetWidth() const
{
return m_Width;
}

inline int32 GetHeight() const
FORCE_INLINE int32 GetHeight() const
{
return m_Height;
}

inline const std::string& GetTitle()
FORCE_INLINE const std::string& GetTitle()
{
return m_Title;
}
Expand Down
8 changes: 4 additions & 4 deletions Engine/Monkey/Application/GenericApplicationMessageHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,25 @@ struct WindowSizeLimits
{
public:

inline WindowSizeLimits& SetMinWidth(float value)
FORCE_INLINE WindowSizeLimits& SetMinWidth(float value)
{
minWidth = value;
return *this;
}

inline WindowSizeLimits& SetMinHeight(float value)
FORCE_INLINE WindowSizeLimits& SetMinHeight(float value)
{
minHeight = value;
return *this;
}

inline WindowSizeLimits& SetMaxWidth(float value)
FORCE_INLINE WindowSizeLimits& SetMaxWidth(float value)
{
maxWidth = value;
return *this;
}

inline WindowSizeLimits& SetMaxHeight(float value)
FORCE_INLINE WindowSizeLimits& SetMaxHeight(float value)
{
maxHeight = value;
return *this;
Expand Down
4 changes: 2 additions & 2 deletions Engine/Monkey/Application/GenericWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace WindowMode
NumWindowModes
};

static FORCEINLINE Type ConvertIntToWindowMode(int32 windowMode)
static FORCE_INLINE Type ConvertIntToWindowMode(int32 windowMode)
{
Type mode = Windowed;
switch (windowMode)
Expand All @@ -40,7 +40,7 @@ namespace WindowMode
return mode;
}

FORCEINLINE const char* LexToString(Type windowMode)
FORCE_INLINE const char* LexToString(Type windowMode)
{
switch (windowMode)
{
Expand Down
4 changes: 2 additions & 2 deletions Engine/Monkey/Application/Linux/LinuxWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,12 @@ class LinuxWindow : public GenericWindow
return m_WindowMode;
}

FORCEINLINE xcb_connection_t* GetConnection() const
FORCE_INLINE xcb_connection_t* GetConnection() const
{
return m_Connection;
}

FORCEINLINE xcb_intern_atom_reply_t* GetAtomWmDeleteWindow() const
FORCE_INLINE xcb_intern_atom_reply_t* GetAtomWmDeleteWindow() const
{
return m_AtomWmDeleteWindow;
}
Expand Down
10 changes: 5 additions & 5 deletions Engine/Monkey/Application/Windows/WinApplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ int32 WinApplication::ProcessMessage(HWND hwnd, uint32 msg, WPARAM wParam, LPARA
const int x = GET_X_LPARAM(lParam);
const int y = GET_Y_LPARAM(lParam);

Vector2 pos(x, y);
Vector2 pos((float)x, (float)y);

if (msg == WM_LBUTTONDOWN || msg == WM_LBUTTONUP) {
button = MouseType::MOUSE_BUTTON_LEFT;
Expand Down Expand Up @@ -146,23 +146,23 @@ int32 WinApplication::ProcessMessage(HWND hwnd, uint32 msg, WPARAM wParam, LPARA
{
const int x = GET_X_LPARAM(lParam);
const int y = GET_Y_LPARAM(lParam);
Vector2 pos(x, y);
Vector2 pos((float)x, (float)y);
m_MessageHandler->OnMouseMove(pos);
return 0;
}
case WM_MOUSEWHEEL:
{
const int x = GET_X_LPARAM(lParam);
const int y = GET_Y_LPARAM(lParam);
Vector2 pos(x, y);
Vector2 pos((float)x, (float)y);
m_MessageHandler->OnMouseWheel((float)GET_WHEEL_DELTA_WPARAM(wParam) / (float)WHEEL_DELTA, pos);
return 0;
}
case WM_MOUSEHWHEEL:
{
const int x = GET_X_LPARAM(lParam);
const int y = GET_Y_LPARAM(lParam);
Vector2 pos(x, y);
Vector2 pos((float)x, (float)y);
m_MessageHandler->OnMouseWheel((float)GET_WHEEL_DELTA_WPARAM(wParam) / (float)WHEEL_DELTA, pos);
return 0;
}
Expand All @@ -188,7 +188,7 @@ int32 WinApplication::ProcessMessage(HWND hwnd, uint32 msg, WPARAM wParam, LPARA
}
}

return DefWindowProc(hwnd, msg, wParam, lParam);
return (int32)DefWindowProc(hwnd, msg, wParam, lParam);
}

void WinApplication::SetMessageHandler(GenericApplicationMessageHandler* messageHandler)
Expand Down
4 changes: 2 additions & 2 deletions Engine/Monkey/Common/Common.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ typedef long SSIZE_T;
#define ENGINE_NAME "MONKEY"

#if PLATFORM_WINDOWS
#define FORCEINLINE __inline
#define FORCE_INLINE __inline
#define CONSTEXPR constexpr
#else
#define FORCEINLINE inline
#define FORCE_INLINE inline
#define CONSTEXPR constexpr
#endif
Loading