Init commit skeleton project
This commit is contained in:
commit
6f5dbaaa72
3 changed files with 108 additions and 0 deletions
38
CMakeLists.txt
Normal file
38
CMakeLists.txt
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
cmake_minimum_required(VERSION 3.22.1)
|
||||||
|
project(SC_SeparatingAxisCollisionDetection CXX)
|
||||||
|
|
||||||
|
set(SC_SeparatingAxisCollisionDetection_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/sd_sacd.cpp")
|
||||||
|
set(SC_SeparatingAxisCollisionDetection_HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/src/sd_sacd.h")
|
||||||
|
|
||||||
|
add_library(SC_SeparatingAxisCollisionDetection ${SC_SeparatingAxisCollisionDetection_SOURCES})
|
||||||
|
|
||||||
|
set_target_properties(SC_SeparatingAxisCollisionDetection PROPERTIES VERSION 1.0.0 SOVERSION 1)
|
||||||
|
|
||||||
|
if(NOT DEFINED CMAKE_BUILD_TYPE OR "${CMAKE_BUILD_TYPE}" STREQUAL "")
|
||||||
|
message("Defaulting to \"Debug\" build type.")
|
||||||
|
set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Build type" FORCE)
|
||||||
|
else()
|
||||||
|
message("Using build type \"${CMAKE_BUILD_TYPE}\".")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
target_compile_options(SC_SeparatingAxisCollisionDetection PUBLIC
|
||||||
|
$<IF:$<CONFIG:Debug>,-Og,-fno-delete-null-pointer-checks -fno-strict-overflow -fno-strict-aliasing -ftrivial-auto-var-init=zero>
|
||||||
|
-Wall -Wformat -Wformat=2 -Wconversion -Wimplicit-fallthrough
|
||||||
|
-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3
|
||||||
|
-D_GLIBCXX_ASSERTIONS
|
||||||
|
-fstrict-flex-arrays=3
|
||||||
|
-fstack-clash-protection -fstack-protector-strong
|
||||||
|
-fPIC
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_options(SC_SeparatingAxisCollisionDetection PUBLIC
|
||||||
|
$<IF:$<CONFIG:Debug>,-Og,-fno-delete-null-pointer-checks -fno-strict-overflow -fno-strict-aliasing -ftrivial-auto-var-init=zero>
|
||||||
|
-Wall -Wformat -Wformat=2 -Wconversion -Wimplicit-fallthrough
|
||||||
|
-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3
|
||||||
|
-D_GLIBCXX_ASSERTIONS
|
||||||
|
-fstrict-flex-arrays=3
|
||||||
|
-fstack-clash-protection -fstack-protector-strong
|
||||||
|
-Wl,-z,noexecstack
|
||||||
|
-Wl,-z,relro -Wl,-z,now
|
||||||
|
-fPIC
|
||||||
|
)
|
16
src/sd_sacd.cpp
Normal file
16
src/sd_sacd.cpp
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
#include "sd_sacd.h"
|
||||||
|
|
||||||
|
int SC_SACD_AABB_Box_Collision(const SC_SACD_AABB_Box *a,
|
||||||
|
const SC_SACD_AABB_Box *b) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int SC_SACD_Generic_Box_Collision(const SC_SACD_Generic_Box *a,
|
||||||
|
const SC_SACD_Generic_Box *b) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int SC_SACD_AABB_Generic_Box_collision(const SC_SACD_AABB_Box *a,
|
||||||
|
const SC_SACD_Generic_Box *b) {
|
||||||
|
return 0;
|
||||||
|
}
|
54
src/sd_sacd.h
Normal file
54
src/sd_sacd.h
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
#ifndef SEODISPARATE_COM_SEPARATING_AXIS_COLLISION_DETECTION_H_
|
||||||
|
#define SEODISPARATE_COM_SEPARATING_AXIS_COLLISION_DETECTION_H_
|
||||||
|
|
||||||
|
#define SC_SACD_PLATFORM_WINDOWS 1
|
||||||
|
#define SC_SACD_PLATFORM_OTHER 2
|
||||||
|
|
||||||
|
#if defined _WIN32
|
||||||
|
#define SC_SACD_PLATFORM SC_SACD_PLATFORM_WINDOWS
|
||||||
|
#else
|
||||||
|
#define SC_SACD_PLATFORM SC_SACD_PLATFORM_OTHER
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if SC_SACD_PLATFORM == SC_SACD_PLATFORM_WINDOWS
|
||||||
|
#define SC_SACD_EXPORT __declspec(dllexport)
|
||||||
|
#else
|
||||||
|
#define SC_SACD_EXPORT
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef struct SC_SACD_EXPORT SC_SACD_AABB_Box {
|
||||||
|
float x;
|
||||||
|
float y;
|
||||||
|
float width;
|
||||||
|
float height;
|
||||||
|
} SC_SACD_AABB_Box;
|
||||||
|
|
||||||
|
typedef struct SC_SACD_EXPORT SC_SACD_Generic_Box {
|
||||||
|
float x;
|
||||||
|
float y;
|
||||||
|
float width;
|
||||||
|
float height;
|
||||||
|
float radians;
|
||||||
|
} SC_SACD_Generic_Box;
|
||||||
|
|
||||||
|
/// Returns non-zero if there is collision.
|
||||||
|
SC_SACD_EXPORT int SC_SACD_AABB_Box_Collision(const SC_SACD_AABB_Box *a,
|
||||||
|
const SC_SACD_AABB_Box *b);
|
||||||
|
|
||||||
|
/// Returns non-zero if there is collision.
|
||||||
|
SC_SACD_EXPORT int SC_SACD_Generic_Box_Collision(const SC_SACD_Generic_Box *a,
|
||||||
|
const SC_SACD_Generic_Box *b);
|
||||||
|
|
||||||
|
/// Returns non-zero if there is collision.
|
||||||
|
SC_SACD_EXPORT int SC_SACD_AABB_Generic_Box_collision(
|
||||||
|
const SC_SACD_AABB_Box *a, const SC_SACD_Generic_Box *b);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
Loading…
Reference in a new issue