update to keep build functional + build system improvement
This commit is contained in:
parent
dbaf2ae8c2
commit
5e45050e83
|
@ -1,86 +0,0 @@
|
|||
# Configure with [fxsdk build-fx] or [fxsdk build-cg], which provide the
|
||||
# toolchain file and module path of the fxSDK
|
||||
|
||||
cmake_minimum_required(VERSION 3.18)
|
||||
# replace this with your project's name
|
||||
project(Windmill)
|
||||
|
||||
include(GenerateG1A)
|
||||
include(GenerateG3A)
|
||||
include(Fxconv)
|
||||
find_package(Gint 2.1 REQUIRED)
|
||||
|
||||
# include directories, put your .h files in those folders
|
||||
include_directories(include)
|
||||
|
||||
# source files
|
||||
set(SOURCES
|
||||
src/main.cpp
|
||||
|
||||
# ...
|
||||
)
|
||||
# shared assets
|
||||
set(ASSETS
|
||||
# ...
|
||||
)
|
||||
# fx-9860G-only assets (monochrome)
|
||||
set(ASSETS_fx
|
||||
assets-fx/example.png
|
||||
assets-fx/img/windmill.png
|
||||
# ...
|
||||
)
|
||||
# fx-CG-50-only assets (polychrome)
|
||||
set(ASSETS_cg
|
||||
assets-cg/example.png
|
||||
# ...
|
||||
)
|
||||
|
||||
# Compile flags
|
||||
set(FLAGS
|
||||
# C standard, other values: c89, c99
|
||||
-std=c11
|
||||
|
||||
# general warnings
|
||||
-Wall -Wextra -pedantic
|
||||
|
||||
# enable this flag to stop compilation on warnings
|
||||
#-Werror
|
||||
|
||||
# specific warnings
|
||||
# variable shadowing
|
||||
-Wshadow
|
||||
# switch/case safety
|
||||
-Wswitch-default -Wswitch-enum
|
||||
# unreachable code, bad 99% of the time
|
||||
-Wunreachable-code
|
||||
# prototypes warnings
|
||||
-Wstrict-prototypes -Wmissing-prototypes
|
||||
# function declaration
|
||||
-Werror-implicit-function-declaration
|
||||
|
||||
# optimisation level
|
||||
# -Os: like -O2 without space-expensive optimizations
|
||||
# -O2: good speed/size tradeoff
|
||||
# -O3: gotta go fast
|
||||
-Os
|
||||
)
|
||||
|
||||
fxconv_declare_assets(${ASSETS} ${ASSETS_fx} ${ASSETS_cg} WITH_METADATA)
|
||||
|
||||
add_executable(${PROJECT_NAME} ${SOURCES} ${ASSETS} ${ASSETS_${FXSDK_PLATFORM}})
|
||||
target_compile_options(${PROJECT_NAME} PRIVATE ${FLAGS})
|
||||
target_link_libraries(${PROJECT_NAME} Gint::Gint)
|
||||
|
||||
if("${FXSDK_PLATFORM_LONG}" STREQUAL fx9860G)
|
||||
generate_g1a(
|
||||
TARGET ${PROJECT_NAME}
|
||||
OUTPUT "${PROJECT_NAME}.g1a"
|
||||
NAME "${PROJECT_NAME}"
|
||||
ICON assets-fx/icon.png)
|
||||
elseif("${FXSDK_PLATFORM_LONG}" STREQUAL fxCG50)
|
||||
generate_g3a(
|
||||
TARGET ${PROJECT_NAME}
|
||||
OUTPUT "${PROJECT_NAME}.g3a"
|
||||
NAME "${PROJECT_NAME}"
|
||||
ICONS assets-cg/icon-uns.png assets-cg/icon-sel.png)
|
||||
endif()
|
|
@ -38,26 +38,26 @@ fxconv_declare_assets(${ASSETS} ${ASSETS_fx} ${ASSETS_cg} WITH_METADATA)
|
|||
set_source_files_properties(src/map.cpp PROPERTIES
|
||||
COMPILE_OPTIONS "-Wp,-w;-Wno-missing-field-initializers")
|
||||
|
||||
add_executable(${PROJECT_NAME} ${SOURCES} ${ASSETS} ${ASSETS_${FXSDK_PLATFORM}})
|
||||
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE "${FXSDK_COMPILER_INSTALL}/include/openlibm")
|
||||
|
||||
target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -Os -fno-use-cxa-atexit)
|
||||
|
||||
target_link_options(${PROJECT_NAME} PRIVATE -Wl,-Map=map)
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} Gint::Gint -lopenlibm -lc -lsupc++)
|
||||
add_executable(addin ${SOURCES} ${ASSETS} ${ASSETS_${FXSDK_PLATFORM}})
|
||||
target_compile_definitions(addin PRIVATE -D__BSD_VISIBLE=1)
|
||||
target_compile_options(addin PRIVATE -Wall -Wextra -Os -fno-use-cxa-atexit)
|
||||
target_link_options(addin PRIVATE -Wl,-Map=map -Wl,--print-memory-usage)
|
||||
target_link_libraries(addin Gint::Gint)
|
||||
|
||||
if("${FXSDK_PLATFORM_LONG}" STREQUAL fx9860G)
|
||||
generate_g1a(
|
||||
TARGET ${PROJECT_NAME}
|
||||
OUTPUT "${PROJECT_NAME}.g1a"
|
||||
NAME "${PROJECT_NAME}"
|
||||
ICON assets-fx/icon.png)
|
||||
elseif("${FXSDK_PLATFORM_LONG}" STREQUAL fxCG50)
|
||||
generate_g3a(
|
||||
TARGET ${PROJECT_NAME}
|
||||
OUTPUT "${PROJECT_NAME}.g3a"
|
||||
NAME "${PROJECT_NAME}"
|
||||
ICONS assets-cg/icon-uns.png assets-cg/icon-sel.png)
|
||||
endif()
|
||||
generate_g1a(
|
||||
TARGET addin
|
||||
OUTPUT "${PROJECT_NAME}.g1a"
|
||||
NAME "${PROJECT_NAME}"
|
||||
ICON assets-fx/icon.png)
|
||||
add_custom_command(
|
||||
TARGET addin POST_BUILD
|
||||
COMMAND echo -n "Size of g1a : "
|
||||
COMMAND stat -c %s "${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.g1a")
|
||||
elseif("${FXSDK_PLATFORM_LONG}" STREQUAL fxCG50)
|
||||
generate_g3a(
|
||||
TARGET addin
|
||||
OUTPUT "${PROJECT_NAME}.g3a"
|
||||
NAME "${PROJECT_NAME}"
|
||||
ICONS assets-cg/icon-uns.png assets-cg/icon-sel.png)
|
||||
endif()
|
||||
|
|
|
@ -10,10 +10,7 @@
|
|||
#define DEF_SCENE_TITLE
|
||||
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include "Input.h"
|
||||
}
|
||||
#include "Input.h"
|
||||
#include "Game.hpp"
|
||||
#include "Windmill.hpp"
|
||||
#include "Camera.hpp"
|
||||
|
|
|
@ -170,27 +170,3 @@ void Camera::look_at(float look_at_x, float look_at_y, float look_at_z, float du
|
|||
// calcule de sqrt ??
|
||||
look_at_duration = duration;
|
||||
}
|
||||
|
||||
/*
|
||||
//-----------------------------------------------------------------------------
|
||||
// MIN
|
||||
//-----------------------------------------------------------------------------
|
||||
int Camera::min(int a, int b)
|
||||
{
|
||||
return (a < b) ? a : b;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// MAX
|
||||
//-----------------------------------------------------------------------------
|
||||
int Camera::max(int a, int b)
|
||||
{
|
||||
return (a > b) ? a : b;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -41,12 +41,8 @@
|
|||
#ifndef DEF_CAMERA
|
||||
#define DEF_CAMERA
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#define __BSD_VISIBLE 1
|
||||
#include <openlibm.h>
|
||||
#include <gint/defs/util.h>
|
||||
}
|
||||
#include <math.h>
|
||||
#include <gint/defs/util.h>
|
||||
|
||||
|
||||
//#define PI 3.1415
|
||||
|
|
|
@ -2,13 +2,7 @@
|
|||
#define DEF_GAME
|
||||
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#define __BSD_VISIBLE 1
|
||||
#include <openlibm.h>
|
||||
//#include "MonochromeLib.h"
|
||||
}
|
||||
|
||||
#include <math.h>
|
||||
//#include "camera.hpp"
|
||||
|
||||
//#include "Structures.hpp"
|
||||
|
|
|
@ -1,13 +1,7 @@
|
|||
#ifndef DEF_PLAYER
|
||||
#define DEF_PLAYER
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#define __BSD_VISIBLE 1
|
||||
#include <openlibm.h>
|
||||
}
|
||||
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#define MAP_EXTERIOR_LIMIT 1000
|
||||
#define COL_NO 0
|
||||
|
|
|
@ -76,12 +76,12 @@ void Scene_Map::load_map()
|
|||
for (int k=0; k<current_modele->type; k++)
|
||||
{
|
||||
Point point = windmill.get_point(current_modele, k);
|
||||
current_bbox->x1 = min(current_bbox->x1, point.x);
|
||||
current_bbox->y1 = min(current_bbox->y1, point.y);
|
||||
current_bbox->z1 = min(current_bbox->z1, point.z);
|
||||
current_bbox->x2 = max(current_bbox->x2, point.x);
|
||||
current_bbox->y2 = max(current_bbox->y2, point.y);
|
||||
current_bbox->z2 = max(current_bbox->z2, point.z);
|
||||
current_bbox->x1 = min((int)current_bbox->x1, point.x);
|
||||
current_bbox->y1 = min((int)current_bbox->y1, point.y);
|
||||
current_bbox->z1 = min((int)current_bbox->z1, point.z);
|
||||
current_bbox->x2 = max((int)current_bbox->x2, point.x);
|
||||
current_bbox->y2 = max((int)current_bbox->y2, point.y);
|
||||
current_bbox->z2 = max((int)current_bbox->z2, point.z);
|
||||
}
|
||||
}
|
||||
if (current_object->axe == Z_BILLBOARD)
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
#ifndef DEF_SCENE_MAP
|
||||
#define DEF_SCENE_MAP
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include <gint/defs/util.h>
|
||||
#include <gint/keyboard.h>
|
||||
}
|
||||
#include <gint/defs/util.h>
|
||||
#include <gint/keyboard.h>
|
||||
#include "windmill.hpp"
|
||||
#include "game.hpp"
|
||||
|
||||
|
|
|
@ -1,16 +1,11 @@
|
|||
#ifndef DEF_WINDMILL
|
||||
#define DEF_WINDMILL
|
||||
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#define __BSD_VISIBLE 1
|
||||
#include <openlibm.h>
|
||||
#include <gint/display.h> // pour affichage des coordonnées
|
||||
#include <gint/std/string.h>
|
||||
#include <gint/std/stdlib.h>
|
||||
#include <gint/defs/util.h>
|
||||
}
|
||||
#include <math.h>
|
||||
#include <gint/display.h> // pour affichage des coordonnées
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <gint/defs/util.h>
|
||||
#include "camera.hpp"
|
||||
|
||||
#define get_vram_address() ((char *)gint_vram)
|
||||
|
@ -103,8 +98,8 @@ struct Modele
|
|||
struct Object
|
||||
{
|
||||
short x, y, z;
|
||||
float angle;
|
||||
char axe;
|
||||
float angle;
|
||||
const Modele* modele;
|
||||
const int modele_size;
|
||||
// ajouter ici
|
||||
|
@ -112,9 +107,9 @@ struct Object
|
|||
//const char for_collision;
|
||||
//const char type_collision;
|
||||
bool hidden;
|
||||
bool on_screen;
|
||||
Sphere sphere;
|
||||
int distance_to_camera;
|
||||
bool on_screen;
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue