Starting to support OSX
This commit is contained in:
25
src/dawnosx/CMakeLists.txt
Normal file
25
src/dawnosx/CMakeLists.txt
Normal file
@ -0,0 +1,25 @@
|
||||
# Copyright (c) 2022 Dominic Masters
|
||||
#
|
||||
# This software is released under the MIT License.
|
||||
# https://opensource.org/licenses/MIT
|
||||
|
||||
# Libraries
|
||||
# target_link_libraries(${DAWN_TARGET_NAME}
|
||||
# PUBLIC
|
||||
# m
|
||||
# )
|
||||
|
||||
# Includes
|
||||
target_include_directories(${DAWN_TARGET_NAME}
|
||||
PUBLIC
|
||||
${CMAKE_CURRENT_LIST_DIR}
|
||||
)
|
||||
|
||||
# Platform variables
|
||||
target_compile_definitions(${DAWN_TARGET_NAME}
|
||||
PUBLIC
|
||||
DAWN_ASSET_BUILD_PREFIX="../../assets/"
|
||||
)
|
||||
|
||||
# Subdirs
|
||||
add_subdirectory(host)
|
10
src/dawnosx/host/CMakeLists.txt
Normal file
10
src/dawnosx/host/CMakeLists.txt
Normal file
@ -0,0 +1,10 @@
|
||||
# Copyright (c) 2022 Dominic Masters
|
||||
#
|
||||
# This software is released under the MIT License.
|
||||
# https://opensource.org/licenses/MIT
|
||||
|
||||
# Sources
|
||||
target_sources(${DAWN_TARGET_NAME}
|
||||
PRIVATE
|
||||
DawnHostOSX.cpp
|
||||
)
|
57
src/dawnosx/host/DawnHostOSX.cpp
Normal file
57
src/dawnosx/host/DawnHostOSX.cpp
Normal file
@ -0,0 +1,57 @@
|
||||
// Copyright (c) 2022 Dominic Masters
|
||||
//
|
||||
// This software is released under the MIT License.
|
||||
// https://opensource.org/licenses/MIT
|
||||
|
||||
#include "DawnHostOSX.hpp"
|
||||
|
||||
#if DAWN_DEBUG_BUILD
|
||||
uint64_t dawnAllocatedItemCount;
|
||||
#endif
|
||||
|
||||
using namespace Dawn;
|
||||
|
||||
int32_t main(int32_t argc, char **args) {
|
||||
int32_t result;
|
||||
|
||||
#if DAWN_DEBUG_BUILD
|
||||
dawnAllocatedItemCount = 0;
|
||||
#endif
|
||||
|
||||
// Create the host
|
||||
auto host = new DawnHost();
|
||||
auto game = new DawnGame(host);
|
||||
|
||||
// Initialize the host and error check
|
||||
result = host->init(game);
|
||||
switch(result) {
|
||||
case DAWN_HOST_INIT_RESULT_SUCCESS:
|
||||
break;
|
||||
default:
|
||||
return result;
|
||||
}
|
||||
|
||||
// Request the main loop to start running.
|
||||
result = host->start(game);
|
||||
switch(result) {
|
||||
case DAWN_HOST_START_RESULT_SUCCESS:
|
||||
break;
|
||||
case DAWN_HOST_START_RESULT_EXIT_SUCCESS:
|
||||
break;
|
||||
default:
|
||||
return result;
|
||||
}
|
||||
|
||||
// Main loop finished without errors, cleanup
|
||||
host->unload(game);
|
||||
|
||||
delete game;
|
||||
delete host;
|
||||
|
||||
#if DAWN_DEBUG_BUILD
|
||||
assertTrue(dawnAllocatedItemCount == 0);
|
||||
#endif
|
||||
|
||||
// Success
|
||||
return 0;
|
||||
}
|
18
src/dawnosx/host/DawnHostOSX.hpp
Normal file
18
src/dawnosx/host/DawnHostOSX.hpp
Normal file
@ -0,0 +1,18 @@
|
||||
// Copyright (c) 2022 Dominic Masters
|
||||
//
|
||||
// This software is released under the MIT License.
|
||||
// https://opensource.org/licenses/MIT
|
||||
|
||||
#pragma once
|
||||
#include "dawnlibs.hpp"
|
||||
#include "host/DawnHost.hpp"
|
||||
#include "game/DawnGame.hpp"
|
||||
|
||||
/**
|
||||
* Main entry function received by parent Win32 Operating System.
|
||||
*
|
||||
* @param argc Count of arguments passed to the program.
|
||||
* @param args Array of strings provided to the program.
|
||||
* @return 0 for success, else for any issue/error.
|
||||
*/
|
||||
int32_t main(int32_t argc, char **args);
|
Reference in New Issue
Block a user