Reformat platform code
This commit is contained in:
parent
3c9835a662
commit
c0928ea80c
11 changed files with 488 additions and 543 deletions
|
@ -1,23 +1,23 @@
|
||||||
if(ENABLE_WINDOWS)
|
if (ENABLE_WINDOWS)
|
||||||
add_subdirectory(sdl)
|
add_subdirectory(sdl)
|
||||||
endif()
|
endif ()
|
||||||
|
|
||||||
if(ENABLE_LINUX)
|
if (ENABLE_LINUX)
|
||||||
add_subdirectory(sdl)
|
add_subdirectory(sdl)
|
||||||
endif()
|
endif ()
|
||||||
|
|
||||||
if(ENABLE_MACOS)
|
if (ENABLE_MACOS)
|
||||||
add_subdirectory(sdl)
|
add_subdirectory(sdl)
|
||||||
endif()
|
endif ()
|
||||||
|
|
||||||
if(ENABLE_IOS)
|
if (ENABLE_IOS)
|
||||||
add_subdirectory(ios)
|
add_subdirectory(ios)
|
||||||
endif()
|
endif ()
|
||||||
|
|
||||||
if(ENABLE_TVOS)
|
if (ENABLE_TVOS)
|
||||||
add_subdirectory(tvos)
|
add_subdirectory(tvos)
|
||||||
endif()
|
endif ()
|
||||||
|
|
||||||
if(ENABLE_WEB)
|
if (ENABLE_WEB)
|
||||||
add_subdirectory(web)
|
add_subdirectory(web)
|
||||||
endif()
|
endif ()
|
|
@ -1,31 +1,31 @@
|
||||||
cmake_minimum_required(VERSION 3.7)
|
cmake_minimum_required(VERSION 3.7)
|
||||||
include(BundleUtilities)
|
include(BundleUtilities)
|
||||||
|
|
||||||
if(ENABLE_METAL)
|
if (ENABLE_METAL)
|
||||||
find_library(METAL Metal)
|
find_library(METAL Metal)
|
||||||
|
|
||||||
set(EXTRA_LIBRARIES GFXMetal ${METAL} ${EXTRA_LIBRARIES})
|
set(EXTRA_LIBRARIES GFXMetal ${METAL} ${EXTRA_LIBRARIES})
|
||||||
endif()
|
endif ()
|
||||||
|
|
||||||
if(ENABLE_VULKAN)
|
if (ENABLE_VULKAN)
|
||||||
set(EXTRA_LIBRARIES GFXVulkan ${EXTRA_LIBRARIES})
|
set(EXTRA_LIBRARIES GFXVulkan ${EXTRA_LIBRARIES})
|
||||||
endif()
|
endif ()
|
||||||
|
|
||||||
set(APP_HEADER_FILES
|
set(APP_HEADER_FILES
|
||||||
${PROJECT_SOURCE_DIR}/platforms/uikit/AppDelegate.h
|
${PROJECT_SOURCE_DIR}/platforms/uikit/AppDelegate.h
|
||||||
)
|
)
|
||||||
|
|
||||||
set(APP_SOURCE_FILES
|
set(APP_SOURCE_FILES
|
||||||
${PROJECT_SOURCE_DIR}/platforms/uikit/AppDelegate.m
|
${PROJECT_SOURCE_DIR}/platforms/uikit/AppDelegate.m
|
||||||
${PROJECT_SOURCE_DIR}/platforms/uikit/main.m
|
${PROJECT_SOURCE_DIR}/platforms/uikit/main.m
|
||||||
)
|
)
|
||||||
|
|
||||||
set(RESOURCES
|
set(RESOURCES
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/Main.storyboard
|
${CMAKE_CURRENT_SOURCE_DIR}/Main.storyboard
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/LaunchScreen.storyboard
|
${CMAKE_CURRENT_SOURCE_DIR}/LaunchScreen.storyboard
|
||||||
${CMAKE_SOURCE_DIR}/example/data
|
${CMAKE_SOURCE_DIR}/example/data
|
||||||
${CMAKE_BINARY_DIR}/bin/shaders
|
${CMAKE_BINARY_DIR}/bin/shaders
|
||||||
)
|
)
|
||||||
|
|
||||||
include(../../cmake/AddPlatformExecutable.cmake)
|
include(../../cmake/AddPlatformExecutable.cmake)
|
||||||
|
|
||||||
|
|
|
@ -1,32 +1,32 @@
|
||||||
include(../../cmake/AddPlatformExecutable.cmake)
|
include(../../cmake/AddPlatformExecutable.cmake)
|
||||||
|
|
||||||
if(ENABLE_METAL)
|
if (ENABLE_METAL)
|
||||||
find_library(METAL Metal)
|
find_library(METAL Metal)
|
||||||
|
|
||||||
set(EXTRA_LIBRARIES GFXMetal ${METAL} ${EXTRA_LIBRARIES})
|
set(EXTRA_LIBRARIES GFXMetal ${METAL} ${EXTRA_LIBRARIES})
|
||||||
set(EXTRA_SRC ${CMAKE_CURRENT_SOURCE_DIR}/sdl_metal.mm ${EXTRA_SRC})
|
set(EXTRA_SRC ${CMAKE_CURRENT_SOURCE_DIR}/sdl_metal.mm ${EXTRA_SRC})
|
||||||
endif()
|
endif ()
|
||||||
|
|
||||||
if(ENABLE_VULKAN)
|
if (ENABLE_VULKAN)
|
||||||
set(EXTRA_LIBRARIES GFXVulkan ${EXTRA_LIBRARIES})
|
set(EXTRA_LIBRARIES GFXVulkan ${EXTRA_LIBRARIES})
|
||||||
set(EXTRA_SRC ${CMAKE_CURRENT_SOURCE_DIR}/sdl_vulkan.cpp ${EXTRA_SRC})
|
set(EXTRA_SRC ${CMAKE_CURRENT_SOURCE_DIR}/sdl_vulkan.cpp ${EXTRA_SRC})
|
||||||
endif()
|
endif ()
|
||||||
|
|
||||||
if(ENABLE_DX12)
|
if (ENABLE_DX12)
|
||||||
set(EXTRA_LIBRARIES GFXDX12 ${EXTRA_LIBRARIES})
|
set(EXTRA_LIBRARIES GFXDX12 ${EXTRA_LIBRARIES})
|
||||||
endif()
|
endif ()
|
||||||
|
|
||||||
if(TARGET SDL2::SDL2)
|
if (TARGET SDL2::SDL2)
|
||||||
set(EXTRA_LIBRARIES SDL2::SDL2 ${EXTRA_LIBRARIES})
|
set(EXTRA_LIBRARIES SDL2::SDL2 ${EXTRA_LIBRARIES})
|
||||||
endif()
|
endif ()
|
||||||
|
|
||||||
if(TARGET SDL2::Main)
|
if (TARGET SDL2::Main)
|
||||||
set(EXTRA_LIBRARIES SDL2::Main ${EXTRA_LIBRARIES})
|
set(EXTRA_LIBRARIES SDL2::Main ${EXTRA_LIBRARIES})
|
||||||
endif()
|
endif ()
|
||||||
|
|
||||||
if(TARGET SDL2::SDL2main)
|
if (TARGET SDL2::SDL2main)
|
||||||
set(EXTRA_LIBRARIES SDL2::SDL2main ${EXTRA_LIBRARIES})
|
set(EXTRA_LIBRARIES SDL2::SDL2main ${EXTRA_LIBRARIES})
|
||||||
endif()
|
endif ()
|
||||||
|
|
||||||
add_platform(
|
add_platform(
|
||||||
SRC
|
SRC
|
||||||
|
@ -44,8 +44,8 @@ add_platform(
|
||||||
)
|
)
|
||||||
|
|
||||||
function(add_platform_commands target data_directory skip_data)
|
function(add_platform_commands target data_directory skip_data)
|
||||||
if(NOT skip_data)
|
if (NOT skip_data)
|
||||||
if(ENABLE_MACOS)
|
if (ENABLE_MACOS)
|
||||||
file(MAKE_DIRECTORY $<TARGET_FILE_DIR:${target}>/../Resources/game)
|
file(MAKE_DIRECTORY $<TARGET_FILE_DIR:${target}>/../Resources/game)
|
||||||
|
|
||||||
add_custom_target(${target}_copy_assets
|
add_custom_target(${target}_copy_assets
|
||||||
|
@ -57,7 +57,7 @@ function(add_platform_commands target data_directory skip_data)
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_BINARY_DIR}/bin/base $<TARGET_FILE_DIR:${target}>/../Resources/base)
|
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_BINARY_DIR}/bin/base $<TARGET_FILE_DIR:${target}>/../Resources/base)
|
||||||
|
|
||||||
add_dependencies(${target} ${target}_copy_assets ${target}_copy_base)
|
add_dependencies(${target} ${target}_copy_assets ${target}_copy_base)
|
||||||
else()
|
else ()
|
||||||
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/bin/game)
|
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/bin/game)
|
||||||
|
|
||||||
add_custom_target(${target}_copy_assets
|
add_custom_target(${target}_copy_assets
|
||||||
|
@ -65,6 +65,6 @@ function(add_platform_commands target data_directory skip_data)
|
||||||
)
|
)
|
||||||
|
|
||||||
add_dependencies(${target} ${target}_copy_assets)
|
add_dependencies(${target} ${target}_copy_assets)
|
||||||
endif()
|
endif ()
|
||||||
endif()
|
endif ()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include <@APP_INCLUDE@>
|
#include <@APP_INCLUDE@>
|
||||||
#include <engine.hpp>
|
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
#include <engine.hpp>
|
||||||
|
|
||||||
#include "platform.hpp"
|
#include "platform.hpp"
|
||||||
#include <string_utils.hpp>
|
#include <string_utils.hpp>
|
||||||
|
@ -9,25 +9,25 @@
|
||||||
#include <SDL_vulkan.h>
|
#include <SDL_vulkan.h>
|
||||||
|
|
||||||
#ifdef ENABLE_DX12
|
#ifdef ENABLE_DX12
|
||||||
#include "gfx_dx12.hpp"
|
#include "gfx_dx12.hpp"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_VULKAN
|
#ifdef ENABLE_VULKAN
|
||||||
#include "gfx_vulkan.hpp"
|
#include "gfx_vulkan.hpp"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_METAL
|
#ifdef ENABLE_METAL
|
||||||
#include "gfx_metal.hpp"
|
#include "gfx_metal.hpp"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "gfx_dummy.hpp"
|
#include "gfx_dummy.hpp"
|
||||||
|
|
||||||
#if defined(PLATFORM_WINDOWS) && !defined(__MINGW32__)
|
#if defined(PLATFORM_WINDOWS) && !defined(__MINGW32__)
|
||||||
#include <winrt/Windows.UI.ViewManagement.h>
|
#include <winrt/Windows.UI.ViewManagement.h>
|
||||||
#pragma comment(lib, "windowsapp")
|
#pragma comment(lib, "windowsapp")
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@APP_CLASS@* app = nullptr;
|
@APP_CLASS@ * app = nullptr;
|
||||||
GFX* gfx_interface = nullptr;
|
GFX* gfx_interface = nullptr;
|
||||||
|
|
||||||
std::vector<SDL_Window*> windows;
|
std::vector<SDL_Window*> windows;
|
||||||
|
@ -35,8 +35,8 @@ std::map<SDL_Window*, SDL_Renderer*> renderers;
|
||||||
SDL_Window* main_window = nullptr;
|
SDL_Window* main_window = nullptr;
|
||||||
|
|
||||||
extern "C" SDL_Window* get_window(const platform::window_ptr index) {
|
extern "C" SDL_Window* get_window(const platform::window_ptr index) {
|
||||||
for(auto& window : windows) {
|
for (auto& window : windows) {
|
||||||
if(window == index)
|
if (window == index)
|
||||||
return window;
|
return window;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,8 +44,8 @@ extern "C" SDL_Window* get_window(const platform::window_ptr index) {
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_Window* get_window_by_sdl_id(const Uint32 id) {
|
SDL_Window* get_window_by_sdl_id(const Uint32 id) {
|
||||||
for(auto& window : windows) {
|
for (auto& window : windows) {
|
||||||
if(SDL_GetWindowID(window) == id)
|
if (SDL_GetWindowID(window) == id)
|
||||||
return window;
|
return window;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,8 +61,8 @@ void* get_next_metal_drawable(platform::window_ptr window);
|
||||||
void* create_vulkan_surface(platform::window_ptr window, void* surface_creation_info);
|
void* create_vulkan_surface(platform::window_ptr window, void* surface_creation_info);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static std::map<InputButton, int> inputToKeyCode = { {
|
static std::map<InputButton, int> inputToKeyCode = {
|
||||||
{InputButton::C, SDL_SCANCODE_C},
|
{{InputButton::C, SDL_SCANCODE_C},
|
||||||
{InputButton::V, SDL_SCANCODE_V},
|
{InputButton::V, SDL_SCANCODE_V},
|
||||||
{InputButton::X, SDL_SCANCODE_X},
|
{InputButton::X, SDL_SCANCODE_X},
|
||||||
{InputButton::Y, SDL_SCANCODE_Y},
|
{InputButton::Y, SDL_SCANCODE_Y},
|
||||||
|
@ -82,8 +82,7 @@ static std::map<InputButton, int> inputToKeyCode = { {
|
||||||
{InputButton::Ctrl, SDL_SCANCODE_LCTRL},
|
{InputButton::Ctrl, SDL_SCANCODE_LCTRL},
|
||||||
{InputButton::Space, SDL_SCANCODE_SPACE},
|
{InputButton::Space, SDL_SCANCODE_SPACE},
|
||||||
{InputButton::LeftArrow, SDL_SCANCODE_LEFT},
|
{InputButton::LeftArrow, SDL_SCANCODE_LEFT},
|
||||||
{InputButton::RightArrow, SDL_SCANCODE_RIGHT}
|
{InputButton::RightArrow, SDL_SCANCODE_RIGHT}}};
|
||||||
}};
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Platform functions"
|
* Platform functions"
|
||||||
|
@ -94,26 +93,27 @@ const char* platform::get_name() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool platform::supports_feature(const PlatformFeature feature) {
|
bool platform::supports_feature(const PlatformFeature feature) {
|
||||||
if(feature == PlatformFeature::Windowing)
|
if (feature == PlatformFeature::Windowing)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
platform::window_ptr platform::open_window(const std::string_view title, const prism::Rectangle rect, const WindowFlags flags) {
|
platform::window_ptr
|
||||||
|
platform::open_window(const std::string_view title, const prism::Rectangle rect, const WindowFlags flags) {
|
||||||
auto& win = windows.emplace_back();
|
auto& win = windows.emplace_back();
|
||||||
|
|
||||||
int sdl_flags = SDL_WINDOW_ALLOW_HIGHDPI;
|
int sdl_flags = SDL_WINDOW_ALLOW_HIGHDPI;
|
||||||
if(gfx_interface->required_context() == GFXContext::Vulkan)
|
if (gfx_interface->required_context() == GFXContext::Vulkan)
|
||||||
sdl_flags |= SDL_WINDOW_VULKAN;
|
sdl_flags |= SDL_WINDOW_VULKAN;
|
||||||
|
|
||||||
if(flags & WindowFlags::Borderless)
|
if (flags & WindowFlags::Borderless)
|
||||||
sdl_flags |= SDL_WINDOW_BORDERLESS;
|
sdl_flags |= SDL_WINDOW_BORDERLESS;
|
||||||
|
|
||||||
if(flags & WindowFlags::Resizable)
|
if (flags & WindowFlags::Resizable)
|
||||||
sdl_flags |= SDL_WINDOW_RESIZABLE;
|
sdl_flags |= SDL_WINDOW_RESIZABLE;
|
||||||
|
|
||||||
if(flags & WindowFlags::Hidden)
|
if (flags & WindowFlags::Hidden)
|
||||||
sdl_flags |= SDL_WINDOW_HIDDEN;
|
sdl_flags |= SDL_WINDOW_HIDDEN;
|
||||||
|
|
||||||
auto resolution = platform::get_monitor_resolution();
|
auto resolution = platform::get_monitor_resolution();
|
||||||
|
@ -121,28 +121,28 @@ platform::window_ptr platform::open_window(const std::string_view title, const p
|
||||||
int real_x = rect.offset.x;
|
int real_x = rect.offset.x;
|
||||||
int real_y = rect.offset.y;
|
int real_y = rect.offset.y;
|
||||||
|
|
||||||
if(rect.offset.x <= -1 || rect.offset.x > resolution.extent.width)
|
if (rect.offset.x <= -1 || rect.offset.x > resolution.extent.width)
|
||||||
real_x = SDL_WINDOWPOS_CENTERED;
|
real_x = SDL_WINDOWPOS_CENTERED;
|
||||||
|
|
||||||
if(rect.offset.y <= -1 || rect.offset.x > resolution.extent.height)
|
if (rect.offset.y <= -1 || rect.offset.x > resolution.extent.height)
|
||||||
real_y = SDL_WINDOWPOS_CENTERED;
|
real_y = SDL_WINDOWPOS_CENTERED;
|
||||||
|
|
||||||
int real_width = rect.extent.width;
|
int real_width = rect.extent.width;
|
||||||
int real_height = rect.extent.height;
|
int real_height = rect.extent.height;
|
||||||
|
|
||||||
if(rect.extent.width <= -1 || rect.extent.width > resolution.extent.width)
|
if (rect.extent.width <= -1 || rect.extent.width > resolution.extent.width)
|
||||||
real_width = 640;
|
real_width = 640;
|
||||||
|
|
||||||
if(rect.extent.height <= -1 || rect.extent.height > resolution.extent.height)
|
if (rect.extent.height <= -1 || rect.extent.height > resolution.extent.height)
|
||||||
real_height = 480;
|
real_height = 480;
|
||||||
|
|
||||||
win = SDL_CreateWindow(title.data(), real_x, real_y, real_width, real_height, sdl_flags);
|
win = SDL_CreateWindow(title.data(), real_x, real_y, real_width, real_height, sdl_flags);
|
||||||
|
|
||||||
if(windows.size() == 1)
|
if (windows.size() == 1)
|
||||||
main_window = win;
|
main_window = win;
|
||||||
|
|
||||||
#ifdef ENABLE_METAL
|
#ifdef ENABLE_METAL
|
||||||
if(gfx_interface->required_context() == GFXContext::Metal) {
|
if (gfx_interface->required_context() == GFXContext::Metal) {
|
||||||
SDL_Renderer* renderer = SDL_CreateRenderer(win, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
|
SDL_Renderer* renderer = SDL_CreateRenderer(win, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
|
||||||
renderers[win] = renderer;
|
renderers[win] = renderer;
|
||||||
}
|
}
|
||||||
|
@ -256,7 +256,7 @@ void platform::show_window(const platform::window_ptr index) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool platform::get_key_down(const InputButton key) {
|
bool platform::get_key_down(const InputButton key) {
|
||||||
const Uint8 *state = SDL_GetKeyboardState(NULL);
|
const Uint8* state = SDL_GetKeyboardState(NULL);
|
||||||
|
|
||||||
return state[inputToKeyCode[key]] && state[SDL_SCANCODE_DOWN];
|
return state[inputToKeyCode[key]] && state[SDL_SCANCODE_DOWN];
|
||||||
}
|
}
|
||||||
|
@ -281,7 +281,7 @@ prism::Offset platform::get_screen_cursor_position() {
|
||||||
|
|
||||||
bool platform::get_mouse_button_down(const int button) {
|
bool platform::get_mouse_button_down(const int button) {
|
||||||
Uint8 sdl_button = SDL_BUTTON_LEFT;
|
Uint8 sdl_button = SDL_BUTTON_LEFT;
|
||||||
switch(button) {
|
switch (button) {
|
||||||
case 0:
|
case 0:
|
||||||
sdl_button = SDL_BUTTON_LEFT;
|
sdl_button = SDL_BUTTON_LEFT;
|
||||||
break;
|
break;
|
||||||
|
@ -324,21 +324,21 @@ void platform::end_text_input() {
|
||||||
|
|
||||||
bool platform::supports_context(GFXContext context) {
|
bool platform::supports_context(GFXContext context) {
|
||||||
#ifdef ENABLE_DX12
|
#ifdef ENABLE_DX12
|
||||||
if(context == GFXContext::DirectX)
|
if (context == GFXContext::DirectX)
|
||||||
return true;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_VULKAN
|
#ifdef ENABLE_VULKAN
|
||||||
if(context == GFXContext::Vulkan)
|
if (context == GFXContext::Vulkan)
|
||||||
return true;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_METAL
|
#ifdef ENABLE_METAL
|
||||||
if(context == GFXContext::Metal)
|
if (context == GFXContext::Metal)
|
||||||
return true;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(context == GFXContext::None)
|
if (context == GFXContext::None)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -346,13 +346,13 @@ bool platform::supports_context(GFXContext context) {
|
||||||
|
|
||||||
void platform::initialize_context(const GFXContext context) {
|
void platform::initialize_context(const GFXContext context) {
|
||||||
#ifdef ENABLE_METAL
|
#ifdef ENABLE_METAL
|
||||||
if(context == GFXContext::Metal) {
|
if (context == GFXContext::Metal) {
|
||||||
SDL_SetHint(SDL_HINT_RENDER_DRIVER, "metal");
|
SDL_SetHint(SDL_HINT_RENDER_DRIVER, "metal");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_VULKAN
|
#ifdef ENABLE_VULKAN
|
||||||
if(context == GFXContext::Vulkan) {
|
if (context == GFXContext::Vulkan) {
|
||||||
SDL_Vulkan_LoadLibrary(nullptr);
|
SDL_Vulkan_LoadLibrary(nullptr);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -360,7 +360,7 @@ void platform::initialize_context(const GFXContext context) {
|
||||||
|
|
||||||
void* platform::get_context_information() {
|
void* platform::get_context_information() {
|
||||||
#ifdef ENABLE_VULKAN
|
#ifdef ENABLE_VULKAN
|
||||||
if(gfx_interface->required_context() == GFXContext::Vulkan) {
|
if (gfx_interface->required_context() == GFXContext::Vulkan) {
|
||||||
unsigned int count = 0;
|
unsigned int count = 0;
|
||||||
SDL_Vulkan_GetInstanceExtensions(nullptr, &count, nullptr);
|
SDL_Vulkan_GetInstanceExtensions(nullptr, &count, nullptr);
|
||||||
|
|
||||||
|
@ -379,13 +379,13 @@ void* platform::get_context_information() {
|
||||||
|
|
||||||
void* platform::create_surface(window_ptr window, void* surface_creation_info) {
|
void* platform::create_surface(window_ptr window, void* surface_creation_info) {
|
||||||
#ifdef ENABLE_VULKAN
|
#ifdef ENABLE_VULKAN
|
||||||
if(gfx_interface->required_context() == GFXContext::Vulkan) {
|
if (gfx_interface->required_context() == GFXContext::Vulkan) {
|
||||||
return create_vulkan_surface(window, surface_creation_info);
|
return create_vulkan_surface(window, surface_creation_info);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_METAL
|
#ifdef ENABLE_METAL
|
||||||
if(gfx_interface->required_context() == GFXContext::Metal) {
|
if (gfx_interface->required_context() == GFXContext::Metal) {
|
||||||
return create_metal_surface(window, surface_creation_info);
|
return create_metal_surface(window, surface_creation_info);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -395,7 +395,7 @@ void* platform::create_surface(window_ptr window, void* surface_creation_info) {
|
||||||
|
|
||||||
void* platform::get_next_image(window_ptr window) {
|
void* platform::get_next_image(window_ptr window) {
|
||||||
#ifdef ENABLE_METAL
|
#ifdef ENABLE_METAL
|
||||||
if(gfx_interface->required_context() == GFXContext::Metal) {
|
if (gfx_interface->required_context() == GFXContext::Metal) {
|
||||||
return get_next_metal_drawable(window);
|
return get_next_metal_drawable(window);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -403,12 +403,11 @@ void* platform::get_next_image(window_ptr window) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class GFXBackend>
|
template<class GFXBackend> void try_initialize() {
|
||||||
void try_initialize() {
|
if (gfx_interface == nullptr) {
|
||||||
if(gfx_interface == nullptr) {
|
|
||||||
auto backend = new GFXBackend();
|
auto backend = new GFXBackend();
|
||||||
const bool supported = backend->is_supported() && platform::supports_context(backend->required_context());
|
const bool supported = backend->is_supported() && platform::supports_context(backend->required_context());
|
||||||
if(!supported) {
|
if (!supported) {
|
||||||
prism::log("Failed to initialize GFX backend... trying next...");
|
prism::log("Failed to initialize GFX backend... trying next...");
|
||||||
} else {
|
} else {
|
||||||
gfx_interface = backend;
|
gfx_interface = backend;
|
||||||
|
@ -433,39 +432,39 @@ int main(int argc, char* argv[]) {
|
||||||
|
|
||||||
// determine gfx context at the beginning
|
// determine gfx context at the beginning
|
||||||
#ifdef ENABLE_DX12
|
#ifdef ENABLE_DX12
|
||||||
gfx_backend_order.emplace_back(gfx_backend_initializer{"dx12", []{
|
gfx_backend_order.emplace_back(gfx_backend_initializer{"dx12", [] {
|
||||||
try_initialize<gfx_dx12>();
|
try_initialize<gfx_dx12>();
|
||||||
}});
|
}});
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_METAL
|
#ifdef ENABLE_METAL
|
||||||
gfx_backend_order.emplace_back(gfx_backend_initializer{"metal", []{
|
gfx_backend_order.emplace_back(gfx_backend_initializer{"metal", [] {
|
||||||
try_initialize<GFXMetal>();
|
try_initialize<GFXMetal>();
|
||||||
}});
|
}});
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_VULKAN
|
#ifdef ENABLE_VULKAN
|
||||||
gfx_backend_order.emplace_back(gfx_backend_initializer{"vulkan", []{
|
gfx_backend_order.emplace_back(gfx_backend_initializer{"vulkan", [] {
|
||||||
try_initialize<GFXVulkan>();
|
try_initialize<GFXVulkan>();
|
||||||
}});
|
}});
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
gfx_backend_order.emplace_back(gfx_backend_initializer{"dummy", []{
|
gfx_backend_order.emplace_back(gfx_backend_initializer{"dummy", [] {
|
||||||
try_initialize<GFXDummy>();
|
try_initialize<GFXDummy>();
|
||||||
}});
|
}});
|
||||||
|
|
||||||
for(auto arg : engine->command_line_arguments) {
|
for (auto arg : engine->command_line_arguments) {
|
||||||
utility::move_to_front(gfx_backend_order, [arg](gfx_backend_initializer& init) {
|
utility::move_to_front(gfx_backend_order, [arg](gfx_backend_initializer& init) {
|
||||||
return arg == "-" + std::string(init.name);
|
return arg == "-" + std::string(init.name);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
for(auto backend : gfx_backend_order) {
|
for (auto backend : gfx_backend_order) {
|
||||||
backend.init_func();
|
backend.init_func();
|
||||||
}
|
}
|
||||||
|
|
||||||
GFXCreateInfo info = {};
|
GFXCreateInfo info = {};
|
||||||
if(gfx_interface->initialize(info)) {
|
if (gfx_interface->initialize(info)) {
|
||||||
engine->set_gfx(gfx_interface);
|
engine->set_gfx(gfx_interface);
|
||||||
} else {
|
} else {
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -481,74 +480,66 @@ int main(int argc, char* argv[]) {
|
||||||
|
|
||||||
auto end = std::chrono::high_resolution_clock::now();
|
auto end = std::chrono::high_resolution_clock::now();
|
||||||
|
|
||||||
while(!engine->is_quitting()) {
|
while (!engine->is_quitting()) {
|
||||||
SDL_Event event = {};
|
SDL_Event event = {};
|
||||||
while(SDL_PollEvent(&event)) {
|
while (SDL_PollEvent(&event)) {
|
||||||
switch(event.type) {
|
switch (event.type) {
|
||||||
case SDL_QUIT:
|
case SDL_QUIT:
|
||||||
engine->quit();
|
engine->quit();
|
||||||
break;
|
break;
|
||||||
case SDL_MOUSEWHEEL: {
|
case SDL_MOUSEWHEEL: {
|
||||||
mouse_wheel_x = event.wheel.x;
|
mouse_wheel_x = event.wheel.x;
|
||||||
mouse_wheel_y = event.wheel.y;
|
mouse_wheel_y = event.wheel.y;
|
||||||
}
|
} break;
|
||||||
break;
|
case SDL_MOUSEBUTTONDOWN: {
|
||||||
case SDL_MOUSEBUTTONDOWN:
|
|
||||||
{
|
|
||||||
int engine_button = 0;
|
int engine_button = 0;
|
||||||
if(event.button.button == SDL_BUTTON_RIGHT)
|
if (event.button.button == SDL_BUTTON_RIGHT)
|
||||||
engine_button = 1;
|
engine_button = 1;
|
||||||
else if(event.button.button == SDL_BUTTON_MIDDLE)
|
else if (event.button.button == SDL_BUTTON_MIDDLE)
|
||||||
engine_button = 2;
|
engine_button = 2;
|
||||||
|
|
||||||
engine->process_mouse_down(engine_button, {0, 0});
|
engine->process_mouse_down(engine_button, {0, 0});
|
||||||
}
|
} break;
|
||||||
break;
|
case SDL_KEYDOWN: {
|
||||||
case SDL_KEYDOWN:
|
|
||||||
{
|
|
||||||
engine->process_key_down(event.key.keysym.scancode);
|
engine->process_key_down(event.key.keysym.scancode);
|
||||||
}
|
} break;
|
||||||
break;
|
case SDL_KEYUP: {
|
||||||
case SDL_KEYUP:
|
|
||||||
{
|
|
||||||
engine->process_key_up(event.key.keysym.scancode);
|
engine->process_key_up(event.key.keysym.scancode);
|
||||||
}
|
} break;
|
||||||
break;
|
case SDL_WINDOWEVENT: {
|
||||||
case SDL_WINDOWEVENT:
|
|
||||||
{
|
|
||||||
if (event.window.event == SDL_WINDOWEVENT_RESIZED) {
|
if (event.window.event == SDL_WINDOWEVENT_RESIZED) {
|
||||||
auto window = get_window_by_sdl_id(event.window.windowID);
|
auto window = get_window_by_sdl_id(event.window.windowID);
|
||||||
if(window != nullptr)
|
if (window != nullptr)
|
||||||
engine->resize(window, {static_cast<uint32_t>(event.window.data1), static_cast<uint32_t>(event.window.data2)});
|
engine->resize(
|
||||||
} else if(event.window.event == SDL_WINDOWEVENT_MOVED) {
|
window,
|
||||||
|
{static_cast<uint32_t>(event.window.data1), static_cast<uint32_t>(event.window.data2)});
|
||||||
|
} else if (event.window.event == SDL_WINDOWEVENT_MOVED) {
|
||||||
auto window = get_window_by_sdl_id(event.window.windowID);
|
auto window = get_window_by_sdl_id(event.window.windowID);
|
||||||
if(window != nullptr)
|
if (window != nullptr)
|
||||||
engine->move(window);
|
engine->move(window);
|
||||||
} else if(event.window.event == SDL_WINDOWEVENT_CLOSE) {
|
} else if (event.window.event == SDL_WINDOWEVENT_CLOSE) {
|
||||||
engine->quit();
|
engine->quit();
|
||||||
}
|
}
|
||||||
}
|
} break;
|
||||||
break;
|
case SDL_TEXTINPUT: {
|
||||||
case SDL_TEXTINPUT:
|
|
||||||
{
|
|
||||||
engine->process_text_input(event.text.text);
|
engine->process_text_input(event.text.text);
|
||||||
}
|
} break;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(engine->is_quitting())
|
if (engine->is_quitting())
|
||||||
break;
|
break;
|
||||||
|
|
||||||
auto begin = std::chrono::high_resolution_clock::now();
|
auto begin = std::chrono::high_resolution_clock::now();
|
||||||
|
|
||||||
float deltatime = (float)std::chrono::duration_cast<std::chrono::nanoseconds>(begin - end).count() / 1000000000ULL;
|
float deltatime =
|
||||||
|
(float)std::chrono::duration_cast<std::chrono::nanoseconds>(begin - end).count() / 1000000000ULL;
|
||||||
end = begin;
|
end = begin;
|
||||||
|
|
||||||
engine->update(deltatime);
|
engine->update(deltatime);
|
||||||
engine->begin_frame(deltatime);
|
engine->begin_frame(deltatime);
|
||||||
|
|
||||||
for(auto window : windows)
|
for (auto window : windows)
|
||||||
engine->render(window);
|
engine->render(window);
|
||||||
|
|
||||||
engine->end_frame();
|
engine->end_frame();
|
||||||
|
|
|
@ -1,22 +1,22 @@
|
||||||
cmake_minimum_required (VERSION 3.7)
|
cmake_minimum_required(VERSION 3.7)
|
||||||
|
|
||||||
include(BundleUtilities)
|
include(BundleUtilities)
|
||||||
|
|
||||||
set(APP_HEADER_FILES
|
set(APP_HEADER_FILES
|
||||||
${PROJECT_SOURCE_DIR}/platforms/uikit/AppDelegate.h
|
${PROJECT_SOURCE_DIR}/platforms/uikit/AppDelegate.h
|
||||||
)
|
)
|
||||||
|
|
||||||
set(APP_SOURCE_FILES
|
set(APP_SOURCE_FILES
|
||||||
${PROJECT_SOURCE_DIR}/platforms/uikit/AppDelegate.m
|
${PROJECT_SOURCE_DIR}/platforms/uikit/AppDelegate.m
|
||||||
${PROJECT_SOURCE_DIR}/platforms/uikit/main.m
|
${PROJECT_SOURCE_DIR}/platforms/uikit/main.m
|
||||||
)
|
)
|
||||||
|
|
||||||
set(RESOURCES
|
set(RESOURCES
|
||||||
${PROJECT_SOURCE_DIR}/platforms/tvos/Main.storyboard
|
${PROJECT_SOURCE_DIR}/platforms/tvos/Main.storyboard
|
||||||
${PROJECT_SOURCE_DIR}/platforms/tvos/LaunchScreen.storyboard
|
${PROJECT_SOURCE_DIR}/platforms/tvos/LaunchScreen.storyboard
|
||||||
${CMAKE_SOURCE_DIR}/data
|
${CMAKE_SOURCE_DIR}/data
|
||||||
${CMAKE_BINARY_DIR}/shaders
|
${CMAKE_BINARY_DIR}/shaders
|
||||||
)
|
)
|
||||||
|
|
||||||
include(../../cmake/AddPlatformExecutable.cmake)
|
include(../../cmake/AddPlatformExecutable.cmake)
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,6 @@
|
||||||
|
|
||||||
@interface AppDelegate : UIResponder <UIApplicationDelegate>
|
@interface AppDelegate : UIResponder <UIApplicationDelegate>
|
||||||
|
|
||||||
@property (strong, nonatomic) UIWindow *window;
|
@property(strong, nonatomic) UIWindow* window;
|
||||||
|
|
||||||
@end
|
@end
|
|
@ -1,30 +1,30 @@
|
||||||
#define VK_USE_PLATFORM_METAL_EXT
|
#define VK_USE_PLATFORM_METAL_EXT
|
||||||
|
|
||||||
#include <MetalKit/MetalKit.h>
|
|
||||||
#include <GameController/GameController.h>
|
|
||||||
#import "QuartzCore/QuartzCore.hpp"
|
#import "QuartzCore/QuartzCore.hpp"
|
||||||
|
#include <GameController/GameController.h>
|
||||||
|
#include <MetalKit/MetalKit.h>
|
||||||
|
|
||||||
#import <UIKit/UIKit.h>
|
#import <UIKit/UIKit.h>
|
||||||
|
|
||||||
#include <engine.hpp>
|
|
||||||
#include <@APP_INCLUDE@>
|
#include <@APP_INCLUDE@>
|
||||||
|
#include <engine.hpp>
|
||||||
|
|
||||||
#ifdef ENABLE_VULKAN
|
#ifdef ENABLE_VULKAN
|
||||||
#ifdef PLATFORM_IOS
|
#ifdef PLATFORM_IOS
|
||||||
#define VK_USE_PLATFORM_IOS_MVK
|
#define VK_USE_PLATFORM_IOS_MVK
|
||||||
#else
|
#else
|
||||||
#define VK_USE_PLATFORM_TVOS_MVK
|
#define VK_USE_PLATFORM_TVOS_MVK
|
||||||
#endif
|
#endif
|
||||||
#include "gfx_vulkan.hpp"
|
#include "gfx_vulkan.hpp"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_METAL
|
#ifdef ENABLE_METAL
|
||||||
#include "gfx_metal.hpp"
|
#include "gfx_metal.hpp"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "gfx_dummy.hpp"
|
#include "gfx_dummy.hpp"
|
||||||
|
|
||||||
@APP_CLASS@* app = nullptr;
|
@APP_CLASS@ * app = nullptr;
|
||||||
GFX* gfx_interface = nullptr;
|
GFX* gfx_interface = nullptr;
|
||||||
|
|
||||||
int maxFPS = 60;
|
int maxFPS = 60;
|
||||||
|
@ -48,7 +48,7 @@ void* create_vulkan_surface(platform::window_ptr window, void* surface_creation_
|
||||||
|
|
||||||
@implementation GameView
|
@implementation GameView
|
||||||
|
|
||||||
+ (Class) layerClass {
|
+ (Class)layerClass {
|
||||||
return [CAMetalLayer class];
|
return [CAMetalLayer class];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,11 +59,12 @@ void* create_vulkan_surface(platform::window_ptr window, void* surface_creation_
|
||||||
engine->end_frame();
|
engine->end_frame();
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) controllerConnected {
|
- (void)controllerConnected {
|
||||||
GCController* controller = [GCController controllers][0];
|
GCController* controller = [GCController controllers][0];
|
||||||
[[controller extendedGamepad] setValueChangedHandler:^(GCExtendedGamepad * _Nonnull gamepad, GCControllerElement * _Nonnull element) {
|
[[controller extendedGamepad]
|
||||||
|
setValueChangedHandler:^(GCExtendedGamepad* _Nonnull gamepad, GCControllerElement* _Nonnull element) {
|
||||||
const auto& handle_element = [element](int index, GCControllerElement* e) {
|
const auto& handle_element = [element](int index, GCControllerElement* e) {
|
||||||
if(element == e)
|
if (element == e)
|
||||||
inputKeys[index] = [(GCControllerButtonInput*)e value] == 1.0f;
|
inputKeys[index] = [(GCControllerButtonInput*)e value] == 1.0f;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -72,19 +73,19 @@ void* create_vulkan_surface(platform::window_ptr window, void* surface_creation_
|
||||||
handle_element(2, [[controller extendedGamepad] buttonX]);
|
handle_element(2, [[controller extendedGamepad] buttonX]);
|
||||||
handle_element(3, [[controller extendedGamepad] buttonY]);
|
handle_element(3, [[controller extendedGamepad] buttonY]);
|
||||||
|
|
||||||
if(element == [[controller extendedGamepad] dpad]) {
|
if (element == [[controller extendedGamepad] dpad]) {
|
||||||
inputKeys[4] = [[[[controller extendedGamepad] dpad] up] value] == 1.0f;
|
inputKeys[4] = [[[[controller extendedGamepad] dpad] up] value] == 1.0f;
|
||||||
inputKeys[5] = [[[[controller extendedGamepad] dpad] down] value] == 1.0f;
|
inputKeys[5] = [[[[controller extendedGamepad] dpad] down] value] == 1.0f;
|
||||||
inputKeys[6] = [[[[controller extendedGamepad] dpad] left] value] == 1.0f;
|
inputKeys[6] = [[[[controller extendedGamepad] dpad] left] value] == 1.0f;
|
||||||
inputKeys[7] = [[[[controller extendedGamepad] dpad] right] value] == 1.0f;
|
inputKeys[7] = [[[[controller extendedGamepad] dpad] right] value] == 1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(element == [[controller extendedGamepad] leftThumbstick]) {
|
if (element == [[controller extendedGamepad] leftThumbstick]) {
|
||||||
leftX = [[[[controller extendedGamepad] leftThumbstick] xAxis] value];
|
leftX = [[[[controller extendedGamepad] leftThumbstick] xAxis] value];
|
||||||
leftY = [[[[controller extendedGamepad] leftThumbstick] yAxis] value];
|
leftY = [[[[controller extendedGamepad] leftThumbstick] yAxis] value];
|
||||||
}
|
}
|
||||||
|
|
||||||
if(element == [[controller extendedGamepad] rightThumbstick]) {
|
if (element == [[controller extendedGamepad] rightThumbstick]) {
|
||||||
rightX = [[[[controller extendedGamepad] rightThumbstick] xAxis] value];
|
rightX = [[[[controller extendedGamepad] rightThumbstick] xAxis] value];
|
||||||
rightY = [[[[controller extendedGamepad] rightThumbstick] yAxis] value];
|
rightY = [[[[controller extendedGamepad] rightThumbstick] yAxis] value];
|
||||||
}
|
}
|
||||||
|
@ -100,17 +101,17 @@ void* create_vulkan_surface(platform::window_ptr window, void* surface_creation_
|
||||||
float mouse_x = 0.0f, mouse_y = 0.0f;
|
float mouse_x = 0.0f, mouse_y = 0.0f;
|
||||||
bool mouse_down = false;
|
bool mouse_down = false;
|
||||||
|
|
||||||
@interface GameViewController ()
|
@interface GameViewController () {
|
||||||
{
|
|
||||||
GameView* view;
|
GameView* view;
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation GameViewController
|
@implementation GameViewController
|
||||||
|
|
||||||
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
|
- (void)touchesBegan:(NSSet<UITouch*>*)touches withEvent:(UIEvent*)event {
|
||||||
UITouch* touch = [touches anyObject];
|
UITouch* touch = [touches anyObject];
|
||||||
CGPoint touchPoint = [touch locationInView: self.view];
|
CGPoint touchPoint = [touch locationInView:self.view];
|
||||||
|
|
||||||
mouse_x = touchPoint.x;
|
mouse_x = touchPoint.x;
|
||||||
mouse_y = touchPoint.y;
|
mouse_y = touchPoint.y;
|
||||||
|
@ -119,9 +120,9 @@ bool mouse_down = false;
|
||||||
engine->process_mouse_down(0, {static_cast<int32_t>(touchPoint.x), static_cast<int32_t>(touchPoint.y)});
|
engine->process_mouse_down(0, {static_cast<int32_t>(touchPoint.x), static_cast<int32_t>(touchPoint.y)});
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
|
- (void)touchesEnded:(NSSet<UITouch*>*)touches withEvent:(UIEvent*)event {
|
||||||
UITouch* touch = [touches anyObject];
|
UITouch* touch = [touches anyObject];
|
||||||
CGPoint touchPoint = [touch locationInView: self.view];
|
CGPoint touchPoint = [touch locationInView:self.view];
|
||||||
|
|
||||||
mouse_x = touchPoint.x;
|
mouse_x = touchPoint.x;
|
||||||
mouse_y = touchPoint.y;
|
mouse_y = touchPoint.y;
|
||||||
|
@ -129,9 +130,9 @@ bool mouse_down = false;
|
||||||
mouse_down = false;
|
mouse_down = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)touchesMoved:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
|
- (void)touchesMoved:(NSSet<UITouch*>*)touches withEvent:(UIEvent*)event {
|
||||||
UITouch* touch = [touches anyObject];
|
UITouch* touch = [touches anyObject];
|
||||||
CGPoint touchPoint = [touch locationInView: self.view];
|
CGPoint touchPoint = [touch locationInView:self.view];
|
||||||
|
|
||||||
mouse_x = touchPoint.x;
|
mouse_x = touchPoint.x;
|
||||||
mouse_y = touchPoint.y;
|
mouse_y = touchPoint.y;
|
||||||
|
@ -141,12 +142,11 @@ int width, height;
|
||||||
int drawable_width, drawable_height;
|
int drawable_width, drawable_height;
|
||||||
CAMetalLayer* layer;
|
CAMetalLayer* layer;
|
||||||
|
|
||||||
template<class GFXBackend>
|
template<class GFXBackend> void try_initialize() {
|
||||||
void try_initialize() {
|
if (gfx_interface == nullptr) {
|
||||||
if(gfx_interface == nullptr) {
|
|
||||||
auto backend = new GFXBackend();
|
auto backend = new GFXBackend();
|
||||||
const bool supported = backend->is_supported() && platform::supports_context(backend->required_context());
|
const bool supported = backend->is_supported() && platform::supports_context(backend->required_context());
|
||||||
if(!supported) {
|
if (!supported) {
|
||||||
prism::log("Failed to initialize GFX backend... trying next...");
|
prism::log("Failed to initialize GFX backend... trying next...");
|
||||||
} else {
|
} else {
|
||||||
gfx_interface = backend;
|
gfx_interface = backend;
|
||||||
|
@ -174,18 +174,18 @@ void try_initialize() {
|
||||||
|
|
||||||
engine = new prism::engine(0, nullptr);
|
engine = new prism::engine(0, nullptr);
|
||||||
|
|
||||||
#ifdef ENABLE_METAL
|
#ifdef ENABLE_METAL
|
||||||
try_initialize<GFXMetal>();
|
try_initialize<GFXMetal>();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_VULKAN
|
#ifdef ENABLE_VULKAN
|
||||||
try_initialize<GFXVulkan>();
|
try_initialize<GFXVulkan>();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
try_initialize<GFXDummy>();
|
try_initialize<GFXDummy>();
|
||||||
|
|
||||||
GFXCreateInfo info = {};
|
GFXCreateInfo info = {};
|
||||||
if(gfx_interface->initialize(info)) {
|
if (gfx_interface->initialize(info)) {
|
||||||
engine->set_gfx(gfx_interface);
|
engine->set_gfx(gfx_interface);
|
||||||
} else {
|
} else {
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -195,15 +195,13 @@ void try_initialize() {
|
||||||
app_main(engine);
|
app_main(engine);
|
||||||
engine->set_app(app);
|
engine->set_app(app);
|
||||||
|
|
||||||
engine->add_window((void*)CFBridgingRetain([view layer]), (void*)1, {static_cast<uint32_t>(width), static_cast<uint32_t>(height)});
|
engine->add_window(
|
||||||
|
(void*)CFBridgingRetain([view layer]), (void*)1, {static_cast<uint32_t>(width), static_cast<uint32_t>(height)});
|
||||||
|
|
||||||
app->initialize_render();
|
app->initialize_render();
|
||||||
|
|
||||||
NSNotificationCenter* nc = [NSNotificationCenter defaultCenter];
|
NSNotificationCenter* nc = [NSNotificationCenter defaultCenter];
|
||||||
[nc addObserver:view
|
[nc addObserver:view selector:@selector(controllerConnected) name:GCControllerDidConnectNotification object:nil];
|
||||||
selector:@selector(controllerConnected)
|
|
||||||
name:GCControllerDidConnectNotification
|
|
||||||
object:nil];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)didReceiveMemoryWarning {
|
- (void)didReceiveMemoryWarning {
|
||||||
|
@ -211,7 +209,7 @@ void try_initialize() {
|
||||||
// Dispose of any resources that can be recreated.
|
// Dispose of any resources that can be recreated.
|
||||||
}
|
}
|
||||||
|
|
||||||
-(bool)prefersStatusBarHidden {
|
- (bool)prefersStatusBarHidden {
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -219,33 +217,31 @@ void try_initialize() {
|
||||||
|
|
||||||
bool platform::supports_context(GFXContext context) {
|
bool platform::supports_context(GFXContext context) {
|
||||||
#ifdef ENABLE_DX12
|
#ifdef ENABLE_DX12
|
||||||
if(context == GFXContext::DirectX)
|
if (context == GFXContext::DirectX)
|
||||||
return true;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_VULKAN
|
#ifdef ENABLE_VULKAN
|
||||||
if(context == GFXContext::Vulkan)
|
if (context == GFXContext::Vulkan)
|
||||||
return true;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_METAL
|
#ifdef ENABLE_METAL
|
||||||
if(context == GFXContext::Metal)
|
if (context == GFXContext::Metal)
|
||||||
return true;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(context == GFXContext::None)
|
if (context == GFXContext::None)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void platform::initialize_context(const GFXContext context) {
|
void platform::initialize_context(const GFXContext context) {}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void* platform::get_context_information() {
|
void* platform::get_context_information() {
|
||||||
#ifdef ENABLE_VULKAN
|
#ifdef ENABLE_VULKAN
|
||||||
if(gfx_interface->required_context() == GFXContext::Vulkan) {
|
if (gfx_interface->required_context() == GFXContext::Vulkan) {
|
||||||
auto info = new vulkan_information();
|
auto info = new vulkan_information();
|
||||||
info->surface_extensions = {VK_EXT_METAL_SURFACE_EXTENSION_NAME};
|
info->surface_extensions = {VK_EXT_METAL_SURFACE_EXTENSION_NAME};
|
||||||
|
|
||||||
|
@ -258,13 +254,13 @@ void* platform::get_context_information() {
|
||||||
|
|
||||||
void* platform::create_surface(window_ptr window, void* surface_creation_info) {
|
void* platform::create_surface(window_ptr window, void* surface_creation_info) {
|
||||||
#ifdef ENABLE_VULKAN
|
#ifdef ENABLE_VULKAN
|
||||||
if(gfx_interface->required_context() == GFXContext::Vulkan) {
|
if (gfx_interface->required_context() == GFXContext::Vulkan) {
|
||||||
return create_vulkan_surface(window, surface_creation_info);
|
return create_vulkan_surface(window, surface_creation_info);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_METAL
|
#ifdef ENABLE_METAL
|
||||||
if(gfx_interface->required_context() == GFXContext::Metal) {
|
if (gfx_interface->required_context() == GFXContext::Metal) {
|
||||||
return create_metal_surface(window, surface_creation_info);
|
return create_metal_surface(window, surface_creation_info);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -274,7 +270,7 @@ void* platform::create_surface(window_ptr window, void* surface_creation_info) {
|
||||||
|
|
||||||
void* platform::get_next_image(window_ptr window) {
|
void* platform::get_next_image(window_ptr window) {
|
||||||
#ifdef ENABLE_METAL
|
#ifdef ENABLE_METAL
|
||||||
if(gfx_interface->required_context() == GFXContext::Metal) {
|
if (gfx_interface->required_context() == GFXContext::Metal) {
|
||||||
return get_next_metal_drawable(window);
|
return get_next_metal_drawable(window);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -282,9 +278,7 @@ void* platform::get_next_image(window_ptr window) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void platform::capture_mouse(const bool capture) {
|
void platform::capture_mouse(const bool capture) {}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: unimplemented
|
// TODO: unimplemented
|
||||||
PlatformTheme platform::get_theme() {
|
PlatformTheme platform::get_theme() {
|
||||||
|
@ -292,11 +286,11 @@ PlatformTheme platform::get_theme() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void platform::begin_text_input() {
|
void platform::begin_text_input() {
|
||||||
// TODO: stub
|
// TODO: stub
|
||||||
}
|
}
|
||||||
|
|
||||||
void platform::end_text_input() {
|
void platform::end_text_input() {
|
||||||
// TODO: stub
|
// TODO: stub
|
||||||
}
|
}
|
||||||
|
|
||||||
void* create_vulkan_surface(platform::window_ptr index, void* surface_creation_info) {
|
void* create_vulkan_surface(platform::window_ptr index, void* surface_creation_info) {
|
||||||
|
@ -337,9 +331,7 @@ bool platform::is_main_window(platform::window_ptr index) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void platform::show_window(const platform::window_ptr index) {
|
void platform::show_window(const platform::window_ptr index) {}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
bool platform::supports_feature(const PlatformFeature feature) {
|
bool platform::supports_feature(const PlatformFeature feature) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -358,48 +350,43 @@ std::tuple<float, float> platform::get_left_stick_position() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool platform::get_key_down(InputButton key) {
|
bool platform::get_key_down(InputButton key) {
|
||||||
if(key == InputButton::ButtonA)
|
if (key == InputButton::ButtonA)
|
||||||
return inputKeys[0];
|
return inputKeys[0];
|
||||||
|
|
||||||
if(key == InputButton::ButtonB)
|
if (key == InputButton::ButtonB)
|
||||||
return inputKeys[1];
|
return inputKeys[1];
|
||||||
|
|
||||||
if(key == InputButton::ButtonX)
|
if (key == InputButton::ButtonX)
|
||||||
return inputKeys[2];
|
return inputKeys[2];
|
||||||
|
|
||||||
if(key == InputButton::ButtonY)
|
if (key == InputButton::ButtonY)
|
||||||
return inputKeys[3];
|
return inputKeys[3];
|
||||||
|
|
||||||
if(key == InputButton::DPadUp)
|
if (key == InputButton::DPadUp)
|
||||||
return inputKeys[4];
|
return inputKeys[4];
|
||||||
|
|
||||||
if(key == InputButton::DPadDown)
|
if (key == InputButton::DPadDown)
|
||||||
return inputKeys[5];
|
return inputKeys[5];
|
||||||
|
|
||||||
if(key == InputButton::DPadLeft)
|
if (key == InputButton::DPadLeft)
|
||||||
return inputKeys[6];
|
return inputKeys[6];
|
||||||
|
|
||||||
if(key == InputButton::DPadRight)
|
if (key == InputButton::DPadRight)
|
||||||
return inputKeys[7];
|
return inputKeys[7];
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
platform::window_ptr platform::open_window(const std::string_view title, const prism::Rectangle rect, const WindowFlags flags) {
|
platform::window_ptr
|
||||||
|
platform::open_window(const std::string_view title, const prism::Rectangle rect, const WindowFlags flags) {
|
||||||
return (void*)1;
|
return (void*)1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void platform::set_window_title(const platform::window_ptr index, const std::string_view title) {
|
void platform::set_window_title(const platform::window_ptr index, const std::string_view title) {}
|
||||||
|
|
||||||
}
|
bool platform::is_window_focused(const platform::window_ptr index) {}
|
||||||
|
|
||||||
bool platform::is_window_focused(const platform::window_ptr index) {
|
void platform::set_window_focused(const platform::window_ptr index) {}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void platform::set_window_focused(const platform::window_ptr index) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
prism::Extent platform::get_window_size(const platform::window_ptr index) {
|
prism::Extent platform::get_window_size(const platform::window_ptr index) {
|
||||||
return {static_cast<uint32_t>(width), static_cast<uint32_t>(height)};
|
return {static_cast<uint32_t>(width), static_cast<uint32_t>(height)};
|
||||||
|
@ -409,37 +396,21 @@ prism::Extent platform::get_window_drawable_size(const platform::window_ptr inde
|
||||||
return {static_cast<uint32_t>(drawable_width), static_cast<uint32_t>(drawable_height)};
|
return {static_cast<uint32_t>(drawable_width), static_cast<uint32_t>(drawable_height)};
|
||||||
}
|
}
|
||||||
|
|
||||||
prism::Offset platform::get_window_position(const platform::window_ptr index) {
|
prism::Offset platform::get_window_position(const platform::window_ptr index) {}
|
||||||
|
|
||||||
}
|
void platform::set_window_size(const platform::window_ptr index, const prism::Extent extent) {}
|
||||||
|
|
||||||
void platform::set_window_size(const platform::window_ptr index, const prism::Extent extent) {
|
void platform::set_window_position(const platform::window_ptr index, const prism::Offset offset) {}
|
||||||
|
|
||||||
}
|
void platform::close_window(const platform::window_ptr index) {}
|
||||||
|
|
||||||
void platform::set_window_position(const platform::window_ptr index, const prism::Offset offset) {
|
int platform::get_keycode(const InputButton button) {}
|
||||||
|
|
||||||
}
|
prism::Rectangle platform::get_monitor_resolution() {}
|
||||||
|
|
||||||
void platform::close_window(const platform::window_ptr index) {
|
prism::Rectangle platform::get_monitor_work_area() {}
|
||||||
|
|
||||||
}
|
prism::Offset platform::get_screen_cursor_position() {}
|
||||||
|
|
||||||
int platform::get_keycode(const InputButton button) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
prism::Rectangle platform::get_monitor_resolution() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
prism::Rectangle platform::get_monitor_work_area() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
prism::Offset platform::get_screen_cursor_position() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
bool platform::get_mouse_button_down(const int index) {
|
bool platform::get_mouse_button_down(const int index) {
|
||||||
return mouse_down;
|
return mouse_down;
|
||||||
|
@ -449,9 +420,7 @@ float platform::get_monitor_dpi() {
|
||||||
return 2.0f;
|
return 2.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::tuple<float, float> platform::get_wheel_delta() {
|
std::tuple<float, float> platform::get_wheel_delta() {}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
const char* platform::get_name() {
|
const char* platform::get_name() {
|
||||||
return "iOS";
|
return "iOS";
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* \endcode
|
* \endcode
|
||||||
*/
|
*/
|
||||||
#ifndef KEEP_IN_MODULE
|
#ifndef KEEP_IN_MODULE
|
||||||
#define KEEP_IN_MODULE extern "C" __attribute__((used, visibility("default")))
|
#define KEEP_IN_MODULE extern "C" __attribute__((used, visibility("default")))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -30,7 +30,7 @@ extern "C" int __main__(int /*argc*/, char* /*argv*/[]);
|
||||||
//****************************************************************************/
|
//****************************************************************************/
|
||||||
|
|
||||||
namespace impl {
|
namespace impl {
|
||||||
/**
|
/**
|
||||||
* JavaScript async calls that need to finish before calling \c main().
|
* JavaScript async calls that need to finish before calling \c main().
|
||||||
*/
|
*/
|
||||||
EM_JS(void, glue_preint, (), {
|
EM_JS(void, glue_preint, (), {
|
||||||
|
@ -43,14 +43,14 @@ namespace impl {
|
||||||
* loading the Wasm).
|
* loading the Wasm).
|
||||||
*/
|
*/
|
||||||
if (navigator["gpu"]) {
|
if (navigator["gpu"]) {
|
||||||
navigator["gpu"]["requestAdapter"]().then(function (adapter) {
|
navigator["gpu"]["requestAdapter"]().then(
|
||||||
adapter["requestDevice"]().then( function (device) {
|
function(adapter) {
|
||||||
|
adapter["requestDevice"]().then(function(device) {
|
||||||
Module["preinitializedWebGPUDevice"] = device;
|
Module["preinitializedWebGPUDevice"] = device;
|
||||||
entry();
|
entry();
|
||||||
});
|
});
|
||||||
}, function () {
|
},
|
||||||
console.error("No WebGPU adapter; not starting");
|
function() { console.error("No WebGPU adapter; not starting"); });
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
console.error("No support for WebGPU; not starting");
|
console.error("No support for WebGPU; not starting");
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ namespace impl {
|
||||||
console.error("Entry point not found; unable to start");
|
console.error("Entry point not found; unable to start");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
} // namespace impl
|
||||||
|
|
||||||
//****************************************************************************/
|
//****************************************************************************/
|
||||||
|
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
#include <stdio.h>
|
|
||||||
#include <@APP_INCLUDE@>
|
#include <@APP_INCLUDE@>
|
||||||
#include <emscripten/html5.h>
|
#include <emscripten/html5.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "engine.hpp"
|
#include "engine.hpp"
|
||||||
#include "platform.hpp"
|
|
||||||
#include "gfx_webgpu.hpp"
|
|
||||||
#include "file.hpp"
|
#include "file.hpp"
|
||||||
|
#include "gfx_webgpu.hpp"
|
||||||
|
#include "platform.hpp"
|
||||||
#include "string_utils.hpp"
|
#include "string_utils.hpp"
|
||||||
|
|
||||||
@APP_CLASS@* app = nullptr;
|
@APP_CLASS@* app = nullptr;
|
||||||
GFX* gfx_interface = nullptr;
|
GFX* gfx_interface = nullptr;
|
||||||
|
|
||||||
EM_BOOL draw(double time, void *userData) {
|
EM_BOOL draw(double time, void* userData) {
|
||||||
engine->update(time);
|
engine->update(time);
|
||||||
engine->begin_frame(time);
|
engine->begin_frame(time);
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ extern "C" int __main__(int argc, char* argv[]) {
|
||||||
|
|
||||||
GFXCreateInfo info = {};
|
GFXCreateInfo info = {};
|
||||||
gfx_interface = new GFXWebGPU();
|
gfx_interface = new GFXWebGPU();
|
||||||
if(gfx_interface->initialize(info)) {
|
if (gfx_interface->initialize(info)) {
|
||||||
engine->set_gfx(gfx_interface);
|
engine->set_gfx(gfx_interface);
|
||||||
} else {
|
} else {
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -45,19 +45,15 @@ extern "C" int __main__(int argc, char* argv[]) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void platform::capture_mouse(const bool capture) {
|
void platform::capture_mouse(const bool capture) {}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
PlatformTheme platform::get_theme() {
|
PlatformTheme platform::get_theme() {
|
||||||
return PlatformTheme::Light;
|
return PlatformTheme::Light;
|
||||||
}
|
}
|
||||||
|
|
||||||
void platform::begin_text_input() {
|
void platform::begin_text_input() {}
|
||||||
}
|
|
||||||
|
|
||||||
void platform::end_text_input() {
|
void platform::end_text_input() {}
|
||||||
}
|
|
||||||
|
|
||||||
void* platform::create_surface(window_ptr window, void* surface_creation_info) {
|
void* platform::create_surface(window_ptr window, void* surface_creation_info) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -79,9 +75,7 @@ bool platform::supports_context(GFXContext context) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void platform::show_window(const platform::window_ptr index) {
|
void platform::show_window(const platform::window_ptr index) {}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
bool platform::supports_feature(const PlatformFeature feature) {
|
bool platform::supports_feature(const PlatformFeature feature) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -103,21 +97,18 @@ bool platform::get_key_down(InputButton key) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
platform::window_ptr platform::open_window(const std::string_view title, const prism::Rectangle rect, const WindowFlags flags) {
|
platform::window_ptr
|
||||||
|
platform::open_window(const std::string_view title, const prism::Rectangle rect, const WindowFlags flags) {
|
||||||
return (void*)1;
|
return (void*)1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void platform::set_window_title(const platform::window_ptr index, const std::string_view title) {
|
void platform::set_window_title(const platform::window_ptr index, const std::string_view title) {}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
bool platform::is_window_focused(const platform::window_ptr index) {
|
bool platform::is_window_focused(const platform::window_ptr index) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void platform::set_window_focused(const platform::window_ptr index) {
|
void platform::set_window_focused(const platform::window_ptr index) {}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
prism::Extent platform::get_window_size(const platform::window_ptr index) {
|
prism::Extent platform::get_window_size(const platform::window_ptr index) {
|
||||||
return {100, 100};
|
return {100, 100};
|
||||||
|
@ -131,17 +122,11 @@ prism::Offset platform::get_window_position(const platform::window_ptr index) {
|
||||||
return {0, 0};
|
return {0, 0};
|
||||||
}
|
}
|
||||||
|
|
||||||
void platform::set_window_size(const platform::window_ptr index, const prism::Extent extent) {
|
void platform::set_window_size(const platform::window_ptr index, const prism::Extent extent) {}
|
||||||
|
|
||||||
}
|
void platform::set_window_position(const platform::window_ptr index, const prism::Offset offset) {}
|
||||||
|
|
||||||
void platform::set_window_position(const platform::window_ptr index, const prism::Offset offset) {
|
void platform::close_window(const platform::window_ptr index) {}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void platform::close_window(const platform::window_ptr index) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
int platform::get_keycode(const InputButton button) {
|
int platform::get_keycode(const InputButton button) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -179,6 +164,4 @@ void prism::set_domain_path(const prism::domain domain, const prism::path& path)
|
||||||
domain_data[(int)domain] = replace_substring(path.string(), "{resource_dir}/", "");
|
domain_data[(int)domain] = replace_substring(path.string(), "{resource_dir}/", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
prism::path prism::get_writeable_directory() {
|
prism::path prism::get_writeable_directory() {}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -3,10 +3,10 @@
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, maximum-scale=1.0, user-scalable=no, viewport-fit=cover" />
|
<meta content="width=device-width, maximum-scale=1.0, user-scalable=no, viewport-fit=cover" name="viewport"/>
|
||||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
<meta content="yes" name="apple-mobile-web-app-capable"/>
|
||||||
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
|
<meta content="black-translucent" name="apple-mobile-web-app-status-bar-style"/>
|
||||||
<link rel="shortcut icon" href="#" />
|
<link href="#" rel="shortcut icon"/>
|
||||||
<title>Hello Triangle</title>
|
<title>Hello Triangle</title>
|
||||||
<style>
|
<style>
|
||||||
body {
|
body {
|
||||||
|
@ -26,6 +26,7 @@
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
@ -37,7 +38,8 @@
|
||||||
return document.getElementById("canvas");
|
return document.getElementById("canvas");
|
||||||
})()
|
})()
|
||||||
};
|
};
|
||||||
</script>
|
|
||||||
|
</script>
|
||||||
{{{ SCRIPT }}}
|
{{{ SCRIPT }}}
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
|
Reference in a new issue