From e2aeb125dc916dac0519bbd62d2c0ac454aef195 Mon Sep 17 00:00:00 2001 From: giraffeics Date: Mon, 10 Aug 2020 03:03:58 -0400 Subject: [PATCH] Add RMODERN build option, main function --- Makefile | 21 +++++++++++++++++++++ src/pc/pc_main.c | 9 +++++++++ src/pc/rmodern/rmodern.h | 18 ++++++++++++++++++ src/pc/rmodern/rmodern_main.cpp | 8 ++++++++ 4 files changed, 56 insertions(+) create mode 100644 src/pc/rmodern/rmodern.h create mode 100644 src/pc/rmodern/rmodern_main.cpp diff --git a/Makefile b/Makefile index 62ea99c..77207fc 100644 --- a/Makefile +++ b/Makefile @@ -65,6 +65,9 @@ AUDIO_API ?= SDL2 # Controller backends (can have multiple, space separated): SDL2 CONTROLLER_API ?= SDL2 +# Modern rendering system (will eventually replace other backends) +RMODERN ?= 0 + # Misc settings for EXTERNAL_DATA BASEDIR ?= res @@ -255,6 +258,14 @@ else BUILD_DIR := $(BUILD_DIR_BASE)/$(VERSION)_pc endif +ifeq ($(DEBUG),1) + BUILD_DIR := $(BUILD_DIR)_debug +endif + +ifeq ($(RMODERN),1) + BUILD_DIR := $(BUILD_DIR)_rmodern +endif + LIBULTRA := $(BUILD_DIR)/libultra.a ifeq ($(TARGET_WEB),1) @@ -286,6 +297,10 @@ LEVEL_DIRS := $(patsubst levels/%,%,$(dir $(wildcard levels/*/header.h))) SRC_DIRS := src src/engine src/game src/audio src/menu src/buffers actors levels bin data assets src/pc src/pc/gfx src/pc/audio src/pc/controller src/pc/fs src/pc/fs/packtypes ASM_DIRS := +ifeq ($(RMODERN),1) + SRC_DIRS += src/pc/rmodern +endif + ifeq ($(DISCORDRPC),1) SRC_DIRS += src/pc/discord endif @@ -478,6 +493,12 @@ SDLCONFIG := $(CROSS)sdl2-config # configure backend flags BACKEND_CFLAGS := -DRAPI_$(RENDER_API)=1 -DWAPI_$(WINDOW_API)=1 -DAAPI_$(AUDIO_API)=1 + +# rmodern +ifeq ($(RMODERN),1) + BACKEND_CFLAGS += -DRMODERN +endif + # can have multiple controller APIs BACKEND_CFLAGS += $(foreach capi,$(CONTROLLER_API),-DCAPI_$(capi)=1) BACKEND_LDFLAGS := diff --git a/src/pc/pc_main.c b/src/pc/pc_main.c index ed6ee74..d6df5f1 100644 --- a/src/pc/pc_main.c +++ b/src/pc/pc_main.c @@ -171,6 +171,14 @@ static void on_anim_frame(double time) { } #endif + +#ifdef RMODERN +#include "rmodern/rmodern.h" +void main_func(void) +{ + rmodern_init(); +} +#else void main_func(void) { static u64 pool[0x165000/8 / 4 * sizeof(void *)]; main_pool_init(pool, pool + sizeof(pool) / sizeof(pool[0])); @@ -261,6 +269,7 @@ void main_func(void) { } #endif } +#endif int main(int argc, char *argv[]) { parse_cli_opts(argc, argv); diff --git a/src/pc/rmodern/rmodern.h b/src/pc/rmodern/rmodern.h new file mode 100644 index 0000000..329336c --- /dev/null +++ b/src/pc/rmodern/rmodern.h @@ -0,0 +1,18 @@ +/** + * This header file provides the interface between modern rendering functionality, + * written in C++, and the rest of the codebase. + */ + +#ifndef RMODERN_H +#define RMODERN_H +#ifdef __cplusplus + extern "C" + { +#endif + +void rmodern_init(); + +#ifdef __cplusplus + } +#endif +#endif \ No newline at end of file diff --git a/src/pc/rmodern/rmodern_main.cpp b/src/pc/rmodern/rmodern_main.cpp new file mode 100644 index 0000000..893a707 --- /dev/null +++ b/src/pc/rmodern/rmodern_main.cpp @@ -0,0 +1,8 @@ +#include "rmodern.h" + +#include + +void rmodern_init() +{ + std::cout << "Hello, world!! ^-^" << std::endl; +} \ No newline at end of file