mirror of
https://github.com/AntonioND/nitro-engine.git
synced 2025-06-19 00:55:38 -04:00
Compare commits
81 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
8932de1fff | ||
![]() |
86955bc0a0 | ||
![]() |
6e1dca996c | ||
![]() |
02f3cd7012 | ||
![]() |
926bb4f361 | ||
![]() |
f6b0200be3 | ||
![]() |
d42cb2c08e | ||
![]() |
d52a92812e | ||
![]() |
cb2e62f953 | ||
![]() |
5a10679dfb | ||
![]() |
b67c60d5f0 | ||
![]() |
fff1a65647 | ||
![]() |
efbf4b6546 | ||
![]() |
dd20800334 | ||
![]() |
39117696aa | ||
![]() |
459d8f8960 | ||
![]() |
e5ae245674 | ||
![]() |
8a18dfa586 | ||
![]() |
de9ca58286 | ||
![]() |
446e27110e | ||
![]() |
09c3712431 | ||
![]() |
a6738a9ab5 | ||
![]() |
afdd56eda4 | ||
![]() |
fe6e4a0dcc | ||
![]() |
4642bdf982 | ||
![]() |
26823c024f | ||
![]() |
5a4824f461 | ||
![]() |
de16a59722 | ||
![]() |
4115a62800 | ||
![]() |
88d1b489f6 | ||
![]() |
7d13c2d637 | ||
![]() |
5dda97fe52 | ||
![]() |
c2af70fe15 | ||
![]() |
dce5e99f0f | ||
![]() |
1c752174e9 | ||
![]() |
935f7eb084 | ||
![]() |
0f92fc9da7 | ||
![]() |
3f4bfbdb25 | ||
![]() |
b52b704000 | ||
![]() |
902314a2ac | ||
![]() |
3ba35ba48e | ||
![]() |
381e4071ac | ||
![]() |
ccb3739f98 | ||
![]() |
230a65541e | ||
![]() |
7dda3abe54 | ||
![]() |
3f3e266a4f | ||
![]() |
5ce71a9b02 | ||
![]() |
12b7389d1f | ||
![]() |
48ff37231f | ||
![]() |
ff734036fc | ||
![]() |
d7ecc5cc4d | ||
![]() |
5ea29c4f81 | ||
![]() |
b40f67c593 | ||
![]() |
8cb10264bb | ||
![]() |
cf1a3c48e2 | ||
![]() |
b0d9151455 | ||
![]() |
82171bbf69 | ||
![]() |
47c8061168 | ||
![]() |
9f81541075 | ||
![]() |
a06617a93f | ||
![]() |
fc73687b79 | ||
![]() |
052a15b974 | ||
![]() |
bf63ddea8a | ||
![]() |
636a7d73c3 | ||
![]() |
521012d4d1 | ||
![]() |
15ce18b74c | ||
![]() |
dd746c0ef5 | ||
![]() |
a49ddecda7 | ||
![]() |
30ac9ab8e9 | ||
![]() |
edf4457d49 | ||
![]() |
e952990ae4 | ||
![]() |
3273bd7333 | ||
![]() |
c22fa167e7 | ||
![]() |
5a2b722128 | ||
![]() |
227bffddc5 | ||
![]() |
a85b16284f | ||
![]() |
006bcf9d01 | ||
![]() |
366a9532c1 | ||
![]() |
719935647a | ||
![]() |
e94ed5b4e3 | ||
![]() |
935c06e296 |
79
.github/workflows/build.yml
vendored
Normal file
79
.github/workflows/build.yml
vendored
Normal file
@ -0,0 +1,79 @@
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
#
|
||||
# SPDX-FileContributor: Antonio Niño Díaz, 2025
|
||||
|
||||
name: Documentation
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'master'
|
||||
paths-ignore:
|
||||
- '**.rst'
|
||||
- 'examples'
|
||||
- 'licenses'
|
||||
- 'Makefile*'
|
||||
- 'source*'
|
||||
- 'tests'
|
||||
- 'tools'
|
||||
workflow_dispatch:
|
||||
repository_dispatch:
|
||||
types: [run_build]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
pages: write
|
||||
id-token: write
|
||||
packages: write
|
||||
|
||||
jobs:
|
||||
|
||||
generate_website:
|
||||
name: Generate website
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: true
|
||||
|
||||
steps:
|
||||
- name: Clone project
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: 'master'
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get install doxygen
|
||||
|
||||
- name: Build documentation
|
||||
run: |
|
||||
cd documentation
|
||||
bash generate.sh
|
||||
|
||||
# Create tarball with everything to upload to GitHub pages
|
||||
cd html
|
||||
tar -cvf ../../repo.tar ./*
|
||||
|
||||
- name: Upload repo artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: github-pages
|
||||
path: repo.tar
|
||||
if-no-files-found: error
|
||||
|
||||
publish_repo:
|
||||
name: Publish website with GitHub pages
|
||||
if: contains(github.ref,'refs/heads/master')
|
||||
needs: [generate_website]
|
||||
runs-on: ubuntu-latest
|
||||
environment:
|
||||
name: github-pages
|
||||
url: ${{ steps.deployment.outputs.page_url }}
|
||||
|
||||
steps:
|
||||
- name: Setup Pages
|
||||
uses: actions/configure-pages@v5
|
||||
|
||||
- name: Deploy to GitHub Pages
|
||||
id: deployment
|
||||
uses: actions/deploy-pages@v4
|
146
Makefile
146
Makefile
@ -1,139 +1,23 @@
|
||||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#---------------------------------------------------------------------------------
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
#
|
||||
# SPDX-FileContributor: Antonio Niño Díaz, 2024
|
||||
|
||||
ifeq ($(strip $(DEVKITARM)),)
|
||||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
||||
endif
|
||||
# Tools
|
||||
# -----
|
||||
|
||||
include $(DEVKITARM)/ds_rules
|
||||
MAKE := make
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# TARGET is the name of the output
|
||||
# BUILD is the directory where object files & intermediate files will be placed
|
||||
# SOURCES is a list of directories containing source code
|
||||
# DATA is a list of directories containing data files
|
||||
# INCLUDES is a list of directories containing header files
|
||||
#---------------------------------------------------------------------------------
|
||||
SOURCES := source source/dsma source/libdsf
|
||||
DATA := data
|
||||
INCLUDES := include source/libdsf
|
||||
# Targets
|
||||
# -------
|
||||
|
||||
ifeq ($(NE_DEBUG),1)
|
||||
TARGET := NE_debug
|
||||
BUILD := build_debug
|
||||
else
|
||||
TARGET := NE
|
||||
BUILD := build_release
|
||||
endif
|
||||
.PHONY: all install clean
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# options for code generation
|
||||
#---------------------------------------------------------------------------------
|
||||
ARCH := -mthumb -mthumb-interwork
|
||||
all:
|
||||
$(MAKE) -f Makefile.blocksds
|
||||
$(MAKE) -f Makefile.blocksds NE_DEBUG=1
|
||||
|
||||
CFLAGS := -g -Wall -O2\
|
||||
-march=armv5te -mtune=arm946e-s \
|
||||
-fomit-frame-pointer -ffast-math \
|
||||
$(ARCH) -Wno-address-of-packed-member
|
||||
install: all
|
||||
$(MAKE) -f Makefile.blocksds install
|
||||
|
||||
ifeq ($(NE_DEBUG),1)
|
||||
CFLAGS += -DNE_DEBUG
|
||||
endif
|
||||
|
||||
CFLAGS += $(INCLUDE) -DARM9
|
||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
|
||||
|
||||
ASFLAGS := -g $(ARCH) -march=armv5te -mtune=arm946e-s
|
||||
LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# any extra libraries we wish to link with the project
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBS :=
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# list of directories containing libraries, this must be the top level containing
|
||||
# include and lib
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBDIRS := $(LIBNDS)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# no real need to edit anything past this point unless you need to add additional
|
||||
# rules for different file extensions
|
||||
#---------------------------------------------------------------------------------
|
||||
ifneq ($(BUILD),$(notdir $(CURDIR)))
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
export OUTPUT := $(CURDIR)/lib/lib$(TARGET).a
|
||||
|
||||
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
|
||||
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
|
||||
|
||||
export DEPSDIR := $(CURDIR)/$(BUILD)
|
||||
|
||||
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
|
||||
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
|
||||
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
|
||||
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# use CXX for linking C++ projects, CC for standard C
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(CPPFILES)),)
|
||||
#---------------------------------------------------------------------------------
|
||||
export LD := $(CC)
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
#---------------------------------------------------------------------------------
|
||||
export LD := $(CXX)
|
||||
#---------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
export OFILES := $(addsuffix .o,$(BINFILES)) \
|
||||
$(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
|
||||
|
||||
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
||||
-I$(CURDIR)/$(BUILD)
|
||||
|
||||
.PHONY: $(BUILD) clean all
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
all: $(BUILD)
|
||||
|
||||
lib:
|
||||
@[ -d $@ ] || mkdir -p $@
|
||||
|
||||
$(BUILD): lib
|
||||
@[ -d $@ ] || mkdir -p $@
|
||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
clean:
|
||||
@echo clean ...
|
||||
@rm -fr build_debug build_release lib
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
|
||||
DEPENDS := $(OFILES:.o=.d)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# main targets
|
||||
#---------------------------------------------------------------------------------
|
||||
$(OUTPUT) : $(OFILES)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.bin.o : %.bin
|
||||
#---------------------------------------------------------------------------------
|
||||
@echo $(notdir $<)
|
||||
@$(bin2o)
|
||||
|
||||
|
||||
-include $(DEPENDS)
|
||||
|
||||
#---------------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------------
|
||||
$(MAKE) -f Makefile.blocksds clean
|
||||
|
@ -49,7 +49,7 @@ ARCHIVE := lib/lib$(NAME).a
|
||||
PREFIX := $(ARM_NONE_EABI_PATH)arm-none-eabi-
|
||||
CC := $(PREFIX)gcc
|
||||
CXX := $(PREFIX)g++
|
||||
AR := ar
|
||||
AR := $(PREFIX)ar
|
||||
MKDIR := mkdir
|
||||
RM := rm -rf
|
||||
CP := cp
|
||||
@ -92,16 +92,16 @@ WARNFLAGS := -Wall -Wno-address-of-packed-member
|
||||
INCLUDEFLAGS := $(foreach path,$(INCLUDEDIRS),-I$(path)) \
|
||||
$(foreach path,$(LIBDIRS),-I$(path)/include)
|
||||
|
||||
ASFLAGS += -x assembler-with-cpp $(DEFINES) $(ARCH) \
|
||||
ASFLAGS += -g -x assembler-with-cpp $(DEFINES) $(ARCH) \
|
||||
-mthumb -mthumb-interwork $(INCLUDEFLAGS) \
|
||||
-ffunction-sections -fdata-sections
|
||||
|
||||
CFLAGS += -std=gnu11 $(WARNFLAGS) $(DEFINES) $(ARCH) \
|
||||
CFLAGS += -g -std=gnu11 $(WARNFLAGS) $(DEFINES) $(ARCH) \
|
||||
-mthumb -mthumb-interwork $(INCLUDEFLAGS) -O2 \
|
||||
-ffunction-sections -fdata-sections \
|
||||
-fomit-frame-pointer
|
||||
|
||||
CXXFLAGS += -std=gnu++14 $(WARNFLAGS) $(DEFINES) $(ARCH) \
|
||||
CXXFLAGS += -g -std=gnu++14 $(WARNFLAGS) $(DEFINES) $(ARCH) \
|
||||
-mthumb -mthumb-interwork $(INCLUDEFLAGS) -O2 \
|
||||
-ffunction-sections -fdata-sections \
|
||||
-fno-exceptions -fno-rtti \
|
||||
@ -147,6 +147,7 @@ install: all
|
||||
$(V)$(CP) -r tools/img2ds/*.py $(BLOCKSDSEXT)/$(INSTALLNAME)/tools/img2ds
|
||||
$(V)$(CP) -r tools/md5_to_dsma/*.py $(BLOCKSDSEXT)/$(INSTALLNAME)/tools/md5_to_dsma
|
||||
$(V)$(CP) -r tools/obj2dl/*.py $(BLOCKSDSEXT)/$(INSTALLNAME)/tools/obj2dl
|
||||
$(V)$(CP) -r licenses $(BLOCKSDSEXT)/$(INSTALLNAME)/
|
||||
|
||||
clean:
|
||||
@echo " CLEAN"
|
||||
|
@ -1,6 +1,81 @@
|
||||
Changelog
|
||||
=========
|
||||
|
||||
Version 0.15.3 (2025-03-26)
|
||||
---------------------------
|
||||
|
||||
- The devkitARM makefiles have been removed as they only work with old versions
|
||||
of devkitARM, which aren't supported by its maintainers. The code and examples
|
||||
of Nitro Engine will probably need changes to work with current devkitARM.
|
||||
- The GRF files used in an example have been updated, they were built before the
|
||||
format was changed.
|
||||
- The build scripts for assets have been modified to use the value of the
|
||||
environment variables ``BLOCKSDS`` and ``BLOCKSDSEXT`` if they are found.
|
||||
- Build library with debug symbols to help debug applications that use it.
|
||||
|
||||
Version 0.15.2 (2025-01-15)
|
||||
---------------------------
|
||||
|
||||
- Fix `ar` binary used to build the library.
|
||||
- Update documentation.
|
||||
- Fix build of examples in devkitARM.
|
||||
- Improve setup instructions.
|
||||
|
||||
Version 0.15.1 (2024-12-23)
|
||||
---------------------------
|
||||
|
||||
- Install licenses with the rest of the library.
|
||||
- Clarify some comments in examples.
|
||||
|
||||
Version 0.15.0 (2024-12-01)
|
||||
---------------------------
|
||||
|
||||
- Allow users to specify the transformation matrix of a model manually.
|
||||
- Fix a devkitARM Makefile in an example.
|
||||
|
||||
Version 0.14.0 (2024-09-10)
|
||||
---------------------------
|
||||
|
||||
- Use ``stdint.h`` types instead of libnds types.
|
||||
- Update BlocksDS makefiles.
|
||||
- Update libdsf to v0.1.3.
|
||||
- Fix some memory leaks/use-after-free bugs in the RichText module.
|
||||
|
||||
Version 0.13.0 (2024-06-08)
|
||||
---------------------------
|
||||
|
||||
- Define BlocksDS as the main toolchain to use with Nitro Engine.
|
||||
- Simplify build and installation instructions of the library.
|
||||
- Update ``md5_2_dsma`` to correctly export the base animation of models.
|
||||
- Stop using ``NE_RGB5`` in the examples, this format is discouraged.
|
||||
- Optimize copy of ``NE_RGB5`` textures to VRAM.
|
||||
|
||||
Version 0.12.0 (2024-03-30)
|
||||
---------------------------
|
||||
|
||||
- Deprecate ``NE_ShadingEnable()``. The name was misleading. All examples that
|
||||
use it have stopped calling it.
|
||||
- For sprites, add a way to specify texture coordinates inside the material to
|
||||
use a small part of the texture instead of the whole texture:
|
||||
``NE_SpriteSetMaterialCanvas()``. This is now used in the sprites example.
|
||||
- Stop using global variables in most examples. Instead, the rendering functions
|
||||
get values through the arguments of ``NE_ProcessArg()`` and
|
||||
``NE_ProcessDualArg()``.
|
||||
- Don't expect palette objects when loading GRF files if the file doesn't
|
||||
contain a palette.
|
||||
- Allow loading BMFont fonts from RAM, not just nitroFS. Add an example of
|
||||
using rich text fonts from RAM.
|
||||
- Added a function to reset the rich text font system. Also add a function to
|
||||
return the size that a specific text string would have if drawn.
|
||||
- Add shadow volume example.
|
||||
- Build some functions that do lots of multiplications as ARM to increase
|
||||
performance.
|
||||
- Fix compilation with devkitARM.
|
||||
- Fix linker invocation for C++ with BlocksDS.
|
||||
- Update libDSF to version 0.1.2, with some speed improvements.
|
||||
- Relicensed libDSF under "Zlib OR MIT" to simplify licensing with Nitro Engine.
|
||||
- Some minor documentation improvements.
|
||||
|
||||
Version 0.11.0 (2024-03-02)
|
||||
---------------------------
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Doxyfile 1.9.4
|
||||
# Doxyfile 1.9.8
|
||||
|
||||
# This file describes the settings to be used by the documentation system
|
||||
# doxygen (www.doxygen.org) for a project.
|
||||
@ -19,7 +19,8 @@
|
||||
# configuration file:
|
||||
# doxygen -x [configFile]
|
||||
# Use doxygen to compare the used configuration file with the template
|
||||
# configuration file without replacing the environment variables:
|
||||
# configuration file without replacing the environment variables or CMake type
|
||||
# replacement variables:
|
||||
# doxygen -x_noenv [configFile]
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
@ -47,7 +48,7 @@ PROJECT_NAME = "Nitro Engine"
|
||||
# could be handy for archiving the generated documentation or if some version
|
||||
# control system is used.
|
||||
|
||||
PROJECT_NUMBER = 0.11.0
|
||||
PROJECT_NUMBER = 0.15.3
|
||||
|
||||
# Using the PROJECT_BRIEF tag one can provide an optional one line description
|
||||
# for a project that appears at the top of each page and should give viewer a
|
||||
@ -85,7 +86,7 @@ CREATE_SUBDIRS = NO
|
||||
# level increment doubles the number of directories, resulting in 4096
|
||||
# directories at level 8 which is the default and also the maximum value. The
|
||||
# sub-directories are organized in 2 levels, the first level always has a fixed
|
||||
# numer of 16 directories.
|
||||
# number of 16 directories.
|
||||
# Minimum value: 0, maximum value: 8, default value: 8.
|
||||
# This tag requires that the tag CREATE_SUBDIRS is set to YES.
|
||||
|
||||
@ -362,6 +363,17 @@ MARKDOWN_SUPPORT = YES
|
||||
|
||||
TOC_INCLUDE_HEADINGS = 0
|
||||
|
||||
# The MARKDOWN_ID_STYLE tag can be used to specify the algorithm used to
|
||||
# generate identifiers for the Markdown headings. Note: Every identifier is
|
||||
# unique.
|
||||
# Possible values are: DOXYGEN use a fixed 'autotoc_md' string followed by a
|
||||
# sequence number starting at 0 and GITHUB use the lower case version of title
|
||||
# with any whitespace replaced by '-' and punctuation characters removed.
|
||||
# The default value is: DOXYGEN.
|
||||
# This tag requires that the tag MARKDOWN_SUPPORT is set to YES.
|
||||
|
||||
MARKDOWN_ID_STYLE = DOXYGEN
|
||||
|
||||
# When enabled doxygen tries to link words that correspond to documented
|
||||
# classes, or namespaces to their corresponding documentation. Such a link can
|
||||
# be prevented in individual cases by putting a % sign in front of the word or
|
||||
@ -486,6 +498,14 @@ LOOKUP_CACHE_SIZE = 0
|
||||
|
||||
NUM_PROC_THREADS = 1
|
||||
|
||||
# If the TIMESTAMP tag is set different from NO then each generated page will
|
||||
# contain the date or date and time when the page was generated. Setting this to
|
||||
# NO can help when comparing the output of multiple runs.
|
||||
# Possible values are: YES, NO, DATETIME and DATE.
|
||||
# The default value is: NO.
|
||||
|
||||
TIMESTAMP = NO
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Build related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
@ -567,7 +587,8 @@ HIDE_UNDOC_MEMBERS = YES
|
||||
# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all
|
||||
# undocumented classes that are normally visible in the class hierarchy. If set
|
||||
# to NO, these classes will be included in the various overviews. This option
|
||||
# has no effect if EXTRACT_ALL is enabled.
|
||||
# will also hide undocumented C++ concepts if enabled. This option has no effect
|
||||
# if EXTRACT_ALL is enabled.
|
||||
# The default value is: NO.
|
||||
|
||||
HIDE_UNDOC_CLASSES = YES
|
||||
@ -605,7 +626,8 @@ INTERNAL_DOCS = NO
|
||||
# Windows (including Cygwin) and MacOS, users should typically set this option
|
||||
# to NO, whereas on Linux or other Unix flavors it should typically be set to
|
||||
# YES.
|
||||
# The default value is: system dependent.
|
||||
# Possible values are: SYSTEM, NO and YES.
|
||||
# The default value is: SYSTEM.
|
||||
|
||||
CASE_SENSE_NAMES = YES
|
||||
|
||||
@ -857,11 +879,26 @@ WARN_IF_INCOMPLETE_DOC = YES
|
||||
|
||||
WARN_NO_PARAMDOC = YES
|
||||
|
||||
# If WARN_IF_UNDOC_ENUM_VAL option is set to YES, doxygen will warn about
|
||||
# undocumented enumeration values. If set to NO, doxygen will accept
|
||||
# undocumented enumeration values. If EXTRACT_ALL is set to YES then this flag
|
||||
# will automatically be disabled.
|
||||
# The default value is: NO.
|
||||
|
||||
WARN_IF_UNDOC_ENUM_VAL = NO
|
||||
|
||||
# If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when
|
||||
# a warning is encountered. If the WARN_AS_ERROR tag is set to FAIL_ON_WARNINGS
|
||||
# then doxygen will continue running as if WARN_AS_ERROR tag is set to NO, but
|
||||
# at the end of the doxygen process doxygen will return with a non-zero status.
|
||||
# Possible values are: NO, YES and FAIL_ON_WARNINGS.
|
||||
# If the WARN_AS_ERROR tag is set to FAIL_ON_WARNINGS_PRINT then doxygen behaves
|
||||
# like FAIL_ON_WARNINGS but in case no WARN_LOGFILE is defined doxygen will not
|
||||
# write the warning messages in between other messages but write them at the end
|
||||
# of a run, in case a WARN_LOGFILE is defined the warning messages will be
|
||||
# besides being in the defined file also be shown at the end of a run, unless
|
||||
# the WARN_LOGFILE is defined as - i.e. standard output (stdout) in that case
|
||||
# the behavior will remain as with the setting FAIL_ON_WARNINGS.
|
||||
# Possible values are: NO, YES, FAIL_ON_WARNINGS and FAIL_ON_WARNINGS_PRINT.
|
||||
# The default value is: NO.
|
||||
|
||||
WARN_AS_ERROR = NO
|
||||
@ -914,10 +951,21 @@ INPUT = ../source \
|
||||
# libiconv (or the iconv built into libc) for the transcoding. See the libiconv
|
||||
# documentation (see:
|
||||
# https://www.gnu.org/software/libiconv/) for the list of possible encodings.
|
||||
# See also: INPUT_FILE_ENCODING
|
||||
# The default value is: UTF-8.
|
||||
|
||||
INPUT_ENCODING = UTF-8
|
||||
|
||||
# This tag can be used to specify the character encoding of the source files
|
||||
# that doxygen parses The INPUT_FILE_ENCODING tag can be used to specify
|
||||
# character encoding on a per file pattern basis. Doxygen will compare the file
|
||||
# name with each pattern and apply the encoding instead of the default
|
||||
# INPUT_ENCODING) if there is a match. The character encodings are a list of the
|
||||
# form: pattern=encoding (like *.php=ISO-8859-1). See cfg_input_encoding
|
||||
# "INPUT_ENCODING" for further information on supported encodings.
|
||||
|
||||
INPUT_FILE_ENCODING =
|
||||
|
||||
# If the value of the INPUT tag contains directories, you can use the
|
||||
# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and
|
||||
# *.h) to filter out the source-files in the directories.
|
||||
@ -929,12 +977,12 @@ INPUT_ENCODING = UTF-8
|
||||
# Note the list of default checked file patterns might differ from the list of
|
||||
# default file extension mappings.
|
||||
#
|
||||
# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp,
|
||||
# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h,
|
||||
# *.hh, *.hxx, *.hpp, *.h++, *.l, *.cs, *.d, *.php, *.php4, *.php5, *.phtml,
|
||||
# *.inc, *.m, *.markdown, *.md, *.mm, *.dox (to be provided as doxygen C
|
||||
# comment), *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, *.f18, *.f, *.for, *.vhd,
|
||||
# *.vhdl, *.ucf, *.qsf and *.ice.
|
||||
# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cxxm,
|
||||
# *.cpp, *.cppm, *.c++, *.c++m, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl,
|
||||
# *.ddl, *.odl, *.h, *.hh, *.hxx, *.hpp, *.h++, *.ixx, *.l, *.cs, *.d, *.php,
|
||||
# *.php4, *.php5, *.phtml, *.inc, *.m, *.markdown, *.md, *.mm, *.dox (to be
|
||||
# provided as doxygen C comment), *.py, *.pyw, *.f90, *.f95, *.f03, *.f08,
|
||||
# *.f18, *.f, *.for, *.vhd, *.vhdl, *.ucf, *.qsf and *.ice.
|
||||
|
||||
FILE_PATTERNS = *.c \
|
||||
*.h
|
||||
@ -975,9 +1023,6 @@ EXCLUDE_PATTERNS =
|
||||
# output. The symbol name can be a fully qualified name, a word, or if the
|
||||
# wildcard * is used, a substring. Examples: ANamespace, AClass,
|
||||
# ANamespace::AClass, ANamespace::*Test
|
||||
#
|
||||
# Note that the wildcards are matched against the file with absolute path, so to
|
||||
# exclude all test directories use the pattern */test/*
|
||||
|
||||
EXCLUDE_SYMBOLS =
|
||||
|
||||
@ -1022,6 +1067,11 @@ IMAGE_PATH =
|
||||
# code is scanned, but not when the output code is generated. If lines are added
|
||||
# or removed, the anchors will not be placed correctly.
|
||||
#
|
||||
# Note that doxygen will use the data processed and written to standard output
|
||||
# for further processing, therefore nothing else, like debug statements or used
|
||||
# commands (so in case of a Windows batch file always use @echo OFF), should be
|
||||
# written to standard output.
|
||||
#
|
||||
# Note that for custom extensions or not directly supported extensions you also
|
||||
# need to set EXTENSION_MAPPING for the extension otherwise the files are not
|
||||
# properly processed by doxygen.
|
||||
@ -1063,6 +1113,15 @@ FILTER_SOURCE_PATTERNS =
|
||||
|
||||
USE_MDFILE_AS_MAINPAGE =
|
||||
|
||||
# The Fortran standard specifies that for fixed formatted Fortran code all
|
||||
# characters from position 72 are to be considered as comment. A common
|
||||
# extension is to allow longer lines before the automatic comment starts. The
|
||||
# setting FORTRAN_COMMENT_AFTER will also make it possible that longer lines can
|
||||
# be processed before the automatic comment starts.
|
||||
# Minimum value: 7, maximum value: 10000, default value: 72.
|
||||
|
||||
FORTRAN_COMMENT_AFTER = 72
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to source browsing
|
||||
#---------------------------------------------------------------------------
|
||||
@ -1200,10 +1259,11 @@ CLANG_DATABASE_PATH =
|
||||
|
||||
ALPHABETICAL_INDEX = YES
|
||||
|
||||
# In case all classes in a project start with a common prefix, all classes will
|
||||
# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag
|
||||
# can be used to specify a prefix (or a list of prefixes) that should be ignored
|
||||
# while generating the index headers.
|
||||
# The IGNORE_PREFIX tag can be used to specify a prefix (or a list of prefixes)
|
||||
# that should be ignored while generating the index headers. The IGNORE_PREFIX
|
||||
# tag works for classes, function and member names. The entity will be placed in
|
||||
# the alphabetical list under the first letter of the entity name that remains
|
||||
# after removing the prefix.
|
||||
# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
|
||||
|
||||
IGNORE_PREFIX =
|
||||
@ -1282,7 +1342,12 @@ HTML_STYLESHEET =
|
||||
# Doxygen will copy the style sheet files to the output directory.
|
||||
# Note: The order of the extra style sheet files is of importance (e.g. the last
|
||||
# style sheet in the list overrules the setting of the previous ones in the
|
||||
# list). For an example see the documentation.
|
||||
# list).
|
||||
# Note: Since the styling of scrollbars can currently not be overruled in
|
||||
# Webkit/Chromium, the styling will be left out of the default doxygen.css if
|
||||
# one or more extra stylesheets have been specified. So if scrollbar
|
||||
# customization is desired it has to be added explicitly. For an example see the
|
||||
# documentation.
|
||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||
|
||||
HTML_EXTRA_STYLESHEET =
|
||||
@ -1297,6 +1362,19 @@ HTML_EXTRA_STYLESHEET =
|
||||
|
||||
HTML_EXTRA_FILES =
|
||||
|
||||
# The HTML_COLORSTYLE tag can be used to specify if the generated HTML output
|
||||
# should be rendered with a dark or light theme.
|
||||
# Possible values are: LIGHT always generate light mode output, DARK always
|
||||
# generate dark mode output, AUTO_LIGHT automatically set the mode according to
|
||||
# the user preference, use light mode if no preference is set (the default),
|
||||
# AUTO_DARK automatically set the mode according to the user preference, use
|
||||
# dark mode if no preference is set and TOGGLE allow to user to switch between
|
||||
# light and dark mode via a button.
|
||||
# The default value is: AUTO_LIGHT.
|
||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||
|
||||
HTML_COLORSTYLE = AUTO_LIGHT
|
||||
|
||||
# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen
|
||||
# will adjust the colors in the style sheet and background images according to
|
||||
# this color. Hue is specified as an angle on a color-wheel, see
|
||||
@ -1327,15 +1405,6 @@ HTML_COLORSTYLE_SAT = 100
|
||||
|
||||
HTML_COLORSTYLE_GAMMA = 80
|
||||
|
||||
# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
|
||||
# page will contain the date and time when the page was generated. Setting this
|
||||
# to YES can help to show when doxygen was last run and thus if the
|
||||
# documentation is up to date.
|
||||
# The default value is: NO.
|
||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||
|
||||
HTML_TIMESTAMP = NO
|
||||
|
||||
# If the HTML_DYNAMIC_MENUS tag is set to YES then the generated HTML
|
||||
# documentation will contain a main index with vertical navigation menus that
|
||||
# are dynamically created via JavaScript. If disabled, the navigation index will
|
||||
@ -1355,6 +1424,13 @@ HTML_DYNAMIC_MENUS = YES
|
||||
|
||||
HTML_DYNAMIC_SECTIONS = NO
|
||||
|
||||
# If the HTML_CODE_FOLDING tag is set to YES then classes and functions can be
|
||||
# dynamically folded and expanded in the generated HTML source code.
|
||||
# The default value is: YES.
|
||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||
|
||||
HTML_CODE_FOLDING = YES
|
||||
|
||||
# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries
|
||||
# shown in the various tree structured indices initially; the user can expand
|
||||
# and collapse entries dynamically later on. Doxygen will expand the tree to
|
||||
@ -1485,6 +1561,16 @@ BINARY_TOC = NO
|
||||
|
||||
TOC_EXPAND = NO
|
||||
|
||||
# The SITEMAP_URL tag is used to specify the full URL of the place where the
|
||||
# generated documentation will be placed on the server by the user during the
|
||||
# deployment of the documentation. The generated sitemap is called sitemap.xml
|
||||
# and placed on the directory specified by HTML_OUTPUT. In case no SITEMAP_URL
|
||||
# is specified no sitemap is generated. For information about the sitemap
|
||||
# protocol see https://www.sitemaps.org
|
||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||
|
||||
SITEMAP_URL =
|
||||
|
||||
# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and
|
||||
# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that
|
||||
# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help
|
||||
@ -1660,17 +1746,6 @@ HTML_FORMULA_FORMAT = png
|
||||
|
||||
FORMULA_FONTSIZE = 10
|
||||
|
||||
# Use the FORMULA_TRANSPARENT tag to determine whether or not the images
|
||||
# generated for formulas are transparent PNGs. Transparent PNGs are not
|
||||
# supported properly for IE 6.0, but are supported on all modern browsers.
|
||||
#
|
||||
# Note that when changing this option you need to delete any form_*.png files in
|
||||
# the HTML output directory before the changes have effect.
|
||||
# The default value is: YES.
|
||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||
|
||||
FORMULA_TRANSPARENT = YES
|
||||
|
||||
# The FORMULA_MACROFILE can contain LaTeX \newcommand and \renewcommand commands
|
||||
# to create new LaTeX commands to be used in formulas as building blocks. See
|
||||
# the section "Including formulas" for details.
|
||||
@ -1984,9 +2059,16 @@ PDF_HYPERLINKS = YES
|
||||
|
||||
USE_PDFLATEX = YES
|
||||
|
||||
# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \batchmode
|
||||
# command to the generated LaTeX files. This will instruct LaTeX to keep running
|
||||
# if errors occur, instead of asking the user for help.
|
||||
# The LATEX_BATCHMODE tag signals the behavior of LaTeX in case of an error.
|
||||
# Possible values are: NO same as ERROR_STOP, YES same as BATCH, BATCH In batch
|
||||
# mode nothing is printed on the terminal, errors are scrolled as if <return> is
|
||||
# hit at every error; missing files that TeX tries to input or request from
|
||||
# keyboard input (\read on a not open input stream) cause the job to abort,
|
||||
# NON_STOP In nonstop mode the diagnostic message will appear on the terminal,
|
||||
# but there is no possibility of user interaction just like in batch mode,
|
||||
# SCROLL In scroll mode, TeX will stop only for missing files to input or if
|
||||
# keyboard input is necessary and ERROR_STOP In errorstop mode, TeX will stop at
|
||||
# each error, asking for user intervention.
|
||||
# The default value is: NO.
|
||||
# This tag requires that the tag GENERATE_LATEX is set to YES.
|
||||
|
||||
@ -2007,14 +2089,6 @@ LATEX_HIDE_INDICES = NO
|
||||
|
||||
LATEX_BIB_STYLE = plain
|
||||
|
||||
# If the LATEX_TIMESTAMP tag is set to YES then the footer of each generated
|
||||
# page will contain the date and time when the page was generated. Setting this
|
||||
# to NO can help when comparing the output of multiple runs.
|
||||
# The default value is: NO.
|
||||
# This tag requires that the tag GENERATE_LATEX is set to YES.
|
||||
|
||||
LATEX_TIMESTAMP = NO
|
||||
|
||||
# The LATEX_EMOJI_DIRECTORY tag is used to specify the (relative or absolute)
|
||||
# path from which the emoji images will be read. If a relative path is entered,
|
||||
# it will be relative to the LATEX_OUTPUT directory. If left blank the
|
||||
@ -2180,13 +2254,39 @@ DOCBOOK_OUTPUT = docbook
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
# If the GENERATE_AUTOGEN_DEF tag is set to YES, doxygen will generate an
|
||||
# AutoGen Definitions (see http://autogen.sourceforge.net/) file that captures
|
||||
# AutoGen Definitions (see https://autogen.sourceforge.net/) file that captures
|
||||
# the structure of the code including all documentation. Note that this feature
|
||||
# is still experimental and incomplete at the moment.
|
||||
# The default value is: NO.
|
||||
|
||||
GENERATE_AUTOGEN_DEF = NO
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to Sqlite3 output
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
# If the GENERATE_SQLITE3 tag is set to YES doxygen will generate a Sqlite3
|
||||
# database with symbols found by doxygen stored in tables.
|
||||
# The default value is: NO.
|
||||
|
||||
GENERATE_SQLITE3 = NO
|
||||
|
||||
# The SQLITE3_OUTPUT tag is used to specify where the Sqlite3 database will be
|
||||
# put. If a relative path is entered the value of OUTPUT_DIRECTORY will be put
|
||||
# in front of it.
|
||||
# The default directory is: sqlite3.
|
||||
# This tag requires that the tag GENERATE_SQLITE3 is set to YES.
|
||||
|
||||
SQLITE3_OUTPUT = sqlite3
|
||||
|
||||
# The SQLITE3_OVERWRITE_DB tag is set to YES, the existing doxygen_sqlite3.db
|
||||
# database file will be recreated with each doxygen run. If set to NO, doxygen
|
||||
# will warn if an a database file is already found and not modify it.
|
||||
# The default value is: YES.
|
||||
# This tag requires that the tag GENERATE_SQLITE3 is set to YES.
|
||||
|
||||
SQLITE3_RECREATE_DB = YES
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the Perl module output
|
||||
#---------------------------------------------------------------------------
|
||||
@ -2329,15 +2429,15 @@ TAGFILES =
|
||||
|
||||
GENERATE_TAGFILE =
|
||||
|
||||
# If the ALLEXTERNALS tag is set to YES, all external class will be listed in
|
||||
# the class index. If set to NO, only the inherited external classes will be
|
||||
# listed.
|
||||
# If the ALLEXTERNALS tag is set to YES, all external classes and namespaces
|
||||
# will be listed in the class and namespace index. If set to NO, only the
|
||||
# inherited external classes will be listed.
|
||||
# The default value is: NO.
|
||||
|
||||
ALLEXTERNALS = NO
|
||||
|
||||
# If the EXTERNAL_GROUPS tag is set to YES, all external groups will be listed
|
||||
# in the modules index. If set to NO, only the current project's groups will be
|
||||
# in the topic index. If set to NO, only the current project's groups will be
|
||||
# listed.
|
||||
# The default value is: YES.
|
||||
|
||||
@ -2351,16 +2451,9 @@ EXTERNAL_GROUPS = YES
|
||||
EXTERNAL_PAGES = YES
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the dot tool
|
||||
# Configuration options related to diagram generator tools
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
# You can include diagrams made with dia in doxygen documentation. Doxygen will
|
||||
# then run dia to produce the diagram and insert it in the documentation. The
|
||||
# DIA_PATH tag allows you to specify the directory where the dia binary resides.
|
||||
# If left empty dia is assumed to be found in the default search path.
|
||||
|
||||
DIA_PATH =
|
||||
|
||||
# If set to YES the inheritance and collaboration graphs will hide inheritance
|
||||
# and usage relations if the target is undocumented or is not a class.
|
||||
# The default value is: YES.
|
||||
@ -2369,7 +2462,7 @@ HIDE_UNDOC_RELATIONS = YES
|
||||
|
||||
# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
|
||||
# available from the path. This tool is part of Graphviz (see:
|
||||
# http://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent
|
||||
# https://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent
|
||||
# Bell Labs. The other options in this section have no effect if this option is
|
||||
# set to NO
|
||||
# The default value is: YES.
|
||||
@ -2386,37 +2479,51 @@ HAVE_DOT = NO
|
||||
|
||||
DOT_NUM_THREADS = 0
|
||||
|
||||
# When you want a differently looking font in the dot files that doxygen
|
||||
# generates you can specify the font name using DOT_FONTNAME. You need to make
|
||||
# sure dot is able to find the font, which can be done by putting it in a
|
||||
# standard location or by setting the DOTFONTPATH environment variable or by
|
||||
# setting DOT_FONTPATH to the directory containing the font.
|
||||
# The default value is: Helvetica.
|
||||
# DOT_COMMON_ATTR is common attributes for nodes, edges and labels of
|
||||
# subgraphs. When you want a differently looking font in the dot files that
|
||||
# doxygen generates you can specify fontname, fontcolor and fontsize attributes.
|
||||
# For details please see <a href=https://graphviz.org/doc/info/attrs.html>Node,
|
||||
# Edge and Graph Attributes specification</a> You need to make sure dot is able
|
||||
# to find the font, which can be done by putting it in a standard location or by
|
||||
# setting the DOTFONTPATH environment variable or by setting DOT_FONTPATH to the
|
||||
# directory containing the font. Default graphviz fontsize is 14.
|
||||
# The default value is: fontname=Helvetica,fontsize=10.
|
||||
# This tag requires that the tag HAVE_DOT is set to YES.
|
||||
|
||||
DOT_FONTNAME = FreeSans
|
||||
DOT_COMMON_ATTR = "fontname=FreeSans,fontsize=10"
|
||||
|
||||
# The DOT_FONTSIZE tag can be used to set the size (in points) of the font of
|
||||
# dot graphs.
|
||||
# Minimum value: 4, maximum value: 24, default value: 10.
|
||||
# DOT_EDGE_ATTR is concatenated with DOT_COMMON_ATTR. For elegant style you can
|
||||
# add 'arrowhead=open, arrowtail=open, arrowsize=0.5'. <a
|
||||
# href=https://graphviz.org/doc/info/arrows.html>Complete documentation about
|
||||
# arrows shapes.</a>
|
||||
# The default value is: labelfontname=Helvetica,labelfontsize=10.
|
||||
# This tag requires that the tag HAVE_DOT is set to YES.
|
||||
|
||||
DOT_FONTSIZE = 10
|
||||
DOT_EDGE_ATTR = "labelfontname=FreeSans,labelfontsize=10"
|
||||
|
||||
# By default doxygen will tell dot to use the default font as specified with
|
||||
# DOT_FONTNAME. If you specify a different font using DOT_FONTNAME you can set
|
||||
# the path where dot can find it using this tag.
|
||||
# DOT_NODE_ATTR is concatenated with DOT_COMMON_ATTR. For view without boxes
|
||||
# around nodes set 'shape=plain' or 'shape=plaintext' <a
|
||||
# href=https://www.graphviz.org/doc/info/shapes.html>Shapes specification</a>
|
||||
# The default value is: shape=box,height=0.2,width=0.4.
|
||||
# This tag requires that the tag HAVE_DOT is set to YES.
|
||||
|
||||
DOT_NODE_ATTR = "shape=box,height=0.2,width=0.4"
|
||||
|
||||
# You can set the path where dot can find font specified with fontname in
|
||||
# DOT_COMMON_ATTR and others dot attributes.
|
||||
# This tag requires that the tag HAVE_DOT is set to YES.
|
||||
|
||||
DOT_FONTPATH =
|
||||
|
||||
# If the CLASS_GRAPH tag is set to YES (or GRAPH) then doxygen will generate a
|
||||
# graph for each documented class showing the direct and indirect inheritance
|
||||
# relations. In case HAVE_DOT is set as well dot will be used to draw the graph,
|
||||
# otherwise the built-in generator will be used. If the CLASS_GRAPH tag is set
|
||||
# to TEXT the direct and indirect inheritance relations will be shown as texts /
|
||||
# links.
|
||||
# Possible values are: NO, YES, TEXT and GRAPH.
|
||||
# If the CLASS_GRAPH tag is set to YES or GRAPH or BUILTIN then doxygen will
|
||||
# generate a graph for each documented class showing the direct and indirect
|
||||
# inheritance relations. In case the CLASS_GRAPH tag is set to YES or GRAPH and
|
||||
# HAVE_DOT is enabled as well, then dot will be used to draw the graph. In case
|
||||
# the CLASS_GRAPH tag is set to YES and HAVE_DOT is disabled or if the
|
||||
# CLASS_GRAPH tag is set to BUILTIN, then the built-in generator will be used.
|
||||
# If the CLASS_GRAPH tag is set to TEXT the direct and indirect inheritance
|
||||
# relations will be shown as texts / links.
|
||||
# Possible values are: NO, YES, TEXT, GRAPH and BUILTIN.
|
||||
# The default value is: YES.
|
||||
|
||||
CLASS_GRAPH = TEXT
|
||||
@ -2424,15 +2531,21 @@ CLASS_GRAPH = TEXT
|
||||
# If the COLLABORATION_GRAPH tag is set to YES then doxygen will generate a
|
||||
# graph for each documented class showing the direct and indirect implementation
|
||||
# dependencies (inheritance, containment, and class references variables) of the
|
||||
# class with other documented classes.
|
||||
# class with other documented classes. Explicit enabling a collaboration graph,
|
||||
# when COLLABORATION_GRAPH is set to NO, can be accomplished by means of the
|
||||
# command \collaborationgraph. Disabling a collaboration graph can be
|
||||
# accomplished by means of the command \hidecollaborationgraph.
|
||||
# The default value is: YES.
|
||||
# This tag requires that the tag HAVE_DOT is set to YES.
|
||||
|
||||
COLLABORATION_GRAPH = YES
|
||||
|
||||
# If the GROUP_GRAPHS tag is set to YES then doxygen will generate a graph for
|
||||
# groups, showing the direct groups dependencies. See also the chapter Grouping
|
||||
# in the manual.
|
||||
# groups, showing the direct groups dependencies. Explicit enabling a group
|
||||
# dependency graph, when GROUP_GRAPHS is set to NO, can be accomplished by means
|
||||
# of the command \groupgraph. Disabling a directory graph can be accomplished by
|
||||
# means of the command \hidegroupgraph. See also the chapter Grouping in the
|
||||
# manual.
|
||||
# The default value is: YES.
|
||||
# This tag requires that the tag HAVE_DOT is set to YES.
|
||||
|
||||
@ -2492,7 +2605,9 @@ TEMPLATE_RELATIONS = NO
|
||||
# If the INCLUDE_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are set to
|
||||
# YES then doxygen will generate a graph for each documented file showing the
|
||||
# direct and indirect include dependencies of the file with other documented
|
||||
# files.
|
||||
# files. Explicit enabling an include graph, when INCLUDE_GRAPH is is set to NO,
|
||||
# can be accomplished by means of the command \includegraph. Disabling an
|
||||
# include graph can be accomplished by means of the command \hideincludegraph.
|
||||
# The default value is: YES.
|
||||
# This tag requires that the tag HAVE_DOT is set to YES.
|
||||
|
||||
@ -2501,7 +2616,10 @@ INCLUDE_GRAPH = YES
|
||||
# If the INCLUDED_BY_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are
|
||||
# set to YES then doxygen will generate a graph for each documented file showing
|
||||
# the direct and indirect include dependencies of the file with other documented
|
||||
# files.
|
||||
# files. Explicit enabling an included by graph, when INCLUDED_BY_GRAPH is set
|
||||
# to NO, can be accomplished by means of the command \includedbygraph. Disabling
|
||||
# an included by graph can be accomplished by means of the command
|
||||
# \hideincludedbygraph.
|
||||
# The default value is: YES.
|
||||
# This tag requires that the tag HAVE_DOT is set to YES.
|
||||
|
||||
@ -2541,7 +2659,10 @@ GRAPHICAL_HIERARCHY = YES
|
||||
# If the DIRECTORY_GRAPH tag is set to YES then doxygen will show the
|
||||
# dependencies a directory has on other directories in a graphical way. The
|
||||
# dependency relations are determined by the #include relations between the
|
||||
# files in the directories.
|
||||
# files in the directories. Explicit enabling a directory graph, when
|
||||
# DIRECTORY_GRAPH is set to NO, can be accomplished by means of the command
|
||||
# \directorygraph. Disabling a directory graph can be accomplished by means of
|
||||
# the command \hidedirectorygraph.
|
||||
# The default value is: YES.
|
||||
# This tag requires that the tag HAVE_DOT is set to YES.
|
||||
|
||||
@ -2557,7 +2678,7 @@ DIR_GRAPH_MAX_DEPTH = 1
|
||||
# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
|
||||
# generated by dot. For an explanation of the image formats see the section
|
||||
# output formats in the documentation of the dot tool (Graphviz (see:
|
||||
# http://www.graphviz.org/)).
|
||||
# https://www.graphviz.org/)).
|
||||
# Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order
|
||||
# to make the SVG files visible in IE 9+ (other browsers do not have this
|
||||
# requirement).
|
||||
@ -2595,11 +2716,12 @@ DOT_PATH =
|
||||
|
||||
DOTFILE_DIRS =
|
||||
|
||||
# The MSCFILE_DIRS tag can be used to specify one or more directories that
|
||||
# contain msc files that are included in the documentation (see the \mscfile
|
||||
# command).
|
||||
# You can include diagrams made with dia in doxygen documentation. Doxygen will
|
||||
# then run dia to produce the diagram and insert it in the documentation. The
|
||||
# DIA_PATH tag allows you to specify the directory where the dia binary resides.
|
||||
# If left empty dia is assumed to be found in the default search path.
|
||||
|
||||
MSCFILE_DIRS =
|
||||
DIA_PATH =
|
||||
|
||||
# The DIAFILE_DIRS tag can be used to specify one or more directories that
|
||||
# contain dia files that are included in the documentation (see the \diafile
|
||||
@ -2649,18 +2771,6 @@ DOT_GRAPH_MAX_NODES = 50
|
||||
|
||||
MAX_DOT_GRAPH_DEPTH = 1000
|
||||
|
||||
# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
|
||||
# background. This is disabled by default, because dot on Windows does not seem
|
||||
# to support this out of the box.
|
||||
#
|
||||
# Warning: Depending on the platform used, enabling this option may lead to
|
||||
# badly anti-aliased labels on the edges of a graph (i.e. they become hard to
|
||||
# read).
|
||||
# The default value is: NO.
|
||||
# This tag requires that the tag HAVE_DOT is set to YES.
|
||||
|
||||
DOT_TRANSPARENT = YES
|
||||
|
||||
# Set the DOT_MULTI_TARGETS tag to YES to allow dot to generate multiple output
|
||||
# files in one run (i.e. multiple -o and -T options on the command line). This
|
||||
# makes dot run faster, but since only newer versions of dot (>1.8.10) support
|
||||
@ -2688,3 +2798,19 @@ GENERATE_LEGEND = YES
|
||||
# The default value is: YES.
|
||||
|
||||
DOT_CLEANUP = YES
|
||||
|
||||
# You can define message sequence charts within doxygen comments using the \msc
|
||||
# command. If the MSCGEN_TOOL tag is left empty (the default), then doxygen will
|
||||
# use a built-in version of mscgen tool to produce the charts. Alternatively,
|
||||
# the MSCGEN_TOOL tag can also specify the name an external tool. For instance,
|
||||
# specifying prog as the value, doxygen will call the tool as prog -T
|
||||
# <outfile_format> -o <outputfile> <inputfile>. The external tool should support
|
||||
# output file formats "png", "eps", "svg", and "ismap".
|
||||
|
||||
MSCGEN_TOOL =
|
||||
|
||||
# The MSCFILE_DIRS tag can be used to specify one or more directories that
|
||||
# contain msc files that are included in the documentation (see the \mscfile
|
||||
# command).
|
||||
|
||||
MSCFILE_DIRS =
|
||||
|
@ -1,5 +1,25 @@
|
||||
SUBDIRS:= `ls`
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
#
|
||||
# SPDX-FileContributor: Antonio Niño Díaz, 2023-2024
|
||||
|
||||
.PHONY: all clean
|
||||
|
||||
MAKE := make
|
||||
|
||||
all:
|
||||
@for i in $(SUBDIRS); do if test -e $$i/Makefile ; then $(MAKE) -C $$i || { exit 1;} fi; done;
|
||||
@for i in `ls`; do \
|
||||
if test -e $$i/Makefile ; then \
|
||||
cd $$i; \
|
||||
$(MAKE) --no-print-directory || exit 1 ; \
|
||||
cd ..; \
|
||||
fi; \
|
||||
done;
|
||||
|
||||
clean:
|
||||
@for i in $(SUBDIRS); do if test -e $$i/Makefile ; then $(MAKE) -C $$i clean || { exit 1;} fi; done;
|
||||
@for i in `ls`; do \
|
||||
if test -e $$i/Makefile ; then \
|
||||
cd $$i; \
|
||||
$(MAKE) clean --no-print-directory || exit 1 ; \
|
||||
cd ..; \
|
||||
fi; \
|
||||
done;
|
||||
|
@ -1,25 +0,0 @@
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
#
|
||||
# SPDX-FileContributor: Antonio Niño Díaz, 2023
|
||||
|
||||
.PHONY: all clean
|
||||
|
||||
MAKE := make
|
||||
|
||||
all:
|
||||
@for i in `ls`; do \
|
||||
if test -e $$i/Makefile.blocksds ; then \
|
||||
cd $$i; \
|
||||
$(MAKE) -f Makefile.blocksds --no-print-directory || { exit 1;}; \
|
||||
cd ..; \
|
||||
fi; \
|
||||
done;
|
||||
|
||||
clean:
|
||||
@for i in `ls`; do \
|
||||
if test -e $$i/Makefile.blocksds ; then \
|
||||
cd $$i; \
|
||||
$(MAKE) -f Makefile.blocksds clean --no-print-directory || { exit 1;}; \
|
||||
cd ..; \
|
||||
fi; \
|
||||
done;
|
@ -1,220 +1,6 @@
|
||||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#---------------------------------------------------------------------------------
|
||||
# This is a minimal makefile only used for the examples. If you want a makefile
|
||||
# for your project, take one from the templates inside examples/templates.
|
||||
|
||||
ifeq ($(strip $(DEVKITARM)),)
|
||||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
||||
endif
|
||||
GFXDIRS := graphics
|
||||
|
||||
include $(DEVKITARM)/ds_rules
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# TARGET is the name of the output
|
||||
# BUILD is the directory where object files & intermediate files will be placed
|
||||
# SOURCES is a list of directories containing source code
|
||||
# INCLUDES is a list of directories containing extra header files
|
||||
# DATA is a list of directories containing binary files embedded using bin2o
|
||||
# GRAPHICS is a list of directories containing image files to be converted with grit
|
||||
# AUDIO is a list of directories containing audio to be converted by maxmod
|
||||
# ICON is the image used to create the game icon, leave blank to use default rule
|
||||
# NITRO is a directory that will be accessible via NitroFS
|
||||
#---------------------------------------------------------------------------------
|
||||
TARGET := $(shell basename $(CURDIR))
|
||||
BUILD := build
|
||||
SOURCES := source
|
||||
INCLUDES := include
|
||||
DATA :=
|
||||
GRAPHICS := graphics
|
||||
AUDIO :=
|
||||
ICON :=
|
||||
|
||||
# specify a directory which contains the nitro filesystem
|
||||
# this is relative to the Makefile
|
||||
NITRO :=
|
||||
|
||||
# These set the information text in the nds file
|
||||
GAME_TITLE := $(shell basename $(CURDIR))
|
||||
GAME_SUBTITLE1 := Nitro Engine example
|
||||
GAME_SUBTITLE2 := github.com/AntonioND/nitro-engine
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# options for code generation
|
||||
#---------------------------------------------------------------------------------
|
||||
ARCH := -marm -mthumb-interwork -march=armv5te -mtune=arm946e-s
|
||||
|
||||
CFLAGS := -g -Wall -O3\
|
||||
$(ARCH) $(INCLUDE) -DARM9
|
||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
|
||||
ASFLAGS := -g $(ARCH)
|
||||
LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# any extra libraries we wish to link with the project (order is important)
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBS := -lNE -lfat -lnds9
|
||||
|
||||
# automatigically add libraries for NitroFS
|
||||
ifneq ($(strip $(NITRO)),)
|
||||
LIBS := -lfilesystem -lfat $(LIBS)
|
||||
endif
|
||||
# automagically add maxmod library
|
||||
ifneq ($(strip $(AUDIO)),)
|
||||
LIBS := -lmm9 $(LIBS)
|
||||
endif
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# list of directories containing libraries, this must be the top level containing
|
||||
# include and lib
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nitro-engine
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# no real need to edit anything past this point unless you need to add additional
|
||||
# rules for different file extensions
|
||||
#---------------------------------------------------------------------------------
|
||||
ifneq ($(BUILD),$(notdir $(CURDIR)))
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
export OUTPUT := $(CURDIR)/$(TARGET)
|
||||
|
||||
export VPATH := $(CURDIR)/$(subst /,,$(dir $(ICON)))\
|
||||
$(foreach dir,$(SOURCES),$(CURDIR)/$(dir))\
|
||||
$(foreach dir,$(DATA),$(CURDIR)/$(dir))\
|
||||
$(foreach dir,$(GRAPHICS),$(CURDIR)/$(dir))
|
||||
|
||||
export DEPSDIR := $(CURDIR)/$(BUILD)
|
||||
|
||||
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
|
||||
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
|
||||
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
|
||||
PNGFILES := $(foreach dir,$(GRAPHICS),$(notdir $(wildcard $(dir)/*.png)))
|
||||
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
|
||||
|
||||
# prepare NitroFS directory
|
||||
ifneq ($(strip $(NITRO)),)
|
||||
export NITRO_FILES := $(CURDIR)/$(NITRO)
|
||||
endif
|
||||
|
||||
# get audio list for maxmod
|
||||
ifneq ($(strip $(AUDIO)),)
|
||||
export MODFILES := $(foreach dir,$(notdir $(wildcard $(AUDIO)/*.*)),$(CURDIR)/$(AUDIO)/$(dir))
|
||||
|
||||
# place the soundbank file in NitroFS if using it
|
||||
ifneq ($(strip $(NITRO)),)
|
||||
export SOUNDBANK := $(NITRO_FILES)/soundbank.bin
|
||||
|
||||
# otherwise, needs to be loaded from memory
|
||||
else
|
||||
export SOUNDBANK := soundbank.bin
|
||||
BINFILES += $(SOUNDBANK)
|
||||
endif
|
||||
endif
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# use CXX for linking C++ projects, CC for standard C
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(CPPFILES)),)
|
||||
#---------------------------------------------------------------------------------
|
||||
export LD := $(CC)
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
#---------------------------------------------------------------------------------
|
||||
export LD := $(CXX)
|
||||
#---------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
|
||||
|
||||
export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
|
||||
|
||||
export OFILES := $(PNGFILES:.png=.o) $(OFILES_BIN) $(OFILES_SOURCES)
|
||||
|
||||
export HFILES := $(PNGFILES:.png=.h) $(addsuffix .h,$(subst .,_,$(BINFILES)))
|
||||
|
||||
export INCLUDE := $(foreach dir,$(INCLUDES),-iquote $(CURDIR)/$(dir))\
|
||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include)\
|
||||
-I$(CURDIR)/$(BUILD)
|
||||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
|
||||
|
||||
ifeq ($(strip $(ICON)),)
|
||||
icons := $(wildcard *.bmp)
|
||||
|
||||
ifneq (,$(findstring $(TARGET).bmp,$(icons)))
|
||||
export GAME_ICON := $(CURDIR)/$(TARGET).bmp
|
||||
else
|
||||
ifneq (,$(findstring icon.bmp,$(icons)))
|
||||
export GAME_ICON := $(CURDIR)/icon.bmp
|
||||
endif
|
||||
endif
|
||||
else
|
||||
ifeq ($(suffix $(ICON)), .grf)
|
||||
export GAME_ICON := $(CURDIR)/$(ICON)
|
||||
else
|
||||
export GAME_ICON := $(CURDIR)/$(BUILD)/$(notdir $(basename $(ICON))).grf
|
||||
endif
|
||||
endif
|
||||
|
||||
.PHONY: $(BUILD) clean
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
$(BUILD):
|
||||
@mkdir -p $@
|
||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
clean:
|
||||
@echo clean ...
|
||||
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(SOUNDBANK)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# main targets
|
||||
#---------------------------------------------------------------------------------
|
||||
$(OUTPUT).nds: $(OUTPUT).elf $(GAME_ICON)
|
||||
$(OUTPUT).elf: $(OFILES)
|
||||
|
||||
# source files depend on generated headers
|
||||
$(OFILES_SOURCES) : $(HFILES)
|
||||
|
||||
# need to build soundbank first
|
||||
$(OFILES): $(SOUNDBANK)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# rule to build solution from music files
|
||||
#---------------------------------------------------------------------------------
|
||||
$(SOUNDBANK) : $(MODFILES)
|
||||
#---------------------------------------------------------------------------------
|
||||
mmutil $^ -d -o$@ -hsoundbank.h
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.bin.o %_bin.h : %.bin
|
||||
#---------------------------------------------------------------------------------
|
||||
@echo $(notdir $<)
|
||||
@$(bin2o)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# This rule creates assembly source files using grit
|
||||
# grit takes an image file and a .grit describing how the file is to be processed
|
||||
# add additional rules like this for each image extension
|
||||
# you use in the graphics folders
|
||||
#---------------------------------------------------------------------------------
|
||||
%.s %.h: %.png %.grit
|
||||
#---------------------------------------------------------------------------------
|
||||
grit $< -fts -o$*
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# Convert non-GRF game icon to GRF if needed
|
||||
#---------------------------------------------------------------------------------
|
||||
$(GAME_ICON): $(notdir $(ICON))
|
||||
#---------------------------------------------------------------------------------
|
||||
@echo convert $(notdir $<)
|
||||
@grit $< -g -gt -gB4 -gT FF00FF -m! -p -pe 16 -fh! -ftr
|
||||
|
||||
-include $(DEPSDIR)/*.d
|
||||
|
||||
#---------------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------------
|
||||
include ../../Makefile.example
|
||||
|
@ -1,6 +0,0 @@
|
||||
# This is a minimal makefile only used for the examples. If you want a makefile
|
||||
# for your project, take one from the templates inside examples/templates.
|
||||
|
||||
GFXDIRS := graphics
|
||||
|
||||
include ../../Makefile.example.blocksds
|
@ -1,6 +1,6 @@
|
||||
// SPDX-License-Identifier: CC0-1.0
|
||||
//
|
||||
// SPDX-FileContributor: Antonio Niño Díaz, 2008-2011, 2019, 2022
|
||||
// SPDX-FileContributor: Antonio Niño Díaz, 2008-2022
|
||||
//
|
||||
// This file is part of Nitro Engine
|
||||
|
||||
@ -16,7 +16,7 @@ void Draw3DScene(void)
|
||||
NE_GUIDraw();
|
||||
}
|
||||
|
||||
int main(void)
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
irqEnable(IRQ_HBLANK);
|
||||
irqSet(IRQ_VBLANK, NE_VBLFunc);
|
||||
|
@ -1,220 +1,6 @@
|
||||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#---------------------------------------------------------------------------------
|
||||
# This is a minimal makefile only used for the examples. If you want a makefile
|
||||
# for your project, take one from the templates inside examples/templates.
|
||||
|
||||
ifeq ($(strip $(DEVKITARM)),)
|
||||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
||||
endif
|
||||
GFXDIRS := graphics
|
||||
|
||||
include $(DEVKITARM)/ds_rules
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# TARGET is the name of the output
|
||||
# BUILD is the directory where object files & intermediate files will be placed
|
||||
# SOURCES is a list of directories containing source code
|
||||
# INCLUDES is a list of directories containing extra header files
|
||||
# DATA is a list of directories containing binary files embedded using bin2o
|
||||
# GRAPHICS is a list of directories containing image files to be converted with grit
|
||||
# AUDIO is a list of directories containing audio to be converted by maxmod
|
||||
# ICON is the image used to create the game icon, leave blank to use default rule
|
||||
# NITRO is a directory that will be accessible via NitroFS
|
||||
#---------------------------------------------------------------------------------
|
||||
TARGET := $(shell basename $(CURDIR))
|
||||
BUILD := build
|
||||
SOURCES := source
|
||||
INCLUDES := include
|
||||
DATA :=
|
||||
GRAPHICS := graphics
|
||||
AUDIO :=
|
||||
ICON :=
|
||||
|
||||
# specify a directory which contains the nitro filesystem
|
||||
# this is relative to the Makefile
|
||||
NITRO :=
|
||||
|
||||
# These set the information text in the nds file
|
||||
GAME_TITLE := $(shell basename $(CURDIR))
|
||||
GAME_SUBTITLE1 := Nitro Engine example
|
||||
GAME_SUBTITLE2 := github.com/AntonioND/nitro-engine
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# options for code generation
|
||||
#---------------------------------------------------------------------------------
|
||||
ARCH := -marm -mthumb-interwork -march=armv5te -mtune=arm946e-s
|
||||
|
||||
CFLAGS := -g -Wall -O3\
|
||||
$(ARCH) $(INCLUDE) -DARM9
|
||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
|
||||
ASFLAGS := -g $(ARCH)
|
||||
LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# any extra libraries we wish to link with the project (order is important)
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBS := -lNE -lfat -lnds9
|
||||
|
||||
# automatigically add libraries for NitroFS
|
||||
ifneq ($(strip $(NITRO)),)
|
||||
LIBS := -lfilesystem -lfat $(LIBS)
|
||||
endif
|
||||
# automagically add maxmod library
|
||||
ifneq ($(strip $(AUDIO)),)
|
||||
LIBS := -lmm9 $(LIBS)
|
||||
endif
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# list of directories containing libraries, this must be the top level containing
|
||||
# include and lib
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nitro-engine
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# no real need to edit anything past this point unless you need to add additional
|
||||
# rules for different file extensions
|
||||
#---------------------------------------------------------------------------------
|
||||
ifneq ($(BUILD),$(notdir $(CURDIR)))
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
export OUTPUT := $(CURDIR)/$(TARGET)
|
||||
|
||||
export VPATH := $(CURDIR)/$(subst /,,$(dir $(ICON)))\
|
||||
$(foreach dir,$(SOURCES),$(CURDIR)/$(dir))\
|
||||
$(foreach dir,$(DATA),$(CURDIR)/$(dir))\
|
||||
$(foreach dir,$(GRAPHICS),$(CURDIR)/$(dir))
|
||||
|
||||
export DEPSDIR := $(CURDIR)/$(BUILD)
|
||||
|
||||
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
|
||||
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
|
||||
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
|
||||
PNGFILES := $(foreach dir,$(GRAPHICS),$(notdir $(wildcard $(dir)/*.png)))
|
||||
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
|
||||
|
||||
# prepare NitroFS directory
|
||||
ifneq ($(strip $(NITRO)),)
|
||||
export NITRO_FILES := $(CURDIR)/$(NITRO)
|
||||
endif
|
||||
|
||||
# get audio list for maxmod
|
||||
ifneq ($(strip $(AUDIO)),)
|
||||
export MODFILES := $(foreach dir,$(notdir $(wildcard $(AUDIO)/*.*)),$(CURDIR)/$(AUDIO)/$(dir))
|
||||
|
||||
# place the soundbank file in NitroFS if using it
|
||||
ifneq ($(strip $(NITRO)),)
|
||||
export SOUNDBANK := $(NITRO_FILES)/soundbank.bin
|
||||
|
||||
# otherwise, needs to be loaded from memory
|
||||
else
|
||||
export SOUNDBANK := soundbank.bin
|
||||
BINFILES += $(SOUNDBANK)
|
||||
endif
|
||||
endif
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# use CXX for linking C++ projects, CC for standard C
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(CPPFILES)),)
|
||||
#---------------------------------------------------------------------------------
|
||||
export LD := $(CC)
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
#---------------------------------------------------------------------------------
|
||||
export LD := $(CXX)
|
||||
#---------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
|
||||
|
||||
export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
|
||||
|
||||
export OFILES := $(PNGFILES:.png=.o) $(OFILES_BIN) $(OFILES_SOURCES)
|
||||
|
||||
export HFILES := $(PNGFILES:.png=.h) $(addsuffix .h,$(subst .,_,$(BINFILES)))
|
||||
|
||||
export INCLUDE := $(foreach dir,$(INCLUDES),-iquote $(CURDIR)/$(dir))\
|
||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include)\
|
||||
-I$(CURDIR)/$(BUILD)
|
||||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
|
||||
|
||||
ifeq ($(strip $(ICON)),)
|
||||
icons := $(wildcard *.bmp)
|
||||
|
||||
ifneq (,$(findstring $(TARGET).bmp,$(icons)))
|
||||
export GAME_ICON := $(CURDIR)/$(TARGET).bmp
|
||||
else
|
||||
ifneq (,$(findstring icon.bmp,$(icons)))
|
||||
export GAME_ICON := $(CURDIR)/icon.bmp
|
||||
endif
|
||||
endif
|
||||
else
|
||||
ifeq ($(suffix $(ICON)), .grf)
|
||||
export GAME_ICON := $(CURDIR)/$(ICON)
|
||||
else
|
||||
export GAME_ICON := $(CURDIR)/$(BUILD)/$(notdir $(basename $(ICON))).grf
|
||||
endif
|
||||
endif
|
||||
|
||||
.PHONY: $(BUILD) clean
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
$(BUILD):
|
||||
@mkdir -p $@
|
||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
clean:
|
||||
@echo clean ...
|
||||
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(SOUNDBANK)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# main targets
|
||||
#---------------------------------------------------------------------------------
|
||||
$(OUTPUT).nds: $(OUTPUT).elf $(GAME_ICON)
|
||||
$(OUTPUT).elf: $(OFILES)
|
||||
|
||||
# source files depend on generated headers
|
||||
$(OFILES_SOURCES) : $(HFILES)
|
||||
|
||||
# need to build soundbank first
|
||||
$(OFILES): $(SOUNDBANK)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# rule to build solution from music files
|
||||
#---------------------------------------------------------------------------------
|
||||
$(SOUNDBANK) : $(MODFILES)
|
||||
#---------------------------------------------------------------------------------
|
||||
mmutil $^ -d -o$@ -hsoundbank.h
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.bin.o %_bin.h : %.bin
|
||||
#---------------------------------------------------------------------------------
|
||||
@echo $(notdir $<)
|
||||
@$(bin2o)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# This rule creates assembly source files using grit
|
||||
# grit takes an image file and a .grit describing how the file is to be processed
|
||||
# add additional rules like this for each image extension
|
||||
# you use in the graphics folders
|
||||
#---------------------------------------------------------------------------------
|
||||
%.s %.h: %.png %.grit
|
||||
#---------------------------------------------------------------------------------
|
||||
grit $< -fts -o$*
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# Convert non-GRF game icon to GRF if needed
|
||||
#---------------------------------------------------------------------------------
|
||||
$(GAME_ICON): $(notdir $(ICON))
|
||||
#---------------------------------------------------------------------------------
|
||||
@echo convert $(notdir $<)
|
||||
@grit $< -g -gt -gB4 -gT FF00FF -m! -p -pe 16 -fh! -ftr
|
||||
|
||||
-include $(DEPSDIR)/*.d
|
||||
|
||||
#---------------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------------
|
||||
include ../../Makefile.example
|
||||
|
@ -1,6 +0,0 @@
|
||||
# This is a minimal makefile only used for the examples. If you want a makefile
|
||||
# for your project, take one from the templates inside examples/templates.
|
||||
|
||||
GFXDIRS := graphics
|
||||
|
||||
include ../../Makefile.example.blocksds
|
@ -1,6 +1,6 @@
|
||||
// SPDX-License-Identifier: CC0-1.0
|
||||
//
|
||||
// SPDX-FileContributor: Antonio Niño Díaz, 2008-2011, 2019, 2022
|
||||
// SPDX-FileContributor: Antonio Niño Díaz, 2008-2024
|
||||
//
|
||||
// This file is part of Nitro Engine
|
||||
|
||||
@ -18,11 +18,15 @@
|
||||
#include "s64.h"
|
||||
#include "s256.h"
|
||||
|
||||
NE_Material *Material_s8, *Material_s16, *Material_s64, *Material_s256;
|
||||
NE_Palette *Palette_s8, *Palette_s16, *Palette_s64, *Palette_s256;
|
||||
typedef struct {
|
||||
NE_Material *Material_s8, *Material_s16, *Material_s64, *Material_s256;
|
||||
NE_Palette *Palette_s8, *Palette_s16, *Palette_s64, *Palette_s256;
|
||||
} SceneData;
|
||||
|
||||
void Draw3DScene(void)
|
||||
void Draw3DScene(void *arg)
|
||||
{
|
||||
SceneData *Scene = arg;
|
||||
|
||||
NE_ClearColorSet(NE_DarkGray, 31, 63);
|
||||
|
||||
NE_2DViewInit();
|
||||
@ -30,27 +34,29 @@ void Draw3DScene(void)
|
||||
// Texture scaled from 64x64 to 128x128
|
||||
NE_2DDrawTexturedQuad(10, 10,
|
||||
10 + 128, 10 + 128,
|
||||
2, Material_s64);
|
||||
2, Scene->Material_s64);
|
||||
|
||||
// Texture scaled from 8x8 to 32x32
|
||||
NE_2DDrawTexturedQuad(150, 10,
|
||||
150 + 32, 10 + 32,
|
||||
0, Material_s8);
|
||||
0, Scene->Material_s8);
|
||||
|
||||
// Texture not scaled
|
||||
NE_2DDrawTexturedQuad(160, 50,
|
||||
160 + 64, 50 + 64,
|
||||
10, Material_s64);
|
||||
10, Scene->Material_s64);
|
||||
|
||||
|
||||
// Texture scaled from 16x16 to 64x64
|
||||
NE_2DDrawTexturedQuad(150, 120,
|
||||
150 + 64, 120 + 64,
|
||||
1, Material_s16);
|
||||
1, Scene->Material_s16);
|
||||
}
|
||||
|
||||
void Draw3DScene2(void)
|
||||
void Draw3DScene2(void *arg)
|
||||
{
|
||||
SceneData *Scene = arg;
|
||||
|
||||
NE_ClearColorSet(NE_Magenta, 31, 63);
|
||||
|
||||
NE_2DViewInit();
|
||||
@ -58,55 +64,57 @@ void Draw3DScene2(void)
|
||||
// Texture not scaled
|
||||
NE_2DDrawTexturedQuad(-10, -70,
|
||||
-10 + 256, -70 + 256,
|
||||
3, Material_s256);
|
||||
3, Scene->Material_s256);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
SceneData Scene = { 0 };
|
||||
|
||||
irqEnable(IRQ_HBLANK);
|
||||
irqSet(IRQ_VBLANK, NE_VBLFunc);
|
||||
irqSet(IRQ_HBLANK, NE_HBLFunc);
|
||||
|
||||
NE_InitDual3D();
|
||||
|
||||
Material_s8 = NE_MaterialCreate();
|
||||
Material_s16 = NE_MaterialCreate();
|
||||
Material_s64 = NE_MaterialCreate();
|
||||
Material_s256 = NE_MaterialCreate();
|
||||
Scene.Material_s8 = NE_MaterialCreate();
|
||||
Scene.Material_s16 = NE_MaterialCreate();
|
||||
Scene.Material_s64 = NE_MaterialCreate();
|
||||
Scene.Material_s256 = NE_MaterialCreate();
|
||||
|
||||
Palette_s8 = NE_PaletteCreate();
|
||||
Palette_s16 = NE_PaletteCreate();
|
||||
Palette_s64 = NE_PaletteCreate();
|
||||
Palette_s256 = NE_PaletteCreate();
|
||||
Scene.Palette_s8 = NE_PaletteCreate();
|
||||
Scene.Palette_s16 = NE_PaletteCreate();
|
||||
Scene.Palette_s64 = NE_PaletteCreate();
|
||||
Scene.Palette_s256 = NE_PaletteCreate();
|
||||
|
||||
NE_MaterialTexLoad(Material_s8, NE_PAL16, 8, 8,
|
||||
NE_MaterialTexLoad(Scene.Material_s8, NE_PAL16, 8, 8,
|
||||
NE_TEXGEN_TEXCOORD | NE_TEXTURE_WRAP_S | NE_TEXTURE_WRAP_T,
|
||||
s8Bitmap);
|
||||
NE_MaterialTexLoad(Material_s16, NE_PAL16, 16, 16,
|
||||
NE_MaterialTexLoad(Scene.Material_s16, NE_PAL16, 16, 16,
|
||||
NE_TEXGEN_TEXCOORD | NE_TEXTURE_WRAP_S | NE_TEXTURE_WRAP_T,
|
||||
s16Bitmap);
|
||||
NE_MaterialTexLoad(Material_s64, NE_PAL16, 64, 64,
|
||||
NE_MaterialTexLoad(Scene.Material_s64, NE_PAL16, 64, 64,
|
||||
NE_TEXGEN_TEXCOORD | NE_TEXTURE_WRAP_S | NE_TEXTURE_WRAP_T,
|
||||
s64Bitmap);
|
||||
NE_MaterialTexLoad(Material_s256, NE_PAL16, 256, 256,
|
||||
NE_MaterialTexLoad(Scene.Material_s256, NE_PAL16, 256, 256,
|
||||
NE_TEXGEN_TEXCOORD | NE_TEXTURE_WRAP_S | NE_TEXTURE_WRAP_T,
|
||||
s256Bitmap);
|
||||
|
||||
NE_PaletteLoad(Palette_s8, s8Pal, 16, NE_PAL16);
|
||||
NE_PaletteLoad(Palette_s16, s16Pal, 16, NE_PAL16);
|
||||
NE_PaletteLoad(Palette_s64, s64Pal, 16, NE_PAL16);
|
||||
NE_PaletteLoad(Palette_s256, s256Pal, 16, NE_PAL16);
|
||||
NE_PaletteLoad(Scene.Palette_s8, s8Pal, 16, NE_PAL16);
|
||||
NE_PaletteLoad(Scene.Palette_s16, s16Pal, 16, NE_PAL16);
|
||||
NE_PaletteLoad(Scene.Palette_s64, s64Pal, 16, NE_PAL16);
|
||||
NE_PaletteLoad(Scene.Palette_s256, s256Pal, 16, NE_PAL16);
|
||||
|
||||
NE_MaterialSetPalette(Material_s8, Palette_s8);
|
||||
NE_MaterialSetPalette(Material_s16, Palette_s16);
|
||||
NE_MaterialSetPalette(Material_s64, Palette_s64);
|
||||
NE_MaterialSetPalette(Material_s256, Palette_s256);
|
||||
NE_MaterialSetPalette(Scene.Material_s8, Scene.Palette_s8);
|
||||
NE_MaterialSetPalette(Scene.Material_s16, Scene.Palette_s16);
|
||||
NE_MaterialSetPalette(Scene.Material_s64, Scene.Palette_s64);
|
||||
NE_MaterialSetPalette(Scene.Material_s256, Scene.Palette_s256);
|
||||
|
||||
while (1)
|
||||
{
|
||||
NE_WaitForVBL(0);
|
||||
|
||||
NE_ProcessDual(Draw3DScene, Draw3DScene2);
|
||||
NE_ProcessDualArg(Draw3DScene, Draw3DScene2, &Scene, &Scene);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -1,220 +1,4 @@
|
||||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#---------------------------------------------------------------------------------
|
||||
# This is a minimal makefile only used for the examples. If you want a makefile
|
||||
# for your project, take one from the templates inside examples/templates.
|
||||
|
||||
ifeq ($(strip $(DEVKITARM)),)
|
||||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
||||
endif
|
||||
|
||||
include $(DEVKITARM)/ds_rules
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# TARGET is the name of the output
|
||||
# BUILD is the directory where object files & intermediate files will be placed
|
||||
# SOURCES is a list of directories containing source code
|
||||
# INCLUDES is a list of directories containing extra header files
|
||||
# DATA is a list of directories containing binary files embedded using bin2o
|
||||
# GRAPHICS is a list of directories containing image files to be converted with grit
|
||||
# AUDIO is a list of directories containing audio to be converted by maxmod
|
||||
# ICON is the image used to create the game icon, leave blank to use default rule
|
||||
# NITRO is a directory that will be accessible via NitroFS
|
||||
#---------------------------------------------------------------------------------
|
||||
TARGET := $(shell basename $(CURDIR))
|
||||
BUILD := build
|
||||
SOURCES := source
|
||||
INCLUDES := include
|
||||
DATA := data
|
||||
GRAPHICS :=
|
||||
AUDIO :=
|
||||
ICON :=
|
||||
|
||||
# specify a directory which contains the nitro filesystem
|
||||
# this is relative to the Makefile
|
||||
NITRO :=
|
||||
|
||||
# These set the information text in the nds file
|
||||
GAME_TITLE := $(shell basename $(CURDIR))
|
||||
GAME_SUBTITLE1 := Nitro Engine example
|
||||
GAME_SUBTITLE2 := github.com/AntonioND/nitro-engine
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# options for code generation
|
||||
#---------------------------------------------------------------------------------
|
||||
ARCH := -marm -mthumb-interwork -march=armv5te -mtune=arm946e-s
|
||||
|
||||
CFLAGS := -g -Wall -O3\
|
||||
$(ARCH) $(INCLUDE) -DARM9
|
||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
|
||||
ASFLAGS := -g $(ARCH)
|
||||
LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# any extra libraries we wish to link with the project (order is important)
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBS := -lNE -lfat -lnds9
|
||||
|
||||
# automatigically add libraries for NitroFS
|
||||
ifneq ($(strip $(NITRO)),)
|
||||
LIBS := -lfilesystem -lfat $(LIBS)
|
||||
endif
|
||||
# automagically add maxmod library
|
||||
ifneq ($(strip $(AUDIO)),)
|
||||
LIBS := -lmm9 $(LIBS)
|
||||
endif
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# list of directories containing libraries, this must be the top level containing
|
||||
# include and lib
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nitro-engine
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# no real need to edit anything past this point unless you need to add additional
|
||||
# rules for different file extensions
|
||||
#---------------------------------------------------------------------------------
|
||||
ifneq ($(BUILD),$(notdir $(CURDIR)))
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
export OUTPUT := $(CURDIR)/$(TARGET)
|
||||
|
||||
export VPATH := $(CURDIR)/$(subst /,,$(dir $(ICON)))\
|
||||
$(foreach dir,$(SOURCES),$(CURDIR)/$(dir))\
|
||||
$(foreach dir,$(DATA),$(CURDIR)/$(dir))\
|
||||
$(foreach dir,$(GRAPHICS),$(CURDIR)/$(dir))
|
||||
|
||||
export DEPSDIR := $(CURDIR)/$(BUILD)
|
||||
|
||||
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
|
||||
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
|
||||
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
|
||||
PNGFILES := $(foreach dir,$(GRAPHICS),$(notdir $(wildcard $(dir)/*.png)))
|
||||
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
|
||||
|
||||
# prepare NitroFS directory
|
||||
ifneq ($(strip $(NITRO)),)
|
||||
export NITRO_FILES := $(CURDIR)/$(NITRO)
|
||||
endif
|
||||
|
||||
# get audio list for maxmod
|
||||
ifneq ($(strip $(AUDIO)),)
|
||||
export MODFILES := $(foreach dir,$(notdir $(wildcard $(AUDIO)/*.*)),$(CURDIR)/$(AUDIO)/$(dir))
|
||||
|
||||
# place the soundbank file in NitroFS if using it
|
||||
ifneq ($(strip $(NITRO)),)
|
||||
export SOUNDBANK := $(NITRO_FILES)/soundbank.bin
|
||||
|
||||
# otherwise, needs to be loaded from memory
|
||||
else
|
||||
export SOUNDBANK := soundbank.bin
|
||||
BINFILES += $(SOUNDBANK)
|
||||
endif
|
||||
endif
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# use CXX for linking C++ projects, CC for standard C
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(CPPFILES)),)
|
||||
#---------------------------------------------------------------------------------
|
||||
export LD := $(CC)
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
#---------------------------------------------------------------------------------
|
||||
export LD := $(CXX)
|
||||
#---------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
|
||||
|
||||
export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
|
||||
|
||||
export OFILES := $(PNGFILES:.png=.o) $(OFILES_BIN) $(OFILES_SOURCES)
|
||||
|
||||
export HFILES := $(PNGFILES:.png=.h) $(addsuffix .h,$(subst .,_,$(BINFILES)))
|
||||
|
||||
export INCLUDE := $(foreach dir,$(INCLUDES),-iquote $(CURDIR)/$(dir))\
|
||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include)\
|
||||
-I$(CURDIR)/$(BUILD)
|
||||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
|
||||
|
||||
ifeq ($(strip $(ICON)),)
|
||||
icons := $(wildcard *.bmp)
|
||||
|
||||
ifneq (,$(findstring $(TARGET).bmp,$(icons)))
|
||||
export GAME_ICON := $(CURDIR)/$(TARGET).bmp
|
||||
else
|
||||
ifneq (,$(findstring icon.bmp,$(icons)))
|
||||
export GAME_ICON := $(CURDIR)/icon.bmp
|
||||
endif
|
||||
endif
|
||||
else
|
||||
ifeq ($(suffix $(ICON)), .grf)
|
||||
export GAME_ICON := $(CURDIR)/$(ICON)
|
||||
else
|
||||
export GAME_ICON := $(CURDIR)/$(BUILD)/$(notdir $(basename $(ICON))).grf
|
||||
endif
|
||||
endif
|
||||
|
||||
.PHONY: $(BUILD) clean
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
$(BUILD):
|
||||
@mkdir -p $@
|
||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
clean:
|
||||
@echo clean ...
|
||||
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(SOUNDBANK)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# main targets
|
||||
#---------------------------------------------------------------------------------
|
||||
$(OUTPUT).nds: $(OUTPUT).elf $(GAME_ICON)
|
||||
$(OUTPUT).elf: $(OFILES)
|
||||
|
||||
# source files depend on generated headers
|
||||
$(OFILES_SOURCES) : $(HFILES)
|
||||
|
||||
# need to build soundbank first
|
||||
$(OFILES): $(SOUNDBANK)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# rule to build solution from music files
|
||||
#---------------------------------------------------------------------------------
|
||||
$(SOUNDBANK) : $(MODFILES)
|
||||
#---------------------------------------------------------------------------------
|
||||
mmutil $^ -d -o$@ -hsoundbank.h
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.bin.o %_bin.h : %.bin
|
||||
#---------------------------------------------------------------------------------
|
||||
@echo $(notdir $<)
|
||||
@$(bin2o)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# This rule creates assembly source files using grit
|
||||
# grit takes an image file and a .grit describing how the file is to be processed
|
||||
# add additional rules like this for each image extension
|
||||
# you use in the graphics folders
|
||||
#---------------------------------------------------------------------------------
|
||||
%.s %.h: %.png %.grit
|
||||
#---------------------------------------------------------------------------------
|
||||
grit $< -fts -o$*
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# Convert non-GRF game icon to GRF if needed
|
||||
#---------------------------------------------------------------------------------
|
||||
$(GAME_ICON): $(notdir $(ICON))
|
||||
#---------------------------------------------------------------------------------
|
||||
@echo convert $(notdir $<)
|
||||
@grit $< -g -gt -gB4 -gT FF00FF -m! -p -pe 16 -fh! -ftr
|
||||
|
||||
-include $(DEPSDIR)/*.d
|
||||
|
||||
#---------------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------------
|
||||
include ../../Makefile.example
|
||||
|
@ -1,4 +0,0 @@
|
||||
# This is a minimal makefile only used for the examples. If you want a makefile
|
||||
# for your project, take one from the templates inside examples/templates.
|
||||
|
||||
include ../../Makefile.example.blocksds
|
@ -1,6 +1,6 @@
|
||||
// SPDX-License-Identifier: CC0-1.0
|
||||
//
|
||||
// SPDX-FileContributor: Antonio Niño Díaz, 2008-2011, 2019, 2022
|
||||
// SPDX-FileContributor: Antonio Niño Díaz, 2008-2024
|
||||
//
|
||||
// This file is part of Nitro Engine
|
||||
|
||||
@ -17,7 +17,7 @@ typedef struct {
|
||||
|
||||
quad_t Quad[NUM_QUADS];
|
||||
|
||||
uint32_t kheld;
|
||||
bool enable_alpha = false;
|
||||
|
||||
void UpdateQuads(void)
|
||||
{
|
||||
@ -55,7 +55,7 @@ void Draw3DScene(void)
|
||||
if (!Quad[i].enabled)
|
||||
continue;
|
||||
|
||||
if (kheld & KEY_A)
|
||||
if (enable_alpha)
|
||||
NE_PolyFormat(Quad[i].alpha, Quad[i].id, 0, NE_CULL_NONE, 0);
|
||||
|
||||
NE_2DDrawQuad(Quad[i].x1, Quad[i].y1, Quad[i].x2, Quad[i].y2, i,
|
||||
@ -63,7 +63,7 @@ void Draw3DScene(void)
|
||||
}
|
||||
}
|
||||
|
||||
int main(void)
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
irqEnable(IRQ_HBLANK);
|
||||
irqSet(IRQ_VBLANK, NE_VBLFunc);
|
||||
@ -83,7 +83,11 @@ int main(void)
|
||||
NE_WaitForVBL(0);
|
||||
|
||||
scanKeys();
|
||||
kheld = keysHeld();
|
||||
uint16_t kheld = keysHeld();
|
||||
if (kheld & KEY_A)
|
||||
enable_alpha = true;
|
||||
else
|
||||
enable_alpha = false;
|
||||
|
||||
UpdateQuads();
|
||||
|
||||
|
@ -1,220 +1,6 @@
|
||||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#---------------------------------------------------------------------------------
|
||||
# This is a minimal makefile only used for the examples. If you want a makefile
|
||||
# for your project, take one from the templates inside examples/templates.
|
||||
|
||||
ifeq ($(strip $(DEVKITARM)),)
|
||||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
||||
endif
|
||||
GFXDIRS := graphics
|
||||
|
||||
include $(DEVKITARM)/ds_rules
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# TARGET is the name of the output
|
||||
# BUILD is the directory where object files & intermediate files will be placed
|
||||
# SOURCES is a list of directories containing source code
|
||||
# INCLUDES is a list of directories containing extra header files
|
||||
# DATA is a list of directories containing binary files embedded using bin2o
|
||||
# GRAPHICS is a list of directories containing image files to be converted with grit
|
||||
# AUDIO is a list of directories containing audio to be converted by maxmod
|
||||
# ICON is the image used to create the game icon, leave blank to use default rule
|
||||
# NITRO is a directory that will be accessible via NitroFS
|
||||
#---------------------------------------------------------------------------------
|
||||
TARGET := $(shell basename $(CURDIR))
|
||||
BUILD := build
|
||||
SOURCES := source
|
||||
INCLUDES := include
|
||||
DATA :=
|
||||
GRAPHICS := graphics
|
||||
AUDIO :=
|
||||
ICON :=
|
||||
|
||||
# specify a directory which contains the nitro filesystem
|
||||
# this is relative to the Makefile
|
||||
NITRO :=
|
||||
|
||||
# These set the information text in the nds file
|
||||
GAME_TITLE := $(shell basename $(CURDIR))
|
||||
GAME_SUBTITLE1 := Nitro Engine example
|
||||
GAME_SUBTITLE2 := github.com/AntonioND/nitro-engine
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# options for code generation
|
||||
#---------------------------------------------------------------------------------
|
||||
ARCH := -marm -mthumb-interwork -march=armv5te -mtune=arm946e-s
|
||||
|
||||
CFLAGS := -g -Wall -O3\
|
||||
$(ARCH) $(INCLUDE) -DARM9
|
||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
|
||||
ASFLAGS := -g $(ARCH)
|
||||
LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# any extra libraries we wish to link with the project (order is important)
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBS := -lNE -lfat -lnds9
|
||||
|
||||
# automatigically add libraries for NitroFS
|
||||
ifneq ($(strip $(NITRO)),)
|
||||
LIBS := -lfilesystem -lfat $(LIBS)
|
||||
endif
|
||||
# automagically add maxmod library
|
||||
ifneq ($(strip $(AUDIO)),)
|
||||
LIBS := -lmm9 $(LIBS)
|
||||
endif
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# list of directories containing libraries, this must be the top level containing
|
||||
# include and lib
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nitro-engine
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# no real need to edit anything past this point unless you need to add additional
|
||||
# rules for different file extensions
|
||||
#---------------------------------------------------------------------------------
|
||||
ifneq ($(BUILD),$(notdir $(CURDIR)))
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
export OUTPUT := $(CURDIR)/$(TARGET)
|
||||
|
||||
export VPATH := $(CURDIR)/$(subst /,,$(dir $(ICON)))\
|
||||
$(foreach dir,$(SOURCES),$(CURDIR)/$(dir))\
|
||||
$(foreach dir,$(DATA),$(CURDIR)/$(dir))\
|
||||
$(foreach dir,$(GRAPHICS),$(CURDIR)/$(dir))
|
||||
|
||||
export DEPSDIR := $(CURDIR)/$(BUILD)
|
||||
|
||||
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
|
||||
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
|
||||
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
|
||||
PNGFILES := $(foreach dir,$(GRAPHICS),$(notdir $(wildcard $(dir)/*.png)))
|
||||
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
|
||||
|
||||
# prepare NitroFS directory
|
||||
ifneq ($(strip $(NITRO)),)
|
||||
export NITRO_FILES := $(CURDIR)/$(NITRO)
|
||||
endif
|
||||
|
||||
# get audio list for maxmod
|
||||
ifneq ($(strip $(AUDIO)),)
|
||||
export MODFILES := $(foreach dir,$(notdir $(wildcard $(AUDIO)/*.*)),$(CURDIR)/$(AUDIO)/$(dir))
|
||||
|
||||
# place the soundbank file in NitroFS if using it
|
||||
ifneq ($(strip $(NITRO)),)
|
||||
export SOUNDBANK := $(NITRO_FILES)/soundbank.bin
|
||||
|
||||
# otherwise, needs to be loaded from memory
|
||||
else
|
||||
export SOUNDBANK := soundbank.bin
|
||||
BINFILES += $(SOUNDBANK)
|
||||
endif
|
||||
endif
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# use CXX for linking C++ projects, CC for standard C
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(CPPFILES)),)
|
||||
#---------------------------------------------------------------------------------
|
||||
export LD := $(CC)
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
#---------------------------------------------------------------------------------
|
||||
export LD := $(CXX)
|
||||
#---------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
|
||||
|
||||
export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
|
||||
|
||||
export OFILES := $(PNGFILES:.png=.o) $(OFILES_BIN) $(OFILES_SOURCES)
|
||||
|
||||
export HFILES := $(PNGFILES:.png=.h) $(addsuffix .h,$(subst .,_,$(BINFILES)))
|
||||
|
||||
export INCLUDE := $(foreach dir,$(INCLUDES),-iquote $(CURDIR)/$(dir))\
|
||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include)\
|
||||
-I$(CURDIR)/$(BUILD)
|
||||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
|
||||
|
||||
ifeq ($(strip $(ICON)),)
|
||||
icons := $(wildcard *.bmp)
|
||||
|
||||
ifneq (,$(findstring $(TARGET).bmp,$(icons)))
|
||||
export GAME_ICON := $(CURDIR)/$(TARGET).bmp
|
||||
else
|
||||
ifneq (,$(findstring icon.bmp,$(icons)))
|
||||
export GAME_ICON := $(CURDIR)/icon.bmp
|
||||
endif
|
||||
endif
|
||||
else
|
||||
ifeq ($(suffix $(ICON)), .grf)
|
||||
export GAME_ICON := $(CURDIR)/$(ICON)
|
||||
else
|
||||
export GAME_ICON := $(CURDIR)/$(BUILD)/$(notdir $(basename $(ICON))).grf
|
||||
endif
|
||||
endif
|
||||
|
||||
.PHONY: $(BUILD) clean
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
$(BUILD):
|
||||
@mkdir -p $@
|
||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
clean:
|
||||
@echo clean ...
|
||||
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(SOUNDBANK)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# main targets
|
||||
#---------------------------------------------------------------------------------
|
||||
$(OUTPUT).nds: $(OUTPUT).elf $(GAME_ICON)
|
||||
$(OUTPUT).elf: $(OFILES)
|
||||
|
||||
# source files depend on generated headers
|
||||
$(OFILES_SOURCES) : $(HFILES)
|
||||
|
||||
# need to build soundbank first
|
||||
$(OFILES): $(SOUNDBANK)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# rule to build solution from music files
|
||||
#---------------------------------------------------------------------------------
|
||||
$(SOUNDBANK) : $(MODFILES)
|
||||
#---------------------------------------------------------------------------------
|
||||
mmutil $^ -d -o$@ -hsoundbank.h
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.bin.o %_bin.h : %.bin
|
||||
#---------------------------------------------------------------------------------
|
||||
@echo $(notdir $<)
|
||||
@$(bin2o)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# This rule creates assembly source files using grit
|
||||
# grit takes an image file and a .grit describing how the file is to be processed
|
||||
# add additional rules like this for each image extension
|
||||
# you use in the graphics folders
|
||||
#---------------------------------------------------------------------------------
|
||||
%.s %.h: %.png %.grit
|
||||
#---------------------------------------------------------------------------------
|
||||
grit $< -fts -o$*
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# Convert non-GRF game icon to GRF if needed
|
||||
#---------------------------------------------------------------------------------
|
||||
$(GAME_ICON): $(notdir $(ICON))
|
||||
#---------------------------------------------------------------------------------
|
||||
@echo convert $(notdir $<)
|
||||
@grit $< -g -gt -gB4 -gT FF00FF -m! -p -pe 16 -fh! -ftr
|
||||
|
||||
-include $(DEPSDIR)/*.d
|
||||
|
||||
#---------------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------------
|
||||
include ../../Makefile.example
|
||||
|
@ -1,6 +0,0 @@
|
||||
# This is a minimal makefile only used for the examples. If you want a makefile
|
||||
# for your project, take one from the templates inside examples/templates.
|
||||
|
||||
GFXDIRS := graphics
|
||||
|
||||
include ../../Makefile.example.blocksds
|
2
examples/2d_system/sprites/graphics/assets.grit
Normal file
2
examples/2d_system/sprites/graphics/assets.grit
Normal file
@ -0,0 +1,2 @@
|
||||
# 256 color palette
|
||||
-gx -gb -gB8 -gTFF00FF
|
BIN
examples/2d_system/sprites/graphics/assets.png
Normal file
BIN
examples/2d_system/sprites/graphics/assets.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 41 KiB |
7
examples/2d_system/sprites/graphics/assets.txt
Normal file
7
examples/2d_system/sprites/graphics/assets.txt
Normal file
@ -0,0 +1,7 @@
|
||||
This file is derived from:
|
||||
|
||||
Name: Ancient ruins pixel art
|
||||
License: CC-BY 3.0
|
||||
Author: CraftPix.net 2D Game Assets
|
||||
|
||||
https://opengameart.org/content/ancient-ruins-pixel-art
|
Binary file not shown.
Before Width: | Height: | Size: 796 B After Width: | Height: | Size: 4.5 KiB |
@ -1,73 +1,116 @@
|
||||
// SPDX-License-Identifier: CC0-1.0
|
||||
//
|
||||
// SPDX-FileContributor: Antonio Niño Díaz, 2008-2011, 2019, 2022
|
||||
// SPDX-FileContributor: Antonio Niño Díaz, 2008-2024
|
||||
//
|
||||
// This file is part of Nitro Engine
|
||||
|
||||
#include <NEMain.h>
|
||||
|
||||
#include "assets.h"
|
||||
#include "icon.h"
|
||||
|
||||
NE_Material *Material;
|
||||
NE_Palette *Palette;
|
||||
NE_Sprite *Sprite[4];
|
||||
NE_Sprite *Sprite[6];
|
||||
|
||||
void Draw3DScene(void)
|
||||
void Draw3DScene1(void)
|
||||
{
|
||||
NE_2DViewInit();
|
||||
NE_SpriteDrawAll();
|
||||
|
||||
NE_ClearColorSet(NE_White, 31, 63);
|
||||
|
||||
NE_SpriteDraw(Sprite[3]);
|
||||
NE_SpriteDraw(Sprite[4]);
|
||||
NE_SpriteDraw(Sprite[5]);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
void Draw3DScene2(void)
|
||||
{
|
||||
NE_2DViewInit();
|
||||
|
||||
NE_ClearColorSet(NE_Gray, 31, 63);
|
||||
|
||||
NE_SpriteDraw(Sprite[0]);
|
||||
NE_SpriteDraw(Sprite[1]);
|
||||
NE_SpriteDraw(Sprite[2]);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
irqEnable(IRQ_HBLANK);
|
||||
irqSet(IRQ_VBLANK, NE_VBLFunc);
|
||||
irqSet(IRQ_HBLANK, NE_HBLFunc);
|
||||
|
||||
NE_Init3D();
|
||||
NE_SwapScreens();
|
||||
NE_InitDual3D();
|
||||
NE_InitConsole();
|
||||
|
||||
Material = NE_MaterialCreate();
|
||||
Palette = NE_PaletteCreate();
|
||||
NE_Material *MaterialIcon = NE_MaterialCreate();
|
||||
NE_Palette *PaletteIcon = NE_PaletteCreate();
|
||||
|
||||
NE_MaterialTexLoad(Material, NE_PAL16, 128, 128, NE_TEXGEN_TEXCOORD,
|
||||
NE_MaterialTexLoad(MaterialIcon, NE_PAL16, 128, 128,
|
||||
NE_TEXGEN_TEXCOORD | NE_TEXTURE_COLOR0_TRANSPARENT,
|
||||
iconBitmap);
|
||||
NE_PaletteLoad(Palette, iconPal, 32, NE_PAL16);
|
||||
NE_MaterialSetPalette(Material, Palette);
|
||||
NE_PaletteLoad(PaletteIcon, iconPal, iconPalLen / 2, NE_PAL16);
|
||||
NE_MaterialSetPalette(MaterialIcon, PaletteIcon);
|
||||
|
||||
NE_Material *MaterialAssets = NE_MaterialCreate();
|
||||
NE_Palette *PaletteAssets = NE_PaletteCreate();
|
||||
|
||||
NE_ClearColorSet(NE_Gray, 31, 63);
|
||||
NE_MaterialTexLoad(MaterialAssets, NE_PAL256, 512, 256,
|
||||
NE_TEXGEN_TEXCOORD | NE_TEXTURE_COLOR0_TRANSPARENT,
|
||||
assetsBitmap);
|
||||
NE_PaletteLoad(PaletteAssets, assetsPal, assetsPalLen / 2, NE_PAL16);
|
||||
NE_MaterialSetPalette(MaterialAssets, PaletteAssets);
|
||||
|
||||
Sprite[0] = NE_SpriteCreate();
|
||||
Sprite[1] = NE_SpriteCreate();
|
||||
Sprite[2] = NE_SpriteCreate();
|
||||
Sprite[3] = NE_SpriteCreate();
|
||||
Sprite[4] = NE_SpriteCreate();
|
||||
Sprite[5] = NE_SpriteCreate();
|
||||
|
||||
NE_SpriteSetPos(Sprite[0], 0, 0);
|
||||
NE_SpriteSetSize(Sprite[0], 128, 128);
|
||||
// Sprite with the same size as the texture
|
||||
NE_SpriteSetMaterial(Sprite[0], MaterialIcon);
|
||||
NE_SpriteSetPos(Sprite[0], 10, 40);
|
||||
NE_SpriteSetPriority(Sprite[0], 10);
|
||||
NE_SpriteSetMaterial(Sprite[0], Material);
|
||||
|
||||
// Sprite with a different size than the texture (scaled down) and a
|
||||
// different color
|
||||
NE_SpriteSetMaterial(Sprite[1], MaterialIcon);
|
||||
NE_SpriteSetPos(Sprite[1], 114, 32);
|
||||
NE_SpriteSetSize(Sprite[1], 56, 56);
|
||||
NE_SpriteSetPriority(Sprite[1], 5);
|
||||
NE_SpriteSetParams(Sprite[1], 15, 1, NE_Green);
|
||||
NE_SpriteSetMaterial(Sprite[1], Material);
|
||||
NE_SpriteSetSize(Sprite[1], 56, 56);
|
||||
|
||||
// Sprite with a different size than the texture (scaled down), and with
|
||||
// transparency.
|
||||
NE_SpriteSetMaterial(Sprite[2], MaterialIcon);
|
||||
NE_SpriteSetPos(Sprite[2], 100, 50);
|
||||
NE_SpriteSetSize(Sprite[2], 56, 56);
|
||||
NE_SpriteSetPriority(Sprite[2], 1);
|
||||
NE_SpriteSetMaterial(Sprite[2], Material);
|
||||
NE_SpriteSetParams(Sprite[2], 15, 2, NE_White);
|
||||
NE_SpriteSetSize(Sprite[2], 56, 56);
|
||||
|
||||
NE_SpriteSetPos(Sprite[3], 256 - 64, 192 - 64);
|
||||
NE_SpriteSetSize(Sprite[3], 64, 64);
|
||||
NE_SpriteSetPriority(Sprite[3], 12);
|
||||
NE_SpriteSetMaterial(Sprite[3], Material);
|
||||
// The following sprites will only use a small part of the texture
|
||||
|
||||
NE_SpriteSetMaterial(Sprite[3], MaterialAssets);
|
||||
NE_SpriteSetPos(Sprite[3], 50, 60);
|
||||
NE_SpriteSetMaterialCanvas(Sprite[3], 384, 0, 484, 118);
|
||||
NE_SpriteSetSize(Sprite[3], 484 - 384, 118 - 0);
|
||||
|
||||
NE_SpriteSetMaterial(Sprite[4], MaterialAssets);
|
||||
NE_SpriteSetPos(Sprite[4], 0, 0);
|
||||
NE_SpriteSetMaterialCanvas(Sprite[4], 73, 0, 152, 75);
|
||||
NE_SpriteSetSize(Sprite[4], 152 - 73, 75 - 0);
|
||||
|
||||
NE_SpriteSetMaterial(Sprite[5], MaterialAssets);
|
||||
NE_SpriteSetPos(Sprite[5], 170, 20);
|
||||
NE_SpriteSetMaterialCanvas(Sprite[5], 0, 77, 72, 175);
|
||||
NE_SpriteSetSize(Sprite[5], 72 - 0, 175 - 77);
|
||||
|
||||
int rot = 0;
|
||||
int x = 100, y = 50;
|
||||
|
||||
printf("PAD: Move\n");
|
||||
printf("START: Exit to loader\n");
|
||||
|
||||
while (1)
|
||||
{
|
||||
NE_WaitForVBL(0);
|
||||
@ -87,9 +130,12 @@ int main(void)
|
||||
if (keys & KEY_LEFT)
|
||||
x--;
|
||||
|
||||
if (keys & KEY_START)
|
||||
break;
|
||||
|
||||
NE_SpriteSetPos(Sprite[2], x, y);
|
||||
|
||||
NE_Process(Draw3DScene);
|
||||
NE_ProcessDual(Draw3DScene1, Draw3DScene2);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -1,20 +1,28 @@
|
||||
SUBDIRS:= $(shell ls)
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
#
|
||||
# SPDX-FileContributor: Antonio Niño Díaz, 2023-2024
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
all: examples
|
||||
#-------------------------------------------------------------------------------
|
||||
@rm -fr build-all
|
||||
.PHONY: all clean
|
||||
|
||||
MAKE := make
|
||||
|
||||
all:
|
||||
@for i in `ls`; do \
|
||||
if test -e $$i/Makefile ; then \
|
||||
cd $$i; \
|
||||
$(MAKE) --no-print-directory || exit 1 ; \
|
||||
cd ..; \
|
||||
fi; \
|
||||
done;
|
||||
@mkdir -p build-all
|
||||
@find . -name "*.nds" -not -path build-all -exec cp -fv {} build-all \;
|
||||
|
||||
# TODO: The previous target tries to copy the files from build-all into
|
||||
# themselves. Exclude them correctly.
|
||||
|
||||
examples:
|
||||
@for i in $(SUBDIRS); do if test -e $$i/Makefile ; then $(MAKE) -C $$i || { exit 1;} fi; done;
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
clean:
|
||||
#-------------------------------------------------------------------------------
|
||||
@for i in `ls`; do \
|
||||
if test -e $$i/Makefile ; then \
|
||||
cd $$i; \
|
||||
$(MAKE) clean --no-print-directory || exit 1 ; \
|
||||
cd ..; \
|
||||
fi; \
|
||||
done;
|
||||
@rm -fr build-all
|
||||
@for i in $(SUBDIRS); do if test -e $$i/Makefile ; then $(MAKE) -C $$i clean || { exit 1;} fi; done;
|
||||
|
@ -1,25 +0,0 @@
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
#
|
||||
# SPDX-FileContributor: Antonio Niño Díaz, 2023
|
||||
|
||||
.PHONY: all clean
|
||||
|
||||
MAKE := make
|
||||
|
||||
all:
|
||||
@for i in `ls`; do \
|
||||
if test -e $$i/Makefile.blocksds ; then \
|
||||
$(MAKE) -C $$i -f Makefile.blocksds --no-print-directory || { exit 1;} \
|
||||
fi; \
|
||||
done;
|
||||
@rm -fr build-all
|
||||
@mkdir -p build-all
|
||||
@find . -name "*.nds" -not -path build-all -exec cp -fv {} build-all \;
|
||||
|
||||
clean:
|
||||
@for i in `ls`; do \
|
||||
if test -e $$i/Makefile.blocksds ; then \
|
||||
$(MAKE) -C $$i -f Makefile.blocksds clean --no-print-directory || { exit 1;} \
|
||||
fi; \
|
||||
done;
|
||||
@rm -fr build-all
|
@ -1,6 +1,6 @@
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
#
|
||||
# SPDX-FileContributor: Antonio Niño Díaz, 2023
|
||||
# SPDX-FileContributor: Antonio Niño Díaz, 2023-2024
|
||||
|
||||
export BLOCKSDS ?= /opt/blocksds/core
|
||||
export BLOCKSDSEXT ?= /opt/blocksds/external
|
||||
@ -51,18 +51,18 @@ LIBDIRS += $(BLOCKSDSEXT)/nitro-engine \
|
||||
# Build artifacts
|
||||
# ---------------
|
||||
|
||||
BUILDDIR := build
|
||||
BUILDDIR := build/$(NAME)
|
||||
ELF := build/$(NAME).elf
|
||||
DUMP := build/$(NAME).dump
|
||||
MAP := build/$(NAME).map
|
||||
ROM := $(NAME).nds
|
||||
|
||||
# If NITROFSDIR is set, the output of mmutil will be placed in that directory
|
||||
# If NITROFSDIR is set, the soundbank created by mmutil will be saved to NitroFS
|
||||
SOUNDBANKINFODIR := $(BUILDDIR)/maxmod
|
||||
ifeq ($(strip $(NITROFSDIR)),)
|
||||
SOUNDBANKDIR := $(BUILDDIR)/maxmod
|
||||
else
|
||||
SOUNDBANKDIR := $(NITROFSDIR)
|
||||
SOUNDBANKDIR := $(BUILDDIR)/maxmod_nitrofs
|
||||
endif
|
||||
|
||||
# Tools
|
||||
@ -71,6 +71,7 @@ endif
|
||||
PREFIX := $(ARM_NONE_EABI_PATH)arm-none-eabi-
|
||||
CC := $(PREFIX)gcc
|
||||
CXX := $(PREFIX)g++
|
||||
LD := $(PREFIX)gcc
|
||||
OBJDUMP := $(PREFIX)objdump
|
||||
MKDIR := mkdir
|
||||
RM := rm -rf
|
||||
@ -116,10 +117,8 @@ SPECS := $(BLOCKSDS)/sys/crts/ds_arm9.specs
|
||||
WARNFLAGS := -Wall
|
||||
|
||||
ifeq ($(SOURCES_CPP),)
|
||||
LD := $(CC)
|
||||
LIBS += -lc
|
||||
else
|
||||
LD := $(CXX)
|
||||
LIBS += -lstdc++ -lc
|
||||
endif
|
||||
|
||||
@ -132,16 +131,16 @@ ASFLAGS += -x assembler-with-cpp $(INCLUDEFLAGS) $(DEFINES) \
|
||||
$(ARCH) -ffunction-sections -fdata-sections \
|
||||
-specs=$(SPECS)
|
||||
|
||||
CFLAGS += -std=gnu11 $(WARNFLAGS) $(INCLUDEFLAGS) $(DEFINES) \
|
||||
CFLAGS += -std=gnu17 $(WARNFLAGS) $(INCLUDEFLAGS) $(DEFINES) \
|
||||
$(ARCH) -O2 -ffunction-sections -fdata-sections \
|
||||
-specs=$(SPECS)
|
||||
|
||||
CXXFLAGS += -std=gnu++14 $(WARNFLAGS) $(INCLUDEFLAGS) $(DEFINES) \
|
||||
CXXFLAGS += -std=gnu++17 $(WARNFLAGS) $(INCLUDEFLAGS) $(DEFINES) \
|
||||
$(ARCH) -O2 -ffunction-sections -fdata-sections \
|
||||
-fno-exceptions -fno-rtti \
|
||||
-specs=$(SPECS)
|
||||
|
||||
LDFLAGS := $(ARCH) $(LIBDIRSFLAGS) -Wl,-Map,$(MAP) \
|
||||
LDFLAGS := $(ARCH) $(LIBDIRSFLAGS) -Wl,-Map,$(MAP) $(DEFINES) \
|
||||
-Wl,--start-group $(LIBS) -Wl,--end-group -specs=$(SPECS)
|
||||
|
||||
# Intermediate build files
|
||||
@ -179,6 +178,10 @@ ifneq ($(strip $(NITROFSDIR)),)
|
||||
# Additional arguments for ndstool
|
||||
NDSTOOL_ARGS := -d $(NITROFSDIR)
|
||||
|
||||
ifneq ($(SOURCES_AUDIO),)
|
||||
NDSTOOL_ARGS += -d $(SOUNDBANKDIR)
|
||||
endif
|
||||
|
||||
# Make the NDS ROM depend on the filesystem only if it is needed
|
||||
$(ROM): $(NITROFSDIR)
|
||||
endif
|
||||
@ -209,8 +212,7 @@ dump: $(DUMP)
|
||||
|
||||
clean:
|
||||
@echo " CLEAN"
|
||||
$(V)$(RM) $(ROM) $(DUMP) $(BUILDDIR) $(SDIMAGE) \
|
||||
$(SOUNDBANKDIR)/soundbank.bin
|
||||
$(V)$(RM) $(ROM) $(DUMP) build $(SDIMAGE)
|
||||
|
||||
sdimage:
|
||||
@echo " MKFATIMG $(SDIMAGE) $(SDROOT)"
|
||||
@ -260,12 +262,14 @@ $(BUILDDIR)/%.png.o $(BUILDDIR)/%.h : %.png %.grit
|
||||
@$(MKDIR) -p $(@D)
|
||||
$(V)$(BLOCKSDS)/tools/grit/grit $< -ftc -W1 -o$(BUILDDIR)/$*
|
||||
$(V)$(CC) $(CFLAGS) -MMD -MP -c -o $(BUILDDIR)/$*.png.o $(BUILDDIR)/$*.c
|
||||
$(V)touch $(BUILDDIR)/$*.png.o $(BUILDDIR)/$*.h
|
||||
|
||||
ifneq ($(SOURCES_AUDIO),)
|
||||
|
||||
$(SOUNDBANKINFODIR)/soundbank.h: $(SOURCES_AUDIO)
|
||||
@echo " MMUTIL $^"
|
||||
@$(MKDIR) -p $(@D)
|
||||
@$(MKDIR) -p $(SOUNDBANKDIR)
|
||||
@$(MKDIR) -p $(SOUNDBANKINFODIR)
|
||||
@$(BLOCKSDS)/tools/mmutil/mmutil $^ -d \
|
||||
-o$(SOUNDBANKDIR)/soundbank.bin -h$(SOUNDBANKINFODIR)/soundbank.h
|
||||
|
@ -1,5 +1,25 @@
|
||||
SUBDIRS:= `ls`
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
#
|
||||
# SPDX-FileContributor: Antonio Niño Díaz, 2023-2024
|
||||
|
||||
.PHONY: all clean
|
||||
|
||||
MAKE := make
|
||||
|
||||
all:
|
||||
@for i in $(SUBDIRS); do if test -e $$i/Makefile ; then $(MAKE) -C $$i || { exit 1;} fi; done;
|
||||
@for i in `ls`; do \
|
||||
if test -e $$i/Makefile ; then \
|
||||
cd $$i; \
|
||||
$(MAKE) --no-print-directory || exit 1 ; \
|
||||
cd ..; \
|
||||
fi; \
|
||||
done;
|
||||
|
||||
clean:
|
||||
@for i in $(SUBDIRS); do if test -e $$i/Makefile ; then $(MAKE) -C $$i clean || { exit 1;} fi; done;
|
||||
@for i in `ls`; do \
|
||||
if test -e $$i/Makefile ; then \
|
||||
cd $$i; \
|
||||
$(MAKE) clean --no-print-directory || exit 1 ; \
|
||||
cd ..; \
|
||||
fi; \
|
||||
done;
|
||||
|
@ -1,25 +0,0 @@
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
#
|
||||
# SPDX-FileContributor: Antonio Niño Díaz, 2023
|
||||
|
||||
.PHONY: all clean
|
||||
|
||||
MAKE := make
|
||||
|
||||
all:
|
||||
@for i in `ls`; do \
|
||||
if test -e $$i/Makefile.blocksds ; then \
|
||||
cd $$i; \
|
||||
$(MAKE) -f Makefile.blocksds --no-print-directory || { exit 1;}; \
|
||||
cd ..; \
|
||||
fi; \
|
||||
done;
|
||||
|
||||
clean:
|
||||
@for i in `ls`; do \
|
||||
if test -e $$i/Makefile.blocksds ; then \
|
||||
cd $$i; \
|
||||
$(MAKE) -f Makefile.blocksds clean --no-print-directory || { exit 1;}; \
|
||||
cd ..; \
|
||||
fi; \
|
||||
done;
|
@ -1,220 +1,7 @@
|
||||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#---------------------------------------------------------------------------------
|
||||
# This is a minimal makefile only used for the examples. If you want a makefile
|
||||
# for your project, take one from the templates inside examples/templates.
|
||||
|
||||
ifeq ($(strip $(DEVKITARM)),)
|
||||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
||||
endif
|
||||
BINDIRS := data
|
||||
GFXDIRS := graphics
|
||||
|
||||
include $(DEVKITARM)/ds_rules
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# TARGET is the name of the output
|
||||
# BUILD is the directory where object files & intermediate files will be placed
|
||||
# SOURCES is a list of directories containing source code
|
||||
# INCLUDES is a list of directories containing extra header files
|
||||
# DATA is a list of directories containing binary files embedded using bin2o
|
||||
# GRAPHICS is a list of directories containing image files to be converted with grit
|
||||
# AUDIO is a list of directories containing audio to be converted by maxmod
|
||||
# ICON is the image used to create the game icon, leave blank to use default rule
|
||||
# NITRO is a directory that will be accessible via NitroFS
|
||||
#---------------------------------------------------------------------------------
|
||||
TARGET := $(shell basename $(CURDIR))
|
||||
BUILD := build
|
||||
SOURCES := source
|
||||
INCLUDES := include
|
||||
DATA := data
|
||||
GRAPHICS := graphics
|
||||
AUDIO :=
|
||||
ICON :=
|
||||
|
||||
# specify a directory which contains the nitro filesystem
|
||||
# this is relative to the Makefile
|
||||
NITRO :=
|
||||
|
||||
# These set the information text in the nds file
|
||||
GAME_TITLE := $(shell basename $(CURDIR))
|
||||
GAME_SUBTITLE1 := Nitro Engine example
|
||||
GAME_SUBTITLE2 := github.com/AntonioND/nitro-engine
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# options for code generation
|
||||
#---------------------------------------------------------------------------------
|
||||
ARCH := -marm -mthumb-interwork -march=armv5te -mtune=arm946e-s
|
||||
|
||||
CFLAGS := -g -Wall -O3\
|
||||
$(ARCH) $(INCLUDE) -DARM9
|
||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
|
||||
ASFLAGS := -g $(ARCH)
|
||||
LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# any extra libraries we wish to link with the project (order is important)
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBS := -lNE -lfat -lnds9
|
||||
|
||||
# automatigically add libraries for NitroFS
|
||||
ifneq ($(strip $(NITRO)),)
|
||||
LIBS := -lfilesystem -lfat $(LIBS)
|
||||
endif
|
||||
# automagically add maxmod library
|
||||
ifneq ($(strip $(AUDIO)),)
|
||||
LIBS := -lmm9 $(LIBS)
|
||||
endif
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# list of directories containing libraries, this must be the top level containing
|
||||
# include and lib
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nitro-engine
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# no real need to edit anything past this point unless you need to add additional
|
||||
# rules for different file extensions
|
||||
#---------------------------------------------------------------------------------
|
||||
ifneq ($(BUILD),$(notdir $(CURDIR)))
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
export OUTPUT := $(CURDIR)/$(TARGET)
|
||||
|
||||
export VPATH := $(CURDIR)/$(subst /,,$(dir $(ICON)))\
|
||||
$(foreach dir,$(SOURCES),$(CURDIR)/$(dir))\
|
||||
$(foreach dir,$(DATA),$(CURDIR)/$(dir))\
|
||||
$(foreach dir,$(GRAPHICS),$(CURDIR)/$(dir))
|
||||
|
||||
export DEPSDIR := $(CURDIR)/$(BUILD)
|
||||
|
||||
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
|
||||
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
|
||||
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
|
||||
PNGFILES := $(foreach dir,$(GRAPHICS),$(notdir $(wildcard $(dir)/*.png)))
|
||||
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
|
||||
|
||||
# prepare NitroFS directory
|
||||
ifneq ($(strip $(NITRO)),)
|
||||
export NITRO_FILES := $(CURDIR)/$(NITRO)
|
||||
endif
|
||||
|
||||
# get audio list for maxmod
|
||||
ifneq ($(strip $(AUDIO)),)
|
||||
export MODFILES := $(foreach dir,$(notdir $(wildcard $(AUDIO)/*.*)),$(CURDIR)/$(AUDIO)/$(dir))
|
||||
|
||||
# place the soundbank file in NitroFS if using it
|
||||
ifneq ($(strip $(NITRO)),)
|
||||
export SOUNDBANK := $(NITRO_FILES)/soundbank.bin
|
||||
|
||||
# otherwise, needs to be loaded from memory
|
||||
else
|
||||
export SOUNDBANK := soundbank.bin
|
||||
BINFILES += $(SOUNDBANK)
|
||||
endif
|
||||
endif
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# use CXX for linking C++ projects, CC for standard C
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(CPPFILES)),)
|
||||
#---------------------------------------------------------------------------------
|
||||
export LD := $(CC)
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
#---------------------------------------------------------------------------------
|
||||
export LD := $(CXX)
|
||||
#---------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
|
||||
|
||||
export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
|
||||
|
||||
export OFILES := $(PNGFILES:.png=.o) $(OFILES_BIN) $(OFILES_SOURCES)
|
||||
|
||||
export HFILES := $(PNGFILES:.png=.h) $(addsuffix .h,$(subst .,_,$(BINFILES)))
|
||||
|
||||
export INCLUDE := $(foreach dir,$(INCLUDES),-iquote $(CURDIR)/$(dir))\
|
||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include)\
|
||||
-I$(CURDIR)/$(BUILD)
|
||||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
|
||||
|
||||
ifeq ($(strip $(ICON)),)
|
||||
icons := $(wildcard *.bmp)
|
||||
|
||||
ifneq (,$(findstring $(TARGET).bmp,$(icons)))
|
||||
export GAME_ICON := $(CURDIR)/$(TARGET).bmp
|
||||
else
|
||||
ifneq (,$(findstring icon.bmp,$(icons)))
|
||||
export GAME_ICON := $(CURDIR)/icon.bmp
|
||||
endif
|
||||
endif
|
||||
else
|
||||
ifeq ($(suffix $(ICON)), .grf)
|
||||
export GAME_ICON := $(CURDIR)/$(ICON)
|
||||
else
|
||||
export GAME_ICON := $(CURDIR)/$(BUILD)/$(notdir $(basename $(ICON))).grf
|
||||
endif
|
||||
endif
|
||||
|
||||
.PHONY: $(BUILD) clean
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
$(BUILD):
|
||||
@mkdir -p $@
|
||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
clean:
|
||||
@echo clean ...
|
||||
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(SOUNDBANK)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# main targets
|
||||
#---------------------------------------------------------------------------------
|
||||
$(OUTPUT).nds: $(OUTPUT).elf $(GAME_ICON)
|
||||
$(OUTPUT).elf: $(OFILES)
|
||||
|
||||
# source files depend on generated headers
|
||||
$(OFILES_SOURCES) : $(HFILES)
|
||||
|
||||
# need to build soundbank first
|
||||
$(OFILES): $(SOUNDBANK)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# rule to build solution from music files
|
||||
#---------------------------------------------------------------------------------
|
||||
$(SOUNDBANK) : $(MODFILES)
|
||||
#---------------------------------------------------------------------------------
|
||||
mmutil $^ -d -o$@ -hsoundbank.h
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.bin.o %_bin.h : %.bin
|
||||
#---------------------------------------------------------------------------------
|
||||
@echo $(notdir $<)
|
||||
@$(bin2o)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# This rule creates assembly source files using grit
|
||||
# grit takes an image file and a .grit describing how the file is to be processed
|
||||
# add additional rules like this for each image extension
|
||||
# you use in the graphics folders
|
||||
#---------------------------------------------------------------------------------
|
||||
%.s %.h: %.png %.grit
|
||||
#---------------------------------------------------------------------------------
|
||||
grit $< -fts -o$*
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# Convert non-GRF game icon to GRF if needed
|
||||
#---------------------------------------------------------------------------------
|
||||
$(GAME_ICON): $(notdir $(ICON))
|
||||
#---------------------------------------------------------------------------------
|
||||
@echo convert $(notdir $<)
|
||||
@grit $< -g -gt -gB4 -gT FF00FF -m! -p -pe 16 -fh! -ftr
|
||||
|
||||
-include $(DEPSDIR)/*.d
|
||||
|
||||
#---------------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------------
|
||||
include ../../Makefile.example
|
||||
|
@ -1,7 +0,0 @@
|
||||
# This is a minimal makefile only used for the examples. If you want a makefile
|
||||
# for your project, take one from the templates inside examples/templates.
|
||||
|
||||
BINDIRS := data
|
||||
GFXDIRS := graphics
|
||||
|
||||
include ../../Makefile.example.blocksds
|
@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
NITRO_ENGINE=$DEVKITPRO/nitro-engine
|
||||
NITRO_ENGINE=../../..
|
||||
ASSETS=$NITRO_ENGINE/examples/assets
|
||||
TOOLS=$NITRO_ENGINE/tools
|
||||
OBJ2DL=$TOOLS/obj2dl/obj2dl.py
|
||||
|
Binary file not shown.
@ -1,6 +1,6 @@
|
||||
// SPDX-License-Identifier: CC0-1.0
|
||||
//
|
||||
// SPDX-FileContributor: Antonio Niño Díaz, 2008-2011, 2019, 2022
|
||||
// SPDX-FileContributor: Antonio Niño Díaz, 2008-2024
|
||||
//
|
||||
// This file is part of Nitro Engine
|
||||
|
||||
@ -9,26 +9,31 @@
|
||||
#include "texture.h"
|
||||
#include "sphere_bin.h"
|
||||
|
||||
NE_Camera *Camera;
|
||||
NE_Model *Model, *Model2, *Model3;
|
||||
NE_Material *Material;
|
||||
typedef struct {
|
||||
NE_Camera *Camera;
|
||||
NE_Model *Model, *Model2, *Model3;
|
||||
} SceneData;
|
||||
|
||||
void Draw3DScene(void)
|
||||
void Draw3DScene(void *arg)
|
||||
{
|
||||
SceneData *Scene = arg;
|
||||
|
||||
// Set camera
|
||||
NE_CameraUse(Camera);
|
||||
NE_CameraUse(Scene->Camera);
|
||||
|
||||
// This has to be used to use fog
|
||||
NE_PolyFormat(31, 0, NE_LIGHT_ALL, NE_CULL_BACK, NE_FOG_ENABLE);
|
||||
|
||||
// Draw models
|
||||
NE_ModelDraw(Model);
|
||||
NE_ModelDraw(Model2);
|
||||
NE_ModelDraw(Model3);
|
||||
NE_ModelDraw(Scene->Model);
|
||||
NE_ModelDraw(Scene->Model2);
|
||||
NE_ModelDraw(Scene->Model3);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
SceneData Scene = { 0 };
|
||||
|
||||
irqEnable(IRQ_HBLANK);
|
||||
irqSet(IRQ_VBLANK, NE_VBLFunc);
|
||||
irqSet(IRQ_VBLANK, NE_HBLFunc);
|
||||
@ -41,39 +46,39 @@ int main(void)
|
||||
consoleDemoInit();
|
||||
|
||||
// Allocate objects
|
||||
Model = NE_ModelCreate(NE_Static);
|
||||
Model2 = NE_ModelCreate(NE_Static);
|
||||
Model3 = NE_ModelCreate(NE_Static);
|
||||
Camera = NE_CameraCreate();
|
||||
Material = NE_MaterialCreate();
|
||||
Scene.Model = NE_ModelCreate(NE_Static);
|
||||
Scene.Model2 = NE_ModelCreate(NE_Static);
|
||||
Scene.Model3 = NE_ModelCreate(NE_Static);
|
||||
Scene.Camera = NE_CameraCreate();
|
||||
NE_Material *Material = NE_MaterialCreate();
|
||||
|
||||
// Set camera coordinates
|
||||
NE_CameraSet(Camera,
|
||||
NE_CameraSet(Scene.Camera,
|
||||
-1, 2, -1,
|
||||
1, 1, 1,
|
||||
0, 1, 0);
|
||||
|
||||
// Load models
|
||||
NE_ModelLoadStaticMesh(Model, sphere_bin);
|
||||
NE_ModelLoadStaticMesh(Model2, sphere_bin);
|
||||
NE_ModelLoadStaticMesh(Model3, sphere_bin);
|
||||
NE_ModelLoadStaticMesh(Scene.Model, sphere_bin);
|
||||
NE_ModelLoadStaticMesh(Scene.Model2, sphere_bin);
|
||||
NE_ModelLoadStaticMesh(Scene.Model3, sphere_bin);
|
||||
|
||||
// Load texture
|
||||
NE_MaterialTexLoad(Material, NE_RGB5, 256, 256, NE_TEXGEN_TEXCOORD,
|
||||
NE_MaterialTexLoad(Material, NE_A1RGB5, 256, 256, NE_TEXGEN_TEXCOORD,
|
||||
textureBitmap);
|
||||
|
||||
// Assign the same material to every model object.
|
||||
NE_ModelSetMaterial(Model, Material);
|
||||
NE_ModelSetMaterial(Model2, Material);
|
||||
NE_ModelSetMaterial(Model3, Material);
|
||||
NE_ModelSetMaterial(Scene.Model, Material);
|
||||
NE_ModelSetMaterial(Scene.Model2, Material);
|
||||
NE_ModelSetMaterial(Scene.Model3, Material);
|
||||
|
||||
// Set light and vector of light 0
|
||||
NE_LightSet(0, NE_White, 0, -1, -1);
|
||||
|
||||
// Set position of every object
|
||||
NE_ModelSetCoord(Model, 1, 0, 1);
|
||||
NE_ModelSetCoord(Model2, 3, 1, 3);
|
||||
NE_ModelSetCoord(Model3, 7, 2, 7);
|
||||
NE_ModelSetCoord(Scene.Model, 1, 0, 1);
|
||||
NE_ModelSetCoord(Scene.Model2, 3, 1, 3);
|
||||
NE_ModelSetCoord(Scene.Model3, 7, 2, 7);
|
||||
|
||||
// Set initial fog color to black
|
||||
u32 color = NE_Black;
|
||||
@ -125,7 +130,7 @@ int main(void)
|
||||
shift, mass, depth);
|
||||
|
||||
// Draw scene
|
||||
NE_Process(Draw3DScene);
|
||||
NE_ProcessArg(Draw3DScene, &Scene);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -1,220 +1,6 @@
|
||||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#---------------------------------------------------------------------------------
|
||||
# This is a minimal makefile only used for the examples. If you want a makefile
|
||||
# for your project, take one from the templates inside examples/templates.
|
||||
|
||||
ifeq ($(strip $(DEVKITARM)),)
|
||||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
||||
endif
|
||||
BINDIRS := data
|
||||
|
||||
include $(DEVKITARM)/ds_rules
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# TARGET is the name of the output
|
||||
# BUILD is the directory where object files & intermediate files will be placed
|
||||
# SOURCES is a list of directories containing source code
|
||||
# INCLUDES is a list of directories containing extra header files
|
||||
# DATA is a list of directories containing binary files embedded using bin2o
|
||||
# GRAPHICS is a list of directories containing image files to be converted with grit
|
||||
# AUDIO is a list of directories containing audio to be converted by maxmod
|
||||
# ICON is the image used to create the game icon, leave blank to use default rule
|
||||
# NITRO is a directory that will be accessible via NitroFS
|
||||
#---------------------------------------------------------------------------------
|
||||
TARGET := $(shell basename $(CURDIR))
|
||||
BUILD := build
|
||||
SOURCES := source
|
||||
INCLUDES := include
|
||||
DATA := data
|
||||
GRAPHICS :=
|
||||
AUDIO :=
|
||||
ICON :=
|
||||
|
||||
# specify a directory which contains the nitro filesystem
|
||||
# this is relative to the Makefile
|
||||
NITRO :=
|
||||
|
||||
# These set the information text in the nds file
|
||||
GAME_TITLE := $(shell basename $(CURDIR))
|
||||
GAME_SUBTITLE1 := Nitro Engine example
|
||||
GAME_SUBTITLE2 := github.com/AntonioND/nitro-engine
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# options for code generation
|
||||
#---------------------------------------------------------------------------------
|
||||
ARCH := -marm -mthumb-interwork -march=armv5te -mtune=arm946e-s
|
||||
|
||||
CFLAGS := -g -Wall -O3\
|
||||
$(ARCH) $(INCLUDE) -DARM9
|
||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
|
||||
ASFLAGS := -g $(ARCH)
|
||||
LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# any extra libraries we wish to link with the project (order is important)
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBS := -lNE -lfat -lnds9
|
||||
|
||||
# automatigically add libraries for NitroFS
|
||||
ifneq ($(strip $(NITRO)),)
|
||||
LIBS := -lfilesystem -lfat $(LIBS)
|
||||
endif
|
||||
# automagically add maxmod library
|
||||
ifneq ($(strip $(AUDIO)),)
|
||||
LIBS := -lmm9 $(LIBS)
|
||||
endif
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# list of directories containing libraries, this must be the top level containing
|
||||
# include and lib
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nitro-engine
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# no real need to edit anything past this point unless you need to add additional
|
||||
# rules for different file extensions
|
||||
#---------------------------------------------------------------------------------
|
||||
ifneq ($(BUILD),$(notdir $(CURDIR)))
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
export OUTPUT := $(CURDIR)/$(TARGET)
|
||||
|
||||
export VPATH := $(CURDIR)/$(subst /,,$(dir $(ICON)))\
|
||||
$(foreach dir,$(SOURCES),$(CURDIR)/$(dir))\
|
||||
$(foreach dir,$(DATA),$(CURDIR)/$(dir))\
|
||||
$(foreach dir,$(GRAPHICS),$(CURDIR)/$(dir))
|
||||
|
||||
export DEPSDIR := $(CURDIR)/$(BUILD)
|
||||
|
||||
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
|
||||
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
|
||||
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
|
||||
PNGFILES := $(foreach dir,$(GRAPHICS),$(notdir $(wildcard $(dir)/*.png)))
|
||||
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
|
||||
|
||||
# prepare NitroFS directory
|
||||
ifneq ($(strip $(NITRO)),)
|
||||
export NITRO_FILES := $(CURDIR)/$(NITRO)
|
||||
endif
|
||||
|
||||
# get audio list for maxmod
|
||||
ifneq ($(strip $(AUDIO)),)
|
||||
export MODFILES := $(foreach dir,$(notdir $(wildcard $(AUDIO)/*.*)),$(CURDIR)/$(AUDIO)/$(dir))
|
||||
|
||||
# place the soundbank file in NitroFS if using it
|
||||
ifneq ($(strip $(NITRO)),)
|
||||
export SOUNDBANK := $(NITRO_FILES)/soundbank.bin
|
||||
|
||||
# otherwise, needs to be loaded from memory
|
||||
else
|
||||
export SOUNDBANK := soundbank.bin
|
||||
BINFILES += $(SOUNDBANK)
|
||||
endif
|
||||
endif
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# use CXX for linking C++ projects, CC for standard C
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(CPPFILES)),)
|
||||
#---------------------------------------------------------------------------------
|
||||
export LD := $(CC)
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
#---------------------------------------------------------------------------------
|
||||
export LD := $(CXX)
|
||||
#---------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
|
||||
|
||||
export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
|
||||
|
||||
export OFILES := $(PNGFILES:.png=.o) $(OFILES_BIN) $(OFILES_SOURCES)
|
||||
|
||||
export HFILES := $(PNGFILES:.png=.h) $(addsuffix .h,$(subst .,_,$(BINFILES)))
|
||||
|
||||
export INCLUDE := $(foreach dir,$(INCLUDES),-iquote $(CURDIR)/$(dir))\
|
||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include)\
|
||||
-I$(CURDIR)/$(BUILD)
|
||||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
|
||||
|
||||
ifeq ($(strip $(ICON)),)
|
||||
icons := $(wildcard *.bmp)
|
||||
|
||||
ifneq (,$(findstring $(TARGET).bmp,$(icons)))
|
||||
export GAME_ICON := $(CURDIR)/$(TARGET).bmp
|
||||
else
|
||||
ifneq (,$(findstring icon.bmp,$(icons)))
|
||||
export GAME_ICON := $(CURDIR)/icon.bmp
|
||||
endif
|
||||
endif
|
||||
else
|
||||
ifeq ($(suffix $(ICON)), .grf)
|
||||
export GAME_ICON := $(CURDIR)/$(ICON)
|
||||
else
|
||||
export GAME_ICON := $(CURDIR)/$(BUILD)/$(notdir $(basename $(ICON))).grf
|
||||
endif
|
||||
endif
|
||||
|
||||
.PHONY: $(BUILD) clean
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
$(BUILD):
|
||||
@mkdir -p $@
|
||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
clean:
|
||||
@echo clean ...
|
||||
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(SOUNDBANK)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# main targets
|
||||
#---------------------------------------------------------------------------------
|
||||
$(OUTPUT).nds: $(OUTPUT).elf $(GAME_ICON)
|
||||
$(OUTPUT).elf: $(OFILES)
|
||||
|
||||
# source files depend on generated headers
|
||||
$(OFILES_SOURCES) : $(HFILES)
|
||||
|
||||
# need to build soundbank first
|
||||
$(OFILES): $(SOUNDBANK)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# rule to build solution from music files
|
||||
#---------------------------------------------------------------------------------
|
||||
$(SOUNDBANK) : $(MODFILES)
|
||||
#---------------------------------------------------------------------------------
|
||||
mmutil $^ -d -o$@ -hsoundbank.h
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.bin.o %_bin.h : %.bin
|
||||
#---------------------------------------------------------------------------------
|
||||
@echo $(notdir $<)
|
||||
@$(bin2o)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# This rule creates assembly source files using grit
|
||||
# grit takes an image file and a .grit describing how the file is to be processed
|
||||
# add additional rules like this for each image extension
|
||||
# you use in the graphics folders
|
||||
#---------------------------------------------------------------------------------
|
||||
%.s %.h: %.png %.grit
|
||||
#---------------------------------------------------------------------------------
|
||||
grit $< -fts -o$*
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# Convert non-GRF game icon to GRF if needed
|
||||
#---------------------------------------------------------------------------------
|
||||
$(GAME_ICON): $(notdir $(ICON))
|
||||
#---------------------------------------------------------------------------------
|
||||
@echo convert $(notdir $<)
|
||||
@grit $< -g -gt -gB4 -gT FF00FF -m! -p -pe 16 -fh! -ftr
|
||||
|
||||
-include $(DEPSDIR)/*.d
|
||||
|
||||
#---------------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------------
|
||||
include ../../Makefile.example
|
||||
|
@ -1,6 +0,0 @@
|
||||
# This is a minimal makefile only used for the examples. If you want a makefile
|
||||
# for your project, take one from the templates inside examples/templates.
|
||||
|
||||
BINDIRS := data
|
||||
|
||||
include ../../Makefile.example.blocksds
|
@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
NITRO_ENGINE=$DEVKITPRO/nitro-engine
|
||||
NITRO_ENGINE=../../..
|
||||
ASSETS=$NITRO_ENGINE/examples/assets
|
||||
TOOLS=$NITRO_ENGINE/tools
|
||||
OBJ2DL=$TOOLS/obj2dl/obj2dl.py
|
||||
|
Binary file not shown.
@ -1,6 +1,6 @@
|
||||
// SPDX-License-Identifier: CC0-1.0
|
||||
//
|
||||
// SPDX-FileContributor: Antonio Niño Díaz, 2008-2011, 2019, 2022
|
||||
// SPDX-FileContributor: Antonio Niño Díaz, 2008-2024
|
||||
//
|
||||
// This file is part of Nitro Engine
|
||||
|
||||
@ -8,29 +8,37 @@
|
||||
|
||||
#include "teapot_bin.h"
|
||||
|
||||
NE_Camera *Camera;
|
||||
NE_Model *Model;
|
||||
typedef struct {
|
||||
NE_Camera *Camera;
|
||||
NE_Model *Model;
|
||||
} SceneData;
|
||||
|
||||
void Draw3DScene(void)
|
||||
void Draw3DScene(void *arg)
|
||||
{
|
||||
SceneData *Scene = arg;
|
||||
|
||||
// Set rear plane color
|
||||
NE_ClearColorSet(NE_Red, 31, 63);
|
||||
|
||||
NE_CameraUse(Camera);
|
||||
NE_ModelDraw(Model);
|
||||
NE_CameraUse(Scene->Camera);
|
||||
NE_ModelDraw(Scene->Model);
|
||||
}
|
||||
|
||||
void Draw3DScene2(void)
|
||||
void Draw3DScene2(void *arg)
|
||||
{
|
||||
SceneData *Scene = arg;
|
||||
|
||||
// Set rear plane color
|
||||
NE_ClearColorSet(NE_Green, 31, 63);
|
||||
|
||||
NE_CameraUse(Camera);
|
||||
NE_ModelDraw(Model);
|
||||
NE_CameraUse(Scene->Camera);
|
||||
NE_ModelDraw(Scene->Model);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
SceneData Scene = { 0 };
|
||||
|
||||
// This is needed for special screen effects
|
||||
irqEnable(IRQ_HBLANK);
|
||||
irqSet(IRQ_VBLANK, NE_VBLFunc);
|
||||
@ -41,24 +49,21 @@ int main(void)
|
||||
NE_InitConsole();
|
||||
|
||||
// Allocate objects...
|
||||
Model = NE_ModelCreate(NE_Static);
|
||||
Camera = NE_CameraCreate();
|
||||
Scene.Model = NE_ModelCreate(NE_Static);
|
||||
Scene.Camera = NE_CameraCreate();
|
||||
|
||||
// Setup camera
|
||||
NE_CameraSet(Camera,
|
||||
NE_CameraSet(Scene.Camera,
|
||||
0, 0, -3,
|
||||
0, 0, 0,
|
||||
0, 1, 0);
|
||||
|
||||
// Load model
|
||||
NE_ModelLoadStaticMesh(Model, teapot_bin);
|
||||
NE_ModelLoadStaticMesh(Scene.Model, teapot_bin);
|
||||
|
||||
// Set light color and direction
|
||||
NE_LightSet(0, NE_White, -0.5, -0.5, -0.5);
|
||||
|
||||
// Enable shading
|
||||
NE_ShadingEnable(true);
|
||||
|
||||
// Other test configurations
|
||||
//NE_SpecialEffectNoiseConfig(31);
|
||||
//NE_SpecialEffectSineConfig(3, 8);
|
||||
@ -78,13 +83,13 @@ int main(void)
|
||||
|
||||
// Rotate model
|
||||
if (keys & KEY_UP)
|
||||
NE_ModelRotate(Model, 0, 0, 2);
|
||||
NE_ModelRotate(Scene.Model, 0, 0, 2);
|
||||
if (keys & KEY_DOWN)
|
||||
NE_ModelRotate(Model, 0, 0, -2);
|
||||
NE_ModelRotate(Scene.Model, 0, 0, -2);
|
||||
if (keys & KEY_RIGHT)
|
||||
NE_ModelRotate(Model, 0, 2, 0);
|
||||
NE_ModelRotate(Scene.Model, 0, 2, 0);
|
||||
if (keys & KEY_LEFT)
|
||||
NE_ModelRotate(Model, 0, -2, 0);
|
||||
NE_ModelRotate(Scene.Model, 0, -2, 0);
|
||||
|
||||
// Activate effects
|
||||
if (kdown & KEY_B)
|
||||
@ -102,7 +107,7 @@ int main(void)
|
||||
NE_SpecialEffectPause(false);
|
||||
|
||||
// Draw 3D scenes
|
||||
NE_ProcessDual(Draw3DScene, Draw3DScene2);
|
||||
NE_ProcessDualArg(Draw3DScene, Draw3DScene2, &Scene, &Scene);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -1,220 +1,6 @@
|
||||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#---------------------------------------------------------------------------------
|
||||
# This is a minimal makefile only used for the examples. If you want a makefile
|
||||
# for your project, take one from the templates inside examples/templates.
|
||||
|
||||
ifeq ($(strip $(DEVKITARM)),)
|
||||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
||||
endif
|
||||
BINDIRS := data
|
||||
|
||||
include $(DEVKITARM)/ds_rules
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# TARGET is the name of the output
|
||||
# BUILD is the directory where object files & intermediate files will be placed
|
||||
# SOURCES is a list of directories containing source code
|
||||
# INCLUDES is a list of directories containing extra header files
|
||||
# DATA is a list of directories containing binary files embedded using bin2o
|
||||
# GRAPHICS is a list of directories containing image files to be converted with grit
|
||||
# AUDIO is a list of directories containing audio to be converted by maxmod
|
||||
# ICON is the image used to create the game icon, leave blank to use default rule
|
||||
# NITRO is a directory that will be accessible via NitroFS
|
||||
#---------------------------------------------------------------------------------
|
||||
TARGET := $(shell basename $(CURDIR))
|
||||
BUILD := build
|
||||
SOURCES := source
|
||||
INCLUDES := include
|
||||
DATA := data
|
||||
GRAPHICS :=
|
||||
AUDIO :=
|
||||
ICON :=
|
||||
|
||||
# specify a directory which contains the nitro filesystem
|
||||
# this is relative to the Makefile
|
||||
NITRO :=
|
||||
|
||||
# These set the information text in the nds file
|
||||
GAME_TITLE := $(shell basename $(CURDIR))
|
||||
GAME_SUBTITLE1 := Nitro Engine example
|
||||
GAME_SUBTITLE2 := github.com/AntonioND/nitro-engine
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# options for code generation
|
||||
#---------------------------------------------------------------------------------
|
||||
ARCH := -marm -mthumb-interwork -march=armv5te -mtune=arm946e-s
|
||||
|
||||
CFLAGS := -g -Wall -O3\
|
||||
$(ARCH) $(INCLUDE) -DARM9
|
||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
|
||||
ASFLAGS := -g $(ARCH)
|
||||
LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# any extra libraries we wish to link with the project (order is important)
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBS := -lNE -lfat -lnds9
|
||||
|
||||
# automatigically add libraries for NitroFS
|
||||
ifneq ($(strip $(NITRO)),)
|
||||
LIBS := -lfilesystem -lfat $(LIBS)
|
||||
endif
|
||||
# automagically add maxmod library
|
||||
ifneq ($(strip $(AUDIO)),)
|
||||
LIBS := -lmm9 $(LIBS)
|
||||
endif
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# list of directories containing libraries, this must be the top level containing
|
||||
# include and lib
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nitro-engine
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# no real need to edit anything past this point unless you need to add additional
|
||||
# rules for different file extensions
|
||||
#---------------------------------------------------------------------------------
|
||||
ifneq ($(BUILD),$(notdir $(CURDIR)))
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
export OUTPUT := $(CURDIR)/$(TARGET)
|
||||
|
||||
export VPATH := $(CURDIR)/$(subst /,,$(dir $(ICON)))\
|
||||
$(foreach dir,$(SOURCES),$(CURDIR)/$(dir))\
|
||||
$(foreach dir,$(DATA),$(CURDIR)/$(dir))\
|
||||
$(foreach dir,$(GRAPHICS),$(CURDIR)/$(dir))
|
||||
|
||||
export DEPSDIR := $(CURDIR)/$(BUILD)
|
||||
|
||||
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
|
||||
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
|
||||
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
|
||||
PNGFILES := $(foreach dir,$(GRAPHICS),$(notdir $(wildcard $(dir)/*.png)))
|
||||
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
|
||||
|
||||
# prepare NitroFS directory
|
||||
ifneq ($(strip $(NITRO)),)
|
||||
export NITRO_FILES := $(CURDIR)/$(NITRO)
|
||||
endif
|
||||
|
||||
# get audio list for maxmod
|
||||
ifneq ($(strip $(AUDIO)),)
|
||||
export MODFILES := $(foreach dir,$(notdir $(wildcard $(AUDIO)/*.*)),$(CURDIR)/$(AUDIO)/$(dir))
|
||||
|
||||
# place the soundbank file in NitroFS if using it
|
||||
ifneq ($(strip $(NITRO)),)
|
||||
export SOUNDBANK := $(NITRO_FILES)/soundbank.bin
|
||||
|
||||
# otherwise, needs to be loaded from memory
|
||||
else
|
||||
export SOUNDBANK := soundbank.bin
|
||||
BINFILES += $(SOUNDBANK)
|
||||
endif
|
||||
endif
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# use CXX for linking C++ projects, CC for standard C
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(CPPFILES)),)
|
||||
#---------------------------------------------------------------------------------
|
||||
export LD := $(CC)
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
#---------------------------------------------------------------------------------
|
||||
export LD := $(CXX)
|
||||
#---------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
|
||||
|
||||
export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
|
||||
|
||||
export OFILES := $(PNGFILES:.png=.o) $(OFILES_BIN) $(OFILES_SOURCES)
|
||||
|
||||
export HFILES := $(PNGFILES:.png=.h) $(addsuffix .h,$(subst .,_,$(BINFILES)))
|
||||
|
||||
export INCLUDE := $(foreach dir,$(INCLUDES),-iquote $(CURDIR)/$(dir))\
|
||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include)\
|
||||
-I$(CURDIR)/$(BUILD)
|
||||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
|
||||
|
||||
ifeq ($(strip $(ICON)),)
|
||||
icons := $(wildcard *.bmp)
|
||||
|
||||
ifneq (,$(findstring $(TARGET).bmp,$(icons)))
|
||||
export GAME_ICON := $(CURDIR)/$(TARGET).bmp
|
||||
else
|
||||
ifneq (,$(findstring icon.bmp,$(icons)))
|
||||
export GAME_ICON := $(CURDIR)/icon.bmp
|
||||
endif
|
||||
endif
|
||||
else
|
||||
ifeq ($(suffix $(ICON)), .grf)
|
||||
export GAME_ICON := $(CURDIR)/$(ICON)
|
||||
else
|
||||
export GAME_ICON := $(CURDIR)/$(BUILD)/$(notdir $(basename $(ICON))).grf
|
||||
endif
|
||||
endif
|
||||
|
||||
.PHONY: $(BUILD) clean
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
$(BUILD):
|
||||
@mkdir -p $@
|
||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
clean:
|
||||
@echo clean ...
|
||||
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(SOUNDBANK)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# main targets
|
||||
#---------------------------------------------------------------------------------
|
||||
$(OUTPUT).nds: $(OUTPUT).elf $(GAME_ICON)
|
||||
$(OUTPUT).elf: $(OFILES)
|
||||
|
||||
# source files depend on generated headers
|
||||
$(OFILES_SOURCES) : $(HFILES)
|
||||
|
||||
# need to build soundbank first
|
||||
$(OFILES): $(SOUNDBANK)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# rule to build solution from music files
|
||||
#---------------------------------------------------------------------------------
|
||||
$(SOUNDBANK) : $(MODFILES)
|
||||
#---------------------------------------------------------------------------------
|
||||
mmutil $^ -d -o$@ -hsoundbank.h
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.bin.o %_bin.h : %.bin
|
||||
#---------------------------------------------------------------------------------
|
||||
@echo $(notdir $<)
|
||||
@$(bin2o)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# This rule creates assembly source files using grit
|
||||
# grit takes an image file and a .grit describing how the file is to be processed
|
||||
# add additional rules like this for each image extension
|
||||
# you use in the graphics folders
|
||||
#---------------------------------------------------------------------------------
|
||||
%.s %.h: %.png %.grit
|
||||
#---------------------------------------------------------------------------------
|
||||
grit $< -fts -o$*
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# Convert non-GRF game icon to GRF if needed
|
||||
#---------------------------------------------------------------------------------
|
||||
$(GAME_ICON): $(notdir $(ICON))
|
||||
#---------------------------------------------------------------------------------
|
||||
@echo convert $(notdir $<)
|
||||
@grit $< -g -gt -gB4 -gT FF00FF -m! -p -pe 16 -fh! -ftr
|
||||
|
||||
-include $(DEPSDIR)/*.d
|
||||
|
||||
#---------------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------------
|
||||
include ../../Makefile.example
|
||||
|
@ -1,6 +0,0 @@
|
||||
# This is a minimal makefile only used for the examples. If you want a makefile
|
||||
# for your project, take one from the templates inside examples/templates.
|
||||
|
||||
BINDIRS := data
|
||||
|
||||
include ../../Makefile.example.blocksds
|
@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
NITRO_ENGINE=$DEVKITPRO/nitro-engine
|
||||
NITRO_ENGINE=../../..
|
||||
ASSETS=$NITRO_ENGINE/examples/assets
|
||||
TOOLS=$NITRO_ENGINE/tools
|
||||
OBJ2DL=$TOOLS/obj2dl/obj2dl.py
|
||||
|
Binary file not shown.
Binary file not shown.
@ -1,6 +1,6 @@
|
||||
// SPDX-License-Identifier: CC0-1.0
|
||||
//
|
||||
// SPDX-FileContributor: Antonio Niño Díaz, 2008-2011, 2019, 2022-2023
|
||||
// SPDX-FileContributor: Antonio Niño Díaz, 2008-2024
|
||||
//
|
||||
// This file is part of Nitro Engine
|
||||
|
||||
@ -11,27 +11,35 @@
|
||||
#include "teapot_bin.h"
|
||||
#include "sphere_bin.h"
|
||||
|
||||
NE_Camera *Camera;
|
||||
NE_Model *Teapot, *Sphere;
|
||||
typedef struct {
|
||||
NE_Camera *Camera;
|
||||
NE_Model *Teapot, *Sphere;
|
||||
} SceneData;
|
||||
|
||||
void Draw3DScene(void)
|
||||
void Draw3DScene(void *arg)
|
||||
{
|
||||
SceneData *Scene = arg;
|
||||
|
||||
NE_ClearColorSet(NE_Red, 31, 63);
|
||||
|
||||
NE_CameraUse(Camera);
|
||||
NE_ModelDraw(Teapot);
|
||||
NE_CameraUse(Scene->Camera);
|
||||
NE_ModelDraw(Scene->Teapot);
|
||||
}
|
||||
|
||||
void Draw3DScene2(void)
|
||||
void Draw3DScene2(void *arg)
|
||||
{
|
||||
SceneData *Scene = arg;
|
||||
|
||||
NE_ClearColorSet(NE_Green, 31, 63);
|
||||
|
||||
NE_CameraUse(Camera);
|
||||
NE_ModelDraw(Sphere);
|
||||
NE_CameraUse(Scene->Camera);
|
||||
NE_ModelDraw(Scene->Sphere);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
SceneData Scene = { 0 };
|
||||
|
||||
// This is needed for special screen effects
|
||||
irqEnable(IRQ_HBLANK);
|
||||
irqSet(IRQ_VBLANK, NE_VBLFunc);
|
||||
@ -42,26 +50,23 @@ int main(void)
|
||||
NE_InitConsole();
|
||||
|
||||
// Allocate objects...
|
||||
Teapot = NE_ModelCreate(NE_Static);
|
||||
Sphere = NE_ModelCreate(NE_Static);
|
||||
Camera = NE_CameraCreate();
|
||||
Scene.Teapot = NE_ModelCreate(NE_Static);
|
||||
Scene.Sphere = NE_ModelCreate(NE_Static);
|
||||
Scene.Camera = NE_CameraCreate();
|
||||
|
||||
// Setup camera
|
||||
NE_CameraSet(Camera,
|
||||
NE_CameraSet(Scene.Camera,
|
||||
0, 0, -2,
|
||||
0, 0, 0,
|
||||
0, 1, 0);
|
||||
|
||||
// Load models
|
||||
NE_ModelLoadStaticMesh(Teapot, teapot_bin);
|
||||
NE_ModelLoadStaticMesh(Sphere, sphere_bin);
|
||||
NE_ModelLoadStaticMesh(Scene.Teapot, teapot_bin);
|
||||
NE_ModelLoadStaticMesh(Scene.Sphere, sphere_bin);
|
||||
|
||||
// Set light color and direction
|
||||
NE_LightSet(0, NE_White, -0.5, -0.5, -0.5);
|
||||
|
||||
// Enable shading
|
||||
NE_ShadingEnable(true);
|
||||
|
||||
// Other test configurations
|
||||
//NE_SpecialEffectNoiseConfig(31);
|
||||
//NE_SpecialEffectSineConfig(3, 8);
|
||||
@ -71,7 +76,7 @@ int main(void)
|
||||
NE_WaitForVBL(0);
|
||||
|
||||
// Draw 3D scenes
|
||||
NE_ProcessDual(Draw3DScene, Draw3DScene2);
|
||||
NE_ProcessDualArg(Draw3DScene, Draw3DScene2, &Scene, &Scene);
|
||||
|
||||
// Refresh keys
|
||||
scanKeys();
|
||||
@ -93,23 +98,23 @@ int main(void)
|
||||
// Rotate model
|
||||
if (keys & KEY_UP)
|
||||
{
|
||||
NE_ModelRotate(Sphere, 0, 0, 2);
|
||||
NE_ModelRotate(Teapot, 0, 0, 2);
|
||||
NE_ModelRotate(Scene.Sphere, 0, 0, 2);
|
||||
NE_ModelRotate(Scene.Teapot, 0, 0, 2);
|
||||
}
|
||||
if (keys & KEY_DOWN)
|
||||
{
|
||||
NE_ModelRotate(Sphere, 0, 0, -2);
|
||||
NE_ModelRotate(Teapot, 0, 0, -2);
|
||||
NE_ModelRotate(Scene.Sphere, 0, 0, -2);
|
||||
NE_ModelRotate(Scene.Teapot, 0, 0, -2);
|
||||
}
|
||||
if (keys & KEY_RIGHT)
|
||||
{
|
||||
NE_ModelRotate(Sphere, 0, 2, 0);
|
||||
NE_ModelRotate(Teapot, 0, 2, 0);
|
||||
NE_ModelRotate(Scene.Sphere, 0, 2, 0);
|
||||
NE_ModelRotate(Scene.Teapot, 0, 2, 0);
|
||||
}
|
||||
if (keys & KEY_LEFT)
|
||||
{
|
||||
NE_ModelRotate(Sphere, 0, -2, 0);
|
||||
NE_ModelRotate(Teapot, 0, -2, 0);
|
||||
NE_ModelRotate(Scene.Sphere, 0, -2, 0);
|
||||
NE_ModelRotate(Scene.Teapot, 0, -2, 0);
|
||||
}
|
||||
|
||||
// Activate effects
|
||||
|
@ -1,220 +1,7 @@
|
||||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#---------------------------------------------------------------------------------
|
||||
# This is a minimal makefile only used for the examples. If you want a makefile
|
||||
# for your project, take one from the templates inside examples/templates.
|
||||
|
||||
ifeq ($(strip $(DEVKITARM)),)
|
||||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
||||
endif
|
||||
BINDIRS := data
|
||||
GFXDIRS := graphics
|
||||
|
||||
include $(DEVKITARM)/ds_rules
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# TARGET is the name of the output
|
||||
# BUILD is the directory where object files & intermediate files will be placed
|
||||
# SOURCES is a list of directories containing source code
|
||||
# INCLUDES is a list of directories containing extra header files
|
||||
# DATA is a list of directories containing binary files embedded using bin2o
|
||||
# GRAPHICS is a list of directories containing image files to be converted with grit
|
||||
# AUDIO is a list of directories containing audio to be converted by maxmod
|
||||
# ICON is the image used to create the game icon, leave blank to use default rule
|
||||
# NITRO is a directory that will be accessible via NitroFS
|
||||
#---------------------------------------------------------------------------------
|
||||
TARGET := $(shell basename $(CURDIR))
|
||||
BUILD := build
|
||||
SOURCES := source
|
||||
INCLUDES := include
|
||||
DATA := data
|
||||
GRAPHICS := graphics
|
||||
AUDIO :=
|
||||
ICON :=
|
||||
|
||||
# specify a directory which contains the nitro filesystem
|
||||
# this is relative to the Makefile
|
||||
NITRO :=
|
||||
|
||||
# These set the information text in the nds file
|
||||
GAME_TITLE := $(shell basename $(CURDIR))
|
||||
GAME_SUBTITLE1 := Nitro Engine example
|
||||
GAME_SUBTITLE2 := github.com/AntonioND/nitro-engine
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# options for code generation
|
||||
#---------------------------------------------------------------------------------
|
||||
ARCH := -marm -mthumb-interwork -march=armv5te -mtune=arm946e-s
|
||||
|
||||
CFLAGS := -g -Wall -O3\
|
||||
$(ARCH) $(INCLUDE) -DARM9
|
||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
|
||||
ASFLAGS := -g $(ARCH)
|
||||
LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# any extra libraries we wish to link with the project (order is important)
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBS := -lNE -lfat -lnds9
|
||||
|
||||
# automatigically add libraries for NitroFS
|
||||
ifneq ($(strip $(NITRO)),)
|
||||
LIBS := -lfilesystem -lfat $(LIBS)
|
||||
endif
|
||||
# automagically add maxmod library
|
||||
ifneq ($(strip $(AUDIO)),)
|
||||
LIBS := -lmm9 $(LIBS)
|
||||
endif
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# list of directories containing libraries, this must be the top level containing
|
||||
# include and lib
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nitro-engine
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# no real need to edit anything past this point unless you need to add additional
|
||||
# rules for different file extensions
|
||||
#---------------------------------------------------------------------------------
|
||||
ifneq ($(BUILD),$(notdir $(CURDIR)))
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
export OUTPUT := $(CURDIR)/$(TARGET)
|
||||
|
||||
export VPATH := $(CURDIR)/$(subst /,,$(dir $(ICON)))\
|
||||
$(foreach dir,$(SOURCES),$(CURDIR)/$(dir))\
|
||||
$(foreach dir,$(DATA),$(CURDIR)/$(dir))\
|
||||
$(foreach dir,$(GRAPHICS),$(CURDIR)/$(dir))
|
||||
|
||||
export DEPSDIR := $(CURDIR)/$(BUILD)
|
||||
|
||||
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
|
||||
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
|
||||
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
|
||||
PNGFILES := $(foreach dir,$(GRAPHICS),$(notdir $(wildcard $(dir)/*.png)))
|
||||
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
|
||||
|
||||
# prepare NitroFS directory
|
||||
ifneq ($(strip $(NITRO)),)
|
||||
export NITRO_FILES := $(CURDIR)/$(NITRO)
|
||||
endif
|
||||
|
||||
# get audio list for maxmod
|
||||
ifneq ($(strip $(AUDIO)),)
|
||||
export MODFILES := $(foreach dir,$(notdir $(wildcard $(AUDIO)/*.*)),$(CURDIR)/$(AUDIO)/$(dir))
|
||||
|
||||
# place the soundbank file in NitroFS if using it
|
||||
ifneq ($(strip $(NITRO)),)
|
||||
export SOUNDBANK := $(NITRO_FILES)/soundbank.bin
|
||||
|
||||
# otherwise, needs to be loaded from memory
|
||||
else
|
||||
export SOUNDBANK := soundbank.bin
|
||||
BINFILES += $(SOUNDBANK)
|
||||
endif
|
||||
endif
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# use CXX for linking C++ projects, CC for standard C
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(CPPFILES)),)
|
||||
#---------------------------------------------------------------------------------
|
||||
export LD := $(CC)
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
#---------------------------------------------------------------------------------
|
||||
export LD := $(CXX)
|
||||
#---------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
|
||||
|
||||
export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
|
||||
|
||||
export OFILES := $(PNGFILES:.png=.o) $(OFILES_BIN) $(OFILES_SOURCES)
|
||||
|
||||
export HFILES := $(PNGFILES:.png=.h) $(addsuffix .h,$(subst .,_,$(BINFILES)))
|
||||
|
||||
export INCLUDE := $(foreach dir,$(INCLUDES),-iquote $(CURDIR)/$(dir))\
|
||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include)\
|
||||
-I$(CURDIR)/$(BUILD)
|
||||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
|
||||
|
||||
ifeq ($(strip $(ICON)),)
|
||||
icons := $(wildcard *.bmp)
|
||||
|
||||
ifneq (,$(findstring $(TARGET).bmp,$(icons)))
|
||||
export GAME_ICON := $(CURDIR)/$(TARGET).bmp
|
||||
else
|
||||
ifneq (,$(findstring icon.bmp,$(icons)))
|
||||
export GAME_ICON := $(CURDIR)/icon.bmp
|
||||
endif
|
||||
endif
|
||||
else
|
||||
ifeq ($(suffix $(ICON)), .grf)
|
||||
export GAME_ICON := $(CURDIR)/$(ICON)
|
||||
else
|
||||
export GAME_ICON := $(CURDIR)/$(BUILD)/$(notdir $(basename $(ICON))).grf
|
||||
endif
|
||||
endif
|
||||
|
||||
.PHONY: $(BUILD) clean
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
$(BUILD):
|
||||
@mkdir -p $@
|
||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
clean:
|
||||
@echo clean ...
|
||||
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(SOUNDBANK)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# main targets
|
||||
#---------------------------------------------------------------------------------
|
||||
$(OUTPUT).nds: $(OUTPUT).elf $(GAME_ICON)
|
||||
$(OUTPUT).elf: $(OFILES)
|
||||
|
||||
# source files depend on generated headers
|
||||
$(OFILES_SOURCES) : $(HFILES)
|
||||
|
||||
# need to build soundbank first
|
||||
$(OFILES): $(SOUNDBANK)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# rule to build solution from music files
|
||||
#---------------------------------------------------------------------------------
|
||||
$(SOUNDBANK) : $(MODFILES)
|
||||
#---------------------------------------------------------------------------------
|
||||
mmutil $^ -d -o$@ -hsoundbank.h
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.bin.o %_bin.h : %.bin
|
||||
#---------------------------------------------------------------------------------
|
||||
@echo $(notdir $<)
|
||||
@$(bin2o)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# This rule creates assembly source files using grit
|
||||
# grit takes an image file and a .grit describing how the file is to be processed
|
||||
# add additional rules like this for each image extension
|
||||
# you use in the graphics folders
|
||||
#---------------------------------------------------------------------------------
|
||||
%.s %.h: %.png %.grit
|
||||
#---------------------------------------------------------------------------------
|
||||
grit $< -fts -o$*
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# Convert non-GRF game icon to GRF if needed
|
||||
#---------------------------------------------------------------------------------
|
||||
$(GAME_ICON): $(notdir $(ICON))
|
||||
#---------------------------------------------------------------------------------
|
||||
@echo convert $(notdir $<)
|
||||
@grit $< -g -gt -gB4 -gT FF00FF -m! -p -pe 16 -fh! -ftr
|
||||
|
||||
-include $(DEPSDIR)/*.d
|
||||
|
||||
#---------------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------------
|
||||
include ../../Makefile.example
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
NITRO_ENGINE=$DEVKITPRO/nitro-engine
|
||||
NITRO_ENGINE=../../..
|
||||
ASSETS=$NITRO_ENGINE/examples/assets
|
||||
TOOLS=$NITRO_ENGINE/tools
|
||||
OBJ2DL=$TOOLS/obj2dl/obj2dl.py
|
||||
|
Binary file not shown.
@ -1,6 +1,6 @@
|
||||
// SPDX-License-Identifier: CC0-1.0
|
||||
//
|
||||
// SPDX-FileContributor: Antonio Niño Díaz, 2008-2011, 2019, 2022
|
||||
// SPDX-FileContributor: Antonio Niño Díaz, 2008-2024
|
||||
//
|
||||
// This file is part of Nitro Engine
|
||||
|
||||
@ -9,26 +9,32 @@
|
||||
#include "teapot_bin.h"
|
||||
#include "teapot.h"
|
||||
|
||||
NE_Camera *Camera;
|
||||
NE_Model *Model;
|
||||
NE_Material *Material;
|
||||
typedef struct {
|
||||
NE_Camera *Camera;
|
||||
NE_Model *Model;
|
||||
|
||||
int shading, alpha, id;
|
||||
int shading, alpha, id;
|
||||
} SceneData;
|
||||
|
||||
void Draw3DScene(void)
|
||||
void Draw3DScene(void *arg)
|
||||
{
|
||||
SceneData *Scene = arg;
|
||||
|
||||
// Set camera
|
||||
NE_CameraUse(Camera);
|
||||
NE_CameraUse(Scene->Camera);
|
||||
|
||||
// Set polygon format
|
||||
NE_PolyFormat(alpha, id, NE_LIGHT_0, NE_CULL_BACK, shading);
|
||||
NE_PolyFormat(Scene->alpha, Scene->id, NE_LIGHT_0, NE_CULL_BACK,
|
||||
Scene->shading);
|
||||
|
||||
// Draw model
|
||||
NE_ModelDraw(Model);
|
||||
NE_ModelDraw(Scene->Model);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
SceneData Scene = { 0 };
|
||||
|
||||
// This is needed for special screen effects
|
||||
irqEnable(IRQ_HBLANK);
|
||||
irqSet(IRQ_VBLANK, NE_VBLFunc);
|
||||
@ -43,25 +49,25 @@ int main(void)
|
||||
consoleDemoInit();
|
||||
|
||||
// Allocate the objects we will use
|
||||
Model = NE_ModelCreate(NE_Static);
|
||||
Camera = NE_CameraCreate();
|
||||
Material = NE_MaterialCreate();
|
||||
Scene.Model = NE_ModelCreate(NE_Static);
|
||||
Scene.Camera = NE_CameraCreate();
|
||||
NE_Material *Material = NE_MaterialCreate();
|
||||
|
||||
// Set camera coordinates
|
||||
NE_CameraSet(Camera,
|
||||
NE_CameraSet(Scene.Camera,
|
||||
0, 0, -3,
|
||||
0, 0, 0,
|
||||
0, 1, 0);
|
||||
|
||||
// Load mesh from RAM and assign it to a model
|
||||
NE_ModelLoadStaticMesh(Model, teapot_bin);
|
||||
// Load teapot from RAM and assign it to a material
|
||||
NE_MaterialTexLoad(Material, NE_RGB5, 256, 256,
|
||||
NE_ModelLoadStaticMesh(Scene.Model, teapot_bin);
|
||||
// Load teapot texture from RAM and assign it to a material
|
||||
NE_MaterialTexLoad(Material, NE_A1RGB5, 256, 256,
|
||||
NE_TEXGEN_TEXCOORD | NE_TEXTURE_WRAP_S | NE_TEXTURE_WRAP_T,
|
||||
teapotBitmap);
|
||||
|
||||
// Assign material to the model
|
||||
NE_ModelSetMaterial(Model, Material);
|
||||
NE_ModelSetMaterial(Scene.Model, Material);
|
||||
|
||||
// Set some properties to the material
|
||||
NE_MaterialSetProperties(Material,
|
||||
@ -75,7 +81,7 @@ int main(void)
|
||||
NE_LightSet(0, NE_White, -0.5, -0.5, -0.5);
|
||||
|
||||
// This enables shading (you can choose normal or toon).
|
||||
NE_ShadingEnable(true);
|
||||
NE_SetupToonShadingTables(true);
|
||||
// This enables outlining in all polygons, so be careful
|
||||
NE_OutliningEnable(true);
|
||||
|
||||
@ -98,35 +104,35 @@ int main(void)
|
||||
|
||||
// Rotate model using the pad
|
||||
if (keys & KEY_UP)
|
||||
NE_ModelRotate(Model, 0, 0, 2);
|
||||
NE_ModelRotate(Scene.Model, 0, 0, 2);
|
||||
if (keys & KEY_DOWN)
|
||||
NE_ModelRotate(Model, 0, 0, -2);
|
||||
NE_ModelRotate(Scene.Model, 0, 0, -2);
|
||||
if (keys & KEY_RIGHT)
|
||||
NE_ModelRotate(Model, 0, 2, 0);
|
||||
NE_ModelRotate(Scene.Model, 0, 2, 0);
|
||||
if (keys & KEY_LEFT)
|
||||
NE_ModelRotate(Model, 0, -2, 0);
|
||||
NE_ModelRotate(Scene.Model, 0, -2, 0);
|
||||
|
||||
// Change shading type
|
||||
if (keys & KEY_A)
|
||||
shading = NE_TOON_HIGHLIGHT_SHADING;
|
||||
Scene.shading = NE_TOON_HIGHLIGHT_SHADING;
|
||||
else
|
||||
shading = NE_MODULATION;
|
||||
Scene.shading = NE_MODULATION;
|
||||
|
||||
if (keys & KEY_B)
|
||||
alpha = 15; // Transparent
|
||||
Scene.alpha = 15; // Transparent
|
||||
else if (keys & KEY_Y)
|
||||
alpha = 0; // Wireframe
|
||||
Scene.alpha = 0; // Wireframe
|
||||
else
|
||||
alpha = 31; // Opaque
|
||||
Scene.alpha = 31; // Opaque
|
||||
|
||||
// Change polygon ID to change outlining color
|
||||
if (keys & KEY_X)
|
||||
id = 8;
|
||||
Scene.id = 8;
|
||||
else
|
||||
id = 0;
|
||||
Scene.id = 0;
|
||||
|
||||
// Draw scene
|
||||
NE_Process(Draw3DScene);
|
||||
NE_ProcessArg(Draw3DScene, &Scene);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -1,220 +1,7 @@
|
||||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#---------------------------------------------------------------------------------
|
||||
# This is a minimal makefile only used for the examples. If you want a makefile
|
||||
# for your project, take one from the templates inside examples/templates.
|
||||
|
||||
ifeq ($(strip $(DEVKITARM)),)
|
||||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
||||
endif
|
||||
BINDIRS := data
|
||||
GFXDIRS := graphics
|
||||
|
||||
include $(DEVKITARM)/ds_rules
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# TARGET is the name of the output
|
||||
# BUILD is the directory where object files & intermediate files will be placed
|
||||
# SOURCES is a list of directories containing source code
|
||||
# INCLUDES is a list of directories containing extra header files
|
||||
# DATA is a list of directories containing binary files embedded using bin2o
|
||||
# GRAPHICS is a list of directories containing image files to be converted with grit
|
||||
# AUDIO is a list of directories containing audio to be converted by maxmod
|
||||
# ICON is the image used to create the game icon, leave blank to use default rule
|
||||
# NITRO is a directory that will be accessible via NitroFS
|
||||
#---------------------------------------------------------------------------------
|
||||
TARGET := $(shell basename $(CURDIR))
|
||||
BUILD := build
|
||||
SOURCES := source
|
||||
INCLUDES := include
|
||||
DATA := data
|
||||
GRAPHICS := graphics
|
||||
AUDIO :=
|
||||
ICON :=
|
||||
|
||||
# specify a directory which contains the nitro filesystem
|
||||
# this is relative to the Makefile
|
||||
NITRO :=
|
||||
|
||||
# These set the information text in the nds file
|
||||
GAME_TITLE := $(shell basename $(CURDIR))
|
||||
GAME_SUBTITLE1 := Nitro Engine example
|
||||
GAME_SUBTITLE2 := github.com/AntonioND/nitro-engine
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# options for code generation
|
||||
#---------------------------------------------------------------------------------
|
||||
ARCH := -marm -mthumb-interwork -march=armv5te -mtune=arm946e-s
|
||||
|
||||
CFLAGS := -g -Wall -O3\
|
||||
$(ARCH) $(INCLUDE) -DARM9
|
||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
|
||||
ASFLAGS := -g $(ARCH)
|
||||
LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# any extra libraries we wish to link with the project (order is important)
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBS := -lNE -lfat -lnds9
|
||||
|
||||
# automatigically add libraries for NitroFS
|
||||
ifneq ($(strip $(NITRO)),)
|
||||
LIBS := -lfilesystem -lfat $(LIBS)
|
||||
endif
|
||||
# automagically add maxmod library
|
||||
ifneq ($(strip $(AUDIO)),)
|
||||
LIBS := -lmm9 $(LIBS)
|
||||
endif
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# list of directories containing libraries, this must be the top level containing
|
||||
# include and lib
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nitro-engine
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# no real need to edit anything past this point unless you need to add additional
|
||||
# rules for different file extensions
|
||||
#---------------------------------------------------------------------------------
|
||||
ifneq ($(BUILD),$(notdir $(CURDIR)))
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
export OUTPUT := $(CURDIR)/$(TARGET)
|
||||
|
||||
export VPATH := $(CURDIR)/$(subst /,,$(dir $(ICON)))\
|
||||
$(foreach dir,$(SOURCES),$(CURDIR)/$(dir))\
|
||||
$(foreach dir,$(DATA),$(CURDIR)/$(dir))\
|
||||
$(foreach dir,$(GRAPHICS),$(CURDIR)/$(dir))
|
||||
|
||||
export DEPSDIR := $(CURDIR)/$(BUILD)
|
||||
|
||||
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
|
||||
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
|
||||
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
|
||||
PNGFILES := $(foreach dir,$(GRAPHICS),$(notdir $(wildcard $(dir)/*.png)))
|
||||
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
|
||||
|
||||
# prepare NitroFS directory
|
||||
ifneq ($(strip $(NITRO)),)
|
||||
export NITRO_FILES := $(CURDIR)/$(NITRO)
|
||||
endif
|
||||
|
||||
# get audio list for maxmod
|
||||
ifneq ($(strip $(AUDIO)),)
|
||||
export MODFILES := $(foreach dir,$(notdir $(wildcard $(AUDIO)/*.*)),$(CURDIR)/$(AUDIO)/$(dir))
|
||||
|
||||
# place the soundbank file in NitroFS if using it
|
||||
ifneq ($(strip $(NITRO)),)
|
||||
export SOUNDBANK := $(NITRO_FILES)/soundbank.bin
|
||||
|
||||
# otherwise, needs to be loaded from memory
|
||||
else
|
||||
export SOUNDBANK := soundbank.bin
|
||||
BINFILES += $(SOUNDBANK)
|
||||
endif
|
||||
endif
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# use CXX for linking C++ projects, CC for standard C
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(CPPFILES)),)
|
||||
#---------------------------------------------------------------------------------
|
||||
export LD := $(CC)
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
#---------------------------------------------------------------------------------
|
||||
export LD := $(CXX)
|
||||
#---------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
|
||||
|
||||
export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
|
||||
|
||||
export OFILES := $(PNGFILES:.png=.o) $(OFILES_BIN) $(OFILES_SOURCES)
|
||||
|
||||
export HFILES := $(PNGFILES:.png=.h) $(addsuffix .h,$(subst .,_,$(BINFILES)))
|
||||
|
||||
export INCLUDE := $(foreach dir,$(INCLUDES),-iquote $(CURDIR)/$(dir))\
|
||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include)\
|
||||
-I$(CURDIR)/$(BUILD)
|
||||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
|
||||
|
||||
ifeq ($(strip $(ICON)),)
|
||||
icons := $(wildcard *.bmp)
|
||||
|
||||
ifneq (,$(findstring $(TARGET).bmp,$(icons)))
|
||||
export GAME_ICON := $(CURDIR)/$(TARGET).bmp
|
||||
else
|
||||
ifneq (,$(findstring icon.bmp,$(icons)))
|
||||
export GAME_ICON := $(CURDIR)/icon.bmp
|
||||
endif
|
||||
endif
|
||||
else
|
||||
ifeq ($(suffix $(ICON)), .grf)
|
||||
export GAME_ICON := $(CURDIR)/$(ICON)
|
||||
else
|
||||
export GAME_ICON := $(CURDIR)/$(BUILD)/$(notdir $(basename $(ICON))).grf
|
||||
endif
|
||||
endif
|
||||
|
||||
.PHONY: $(BUILD) clean
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
$(BUILD):
|
||||
@mkdir -p $@
|
||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
clean:
|
||||
@echo clean ...
|
||||
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(SOUNDBANK)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# main targets
|
||||
#---------------------------------------------------------------------------------
|
||||
$(OUTPUT).nds: $(OUTPUT).elf $(GAME_ICON)
|
||||
$(OUTPUT).elf: $(OFILES)
|
||||
|
||||
# source files depend on generated headers
|
||||
$(OFILES_SOURCES) : $(HFILES)
|
||||
|
||||
# need to build soundbank first
|
||||
$(OFILES): $(SOUNDBANK)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# rule to build solution from music files
|
||||
#---------------------------------------------------------------------------------
|
||||
$(SOUNDBANK) : $(MODFILES)
|
||||
#---------------------------------------------------------------------------------
|
||||
mmutil $^ -d -o$@ -hsoundbank.h
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.bin.o %_bin.h : %.bin
|
||||
#---------------------------------------------------------------------------------
|
||||
@echo $(notdir $<)
|
||||
@$(bin2o)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# This rule creates assembly source files using grit
|
||||
# grit takes an image file and a .grit describing how the file is to be processed
|
||||
# add additional rules like this for each image extension
|
||||
# you use in the graphics folders
|
||||
#---------------------------------------------------------------------------------
|
||||
%.s %.h: %.png %.grit
|
||||
#---------------------------------------------------------------------------------
|
||||
grit $< -fts -o$*
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# Convert non-GRF game icon to GRF if needed
|
||||
#---------------------------------------------------------------------------------
|
||||
$(GAME_ICON): $(notdir $(ICON))
|
||||
#---------------------------------------------------------------------------------
|
||||
@echo convert $(notdir $<)
|
||||
@grit $< -g -gt -gB4 -gT FF00FF -m! -p -pe 16 -fh! -ftr
|
||||
|
||||
-include $(DEPSDIR)/*.d
|
||||
|
||||
#---------------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------------
|
||||
include ../../Makefile.example
|
||||
|
@ -1,7 +0,0 @@
|
||||
# This is a minimal makefile only used for the examples. If you want a makefile
|
||||
# for your project, take one from the templates inside examples/templates.
|
||||
|
||||
BINDIRS := data
|
||||
GFXDIRS := graphics
|
||||
|
||||
include ../../Makefile.example.blocksds
|
@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
NITRO_ENGINE=$DEVKITPRO/nitro-engine
|
||||
NITRO_ENGINE=../../..
|
||||
ASSETS=$NITRO_ENGINE/examples/assets
|
||||
TOOLS=$NITRO_ENGINE/tools
|
||||
OBJ2DL=$TOOLS/obj2dl/obj2dl.py
|
||||
|
Binary file not shown.
@ -1,6 +1,6 @@
|
||||
// SPDX-License-Identifier: CC0-1.0
|
||||
//
|
||||
// SPDX-FileContributor: Antonio Niño Díaz, 2008-2011, 2019, 2022
|
||||
// SPDX-FileContributor: Antonio Niño Díaz, 2008-2024
|
||||
//
|
||||
// This file is part of Nitro Engine
|
||||
|
||||
@ -10,19 +10,22 @@
|
||||
#include "teapot_bin.h"
|
||||
#include "teapot.h"
|
||||
|
||||
NE_Camera *Camera;
|
||||
NE_Model *ModelSpecular, *ModelDiffuse;
|
||||
NE_Material *MaterialSpecular, *MaterialDiffuse;
|
||||
typedef struct {
|
||||
NE_Camera *Camera;
|
||||
NE_Model *ModelSpecular, *ModelDiffuse;
|
||||
|
||||
bool wireframe;
|
||||
bool wireframe;
|
||||
} SceneData;
|
||||
|
||||
void Draw3DScene1(void)
|
||||
void Draw3DScene1(void *arg)
|
||||
{
|
||||
NE_CameraUse(Camera);
|
||||
SceneData *Scene = arg;
|
||||
|
||||
NE_PolyFormat(wireframe ? 0 : 31, 0, NE_LIGHT_ALL, NE_CULL_BACK, 0);
|
||||
NE_CameraUse(Scene->Camera);
|
||||
|
||||
NE_ModelDraw(ModelSpecular);
|
||||
NE_PolyFormat(Scene->wireframe ? 0 : 31, 0, NE_LIGHT_ALL, NE_CULL_BACK, 0);
|
||||
|
||||
NE_ModelDraw(Scene->ModelSpecular);
|
||||
|
||||
printf("\x1b[22;0H"
|
||||
"Polygon count: %d \n"
|
||||
@ -31,17 +34,21 @@ void Draw3DScene1(void)
|
||||
NE_GetVertexCount());
|
||||
}
|
||||
|
||||
void Draw3DScene2(void)
|
||||
void Draw3DScene2(void *arg)
|
||||
{
|
||||
NE_CameraUse(Camera);
|
||||
SceneData *Scene = arg;
|
||||
|
||||
NE_PolyFormat(wireframe ? 0 : 31, 0, NE_LIGHT_ALL, NE_CULL_BACK, 0);
|
||||
NE_CameraUse(Scene->Camera);
|
||||
|
||||
NE_ModelDraw(ModelDiffuse);
|
||||
NE_PolyFormat(Scene->wireframe ? 0 : 31, 0, NE_LIGHT_ALL, NE_CULL_BACK, 0);
|
||||
|
||||
NE_ModelDraw(Scene->ModelDiffuse);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
SceneData Scene = { 0 };
|
||||
|
||||
irqEnable(IRQ_HBLANK);
|
||||
irqSet(IRQ_VBLANK, NE_VBLFunc);
|
||||
irqSet(IRQ_HBLANK, NE_HBLFunc);
|
||||
@ -50,21 +57,21 @@ int main(void)
|
||||
NE_InitConsole();
|
||||
|
||||
// Allocate objects
|
||||
Camera = NE_CameraCreate();
|
||||
ModelSpecular = NE_ModelCreate(NE_Static);
|
||||
ModelDiffuse = NE_ModelCreate(NE_Static);
|
||||
MaterialSpecular = NE_MaterialCreate();
|
||||
MaterialDiffuse = NE_MaterialCreate();
|
||||
Scene.Camera = NE_CameraCreate();
|
||||
Scene.ModelSpecular = NE_ModelCreate(NE_Static);
|
||||
Scene.ModelDiffuse = NE_ModelCreate(NE_Static);
|
||||
NE_Material *MaterialSpecular = NE_MaterialCreate();
|
||||
NE_Material *MaterialDiffuse = NE_MaterialCreate();
|
||||
|
||||
// Setup camera
|
||||
NE_CameraSet(Camera,
|
||||
NE_CameraSet(Scene.Camera,
|
||||
0, 0, 3,
|
||||
0, 0, 0,
|
||||
0, 1, 0);
|
||||
|
||||
// Load model
|
||||
NE_ModelLoadStaticMesh(ModelSpecular, (u32*)teapot_bin);
|
||||
NE_ModelClone(ModelDiffuse, ModelSpecular);
|
||||
NE_ModelLoadStaticMesh(Scene.ModelSpecular, teapot_bin);
|
||||
NE_ModelClone(Scene.ModelDiffuse, Scene.ModelSpecular);
|
||||
|
||||
// Load texture and clone it. The texture coordinates of the model are
|
||||
// outside of [0.0, 1.0], so it is needed to enable wrapping.
|
||||
@ -73,8 +80,8 @@ int main(void)
|
||||
teapotBitmap);
|
||||
NE_MaterialClone(MaterialSpecular, MaterialDiffuse);
|
||||
|
||||
NE_ModelSetMaterial(ModelSpecular, MaterialSpecular);
|
||||
NE_ModelSetMaterial(ModelDiffuse, MaterialDiffuse);
|
||||
NE_ModelSetMaterial(Scene.ModelSpecular, MaterialSpecular);
|
||||
NE_ModelSetMaterial(Scene.ModelDiffuse, MaterialDiffuse);
|
||||
|
||||
// Set some properties to the materials
|
||||
|
||||
@ -115,30 +122,30 @@ int main(void)
|
||||
"L/R: Change shininess\n");
|
||||
|
||||
if (keys & KEY_A)
|
||||
wireframe = true;
|
||||
Scene.wireframe = true;
|
||||
else
|
||||
wireframe = false;
|
||||
Scene.wireframe = false;
|
||||
|
||||
// Rotate model
|
||||
if (keys & KEY_UP)
|
||||
{
|
||||
NE_ModelRotate(ModelSpecular, -2, 0, 0);
|
||||
NE_ModelRotate(ModelDiffuse, -2, 0, 0);
|
||||
NE_ModelRotate(Scene.ModelSpecular, -2, 0, 0);
|
||||
NE_ModelRotate(Scene.ModelDiffuse, -2, 0, 0);
|
||||
}
|
||||
if (keys & KEY_DOWN)
|
||||
{
|
||||
NE_ModelRotate(ModelSpecular, 2, 0, 0);
|
||||
NE_ModelRotate(ModelDiffuse, 2, 0, 0);
|
||||
NE_ModelRotate(Scene.ModelSpecular, 2, 0, 0);
|
||||
NE_ModelRotate(Scene.ModelDiffuse, 2, 0, 0);
|
||||
}
|
||||
if (keys & KEY_RIGHT)
|
||||
{
|
||||
NE_ModelRotate(ModelSpecular, 0, 2, 0);
|
||||
NE_ModelRotate(ModelDiffuse, 0, 2, 0);
|
||||
NE_ModelRotate(Scene.ModelSpecular, 0, 2, 0);
|
||||
NE_ModelRotate(Scene.ModelDiffuse, 0, 2, 0);
|
||||
}
|
||||
if (keys & KEY_LEFT)
|
||||
{
|
||||
NE_ModelRotate(ModelSpecular, 0, -2, 0);
|
||||
NE_ModelRotate(ModelDiffuse, 0, -2, 0);
|
||||
NE_ModelRotate(Scene.ModelSpecular, 0, -2, 0);
|
||||
NE_ModelRotate(Scene.ModelDiffuse, 0, -2, 0);
|
||||
}
|
||||
|
||||
// Shininess table
|
||||
@ -166,7 +173,7 @@ int main(void)
|
||||
|
||||
NE_ShininessTableGenerate(shininess);
|
||||
|
||||
NE_ProcessDual(Draw3DScene1, Draw3DScene2);
|
||||
NE_ProcessDualArg(Draw3DScene1, Draw3DScene2, &Scene, &Scene);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -4,4 +4,4 @@
|
||||
BINDIRS := data
|
||||
GFXDIRS := graphics
|
||||
|
||||
include ../../Makefile.example.blocksds
|
||||
include ../../Makefile.example
|
15
examples/effects/volumetric_shadow/assets.sh
Normal file
15
examples/effects/volumetric_shadow/assets.sh
Normal file
@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
|
||||
NITRO_ENGINE=../../..
|
||||
ASSETS=$NITRO_ENGINE/examples/assets
|
||||
TOOLS=$NITRO_ENGINE/tools
|
||||
OBJ2DL=$TOOLS/obj2dl/obj2dl.py
|
||||
|
||||
rm -rf data
|
||||
mkdir -p data
|
||||
|
||||
python3 $OBJ2DL \
|
||||
--input $ASSETS/teapot.obj \
|
||||
--output data/teapot.bin \
|
||||
--texture 256 256 \
|
||||
--scale 0.1
|
BIN
examples/effects/volumetric_shadow/data/teapot.bin
Normal file
BIN
examples/effects/volumetric_shadow/data/teapot.bin
Normal file
Binary file not shown.
2
examples/effects/volumetric_shadow/graphics/teapot.grit
Normal file
2
examples/effects/volumetric_shadow/graphics/teapot.grit
Normal file
@ -0,0 +1,2 @@
|
||||
# 16-bit palette, no transparency
|
||||
-gx -gb -gB16 -gT!
|
BIN
examples/effects/volumetric_shadow/graphics/teapot.png
Normal file
BIN
examples/effects/volumetric_shadow/graphics/teapot.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 100 KiB |
277
examples/effects/volumetric_shadow/source/main.c
Normal file
277
examples/effects/volumetric_shadow/source/main.c
Normal file
@ -0,0 +1,277 @@
|
||||
// SPDX-License-Identifier: CC0-1.0
|
||||
//
|
||||
// SPDX-FileContributor: Antonio Niño Díaz, 2024
|
||||
//
|
||||
// This file is part of Nitro Engine
|
||||
|
||||
#include <NEMain.h>
|
||||
|
||||
#include "teapot_bin.h"
|
||||
#include "teapot.h"
|
||||
|
||||
typedef struct {
|
||||
NE_Camera *Camera;
|
||||
NE_Model *Teapot;
|
||||
NE_Material *Material;
|
||||
|
||||
bool draw_edges;
|
||||
} SceneData;
|
||||
|
||||
void DrawFloor(void)
|
||||
{
|
||||
NE_PolyNormal(0, -0.97, 0);
|
||||
|
||||
NE_PolyBegin(GL_QUAD);
|
||||
|
||||
NE_PolyTexCoord(0, 0);
|
||||
NE_PolyVertex(-10, 0, -10);
|
||||
|
||||
NE_PolyTexCoord(0, 256);
|
||||
NE_PolyVertex(-10, 0, 10);
|
||||
|
||||
NE_PolyTexCoord(256, 256);
|
||||
NE_PolyVertex(10, 0, 10);
|
||||
|
||||
NE_PolyTexCoord(256, 0);
|
||||
NE_PolyVertex(10, 0, -10);
|
||||
|
||||
NE_PolyEnd();
|
||||
}
|
||||
|
||||
void DrawLid(void)
|
||||
{
|
||||
NE_PolyNormal(0, -0.97, 0);
|
||||
|
||||
NE_PolyBegin(GL_QUAD);
|
||||
|
||||
NE_PolyTexCoord(0, 0);
|
||||
NE_PolyVertex(-0.75, 3, -0.75);
|
||||
|
||||
NE_PolyTexCoord(0, 256);
|
||||
NE_PolyVertex(-0.75, 3, 0.75);
|
||||
|
||||
NE_PolyTexCoord(256, 256);
|
||||
NE_PolyVertex( 0.75, 3, 0.75);
|
||||
|
||||
NE_PolyTexCoord(256, 0);
|
||||
NE_PolyVertex( 0.75, 3, -0.75);
|
||||
|
||||
NE_PolyEnd();
|
||||
}
|
||||
|
||||
void DrawShadowVolume(void)
|
||||
{
|
||||
// Lid
|
||||
|
||||
NE_PolyBegin(GL_QUAD);
|
||||
|
||||
NE_PolyVertex(-0.75, 3, -0.75);
|
||||
NE_PolyVertex(-0.75, 3, 0.75);
|
||||
NE_PolyVertex( 0.75, 3, 0.75);
|
||||
NE_PolyVertex( 0.75, 3, -0.75);
|
||||
|
||||
NE_PolyEnd();
|
||||
|
||||
// Walls
|
||||
|
||||
NE_PolyBegin(GL_QUAD_STRIP);
|
||||
|
||||
NE_PolyVertex(-0.75, 3, -0.75);
|
||||
NE_PolyVertex(-0.75, 0, -0.75);
|
||||
NE_PolyVertex(-0.75, 3, 0.75);
|
||||
NE_PolyVertex(-0.75, 0, 0.75);
|
||||
|
||||
NE_PolyVertex( 0.75, 3, 0.75);
|
||||
NE_PolyVertex( 0.75, 0, 0.75);
|
||||
|
||||
NE_PolyVertex( 0.75, 3, -0.75);
|
||||
NE_PolyVertex( 0.75, 0, -0.75);
|
||||
|
||||
NE_PolyVertex(-0.75, 3, -0.75);
|
||||
NE_PolyVertex(-0.75, 0, -0.75);
|
||||
|
||||
NE_PolyEnd();
|
||||
|
||||
// Bottom
|
||||
|
||||
NE_PolyBegin(GL_QUAD);
|
||||
|
||||
NE_PolyVertex(-0.75, 0, -0.75);
|
||||
NE_PolyVertex(-0.75, 0, 0.75);
|
||||
NE_PolyVertex( 0.75, 0, 0.75);
|
||||
NE_PolyVertex( 0.75, 0, -0.75);
|
||||
|
||||
NE_PolyEnd();
|
||||
}
|
||||
|
||||
void Draw3DSceneBright(void *arg)
|
||||
{
|
||||
NE_LightSet(0, NE_White, 0, -0.97, -0.0);
|
||||
|
||||
SceneData *Scene = arg;
|
||||
|
||||
// Set camera
|
||||
NE_CameraUse(Scene->Camera);
|
||||
|
||||
// Set polygon format for regular models
|
||||
NE_PolyFormat(31, 0, NE_LIGHT_0, NE_CULL_BACK, NE_MODULATION);
|
||||
|
||||
// Draw regular models
|
||||
NE_ModelDraw(Scene->Teapot);
|
||||
|
||||
NE_MaterialUse(Scene->Material);
|
||||
DrawFloor();
|
||||
DrawLid();
|
||||
|
||||
// Draw shadow volume as a black volume (shadow)
|
||||
NE_MaterialUse(NULL);
|
||||
NE_PolyColor(NE_Black);
|
||||
|
||||
if (Scene->draw_edges)
|
||||
{
|
||||
// Draw the shadow volume in wireframe mode to see where it is
|
||||
NE_PolyFormat(0, 0, 0, NE_CULL_NONE, NE_MODULATION);
|
||||
DrawShadowVolume();
|
||||
}
|
||||
|
||||
NE_PolyFormat(1, 0, 0, NE_CULL_NONE, NE_SHADOW_POLYGONS);
|
||||
DrawShadowVolume();
|
||||
|
||||
NE_PolyFormat(20, 63, 0, NE_CULL_NONE, NE_SHADOW_POLYGONS);
|
||||
DrawShadowVolume();
|
||||
}
|
||||
|
||||
void Draw3DSceneDark(void *arg)
|
||||
{
|
||||
NE_LightSet(0, RGB15(8, 8, 8), 0, -0.97, -0.0);
|
||||
|
||||
SceneData *Scene = arg;
|
||||
|
||||
// Set camera
|
||||
NE_CameraUse(Scene->Camera);
|
||||
|
||||
// Set polygon format for regular models
|
||||
NE_PolyFormat(31, 0, NE_LIGHT_0, NE_CULL_BACK, NE_MODULATION);
|
||||
|
||||
// Draw regular models
|
||||
NE_ModelDraw(Scene->Teapot);
|
||||
|
||||
NE_MaterialUse(Scene->Material);
|
||||
DrawFloor();
|
||||
DrawLid();
|
||||
|
||||
// Draw shadow volume as a yellow volume (light)
|
||||
NE_MaterialUse(NULL);
|
||||
NE_PolyColor(RGB15(15, 15, 0));
|
||||
|
||||
if (Scene->draw_edges)
|
||||
{
|
||||
// Draw the shadow volume in wireframe mode to see where it is
|
||||
NE_PolyFormat(0, 0, 0, NE_CULL_NONE, NE_MODULATION);
|
||||
DrawShadowVolume();
|
||||
}
|
||||
|
||||
NE_PolyFormat(1, 0, 0, NE_CULL_NONE, NE_SHADOW_POLYGONS);
|
||||
DrawShadowVolume();
|
||||
|
||||
NE_PolyFormat(20, 63, 0, NE_CULL_NONE, NE_SHADOW_POLYGONS);
|
||||
DrawShadowVolume();
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
SceneData Scene = { 0 };
|
||||
|
||||
// This is needed for special screen effects
|
||||
irqEnable(IRQ_HBLANK);
|
||||
irqSet(IRQ_VBLANK, NE_VBLFunc);
|
||||
irqSet(IRQ_VBLANK, NE_HBLFunc);
|
||||
|
||||
// Init console and Nitro Engine
|
||||
NE_InitDual3D();
|
||||
NE_InitConsole();
|
||||
|
||||
// Setup camera
|
||||
Scene.Camera = NE_CameraCreate();
|
||||
NE_CameraSet(Scene.Camera,
|
||||
0, 3.25, -3.25,
|
||||
0, 1.25, 0,
|
||||
0, 1, 0);
|
||||
|
||||
// Load teapot and texture
|
||||
{
|
||||
Scene.Teapot = NE_ModelCreate(NE_Static);
|
||||
Scene.Material = NE_MaterialCreate();
|
||||
|
||||
// Load mesh from RAM and assign it to a model
|
||||
NE_ModelLoadStaticMesh(Scene.Teapot, teapot_bin);
|
||||
|
||||
// Load teapot texture from RAM and assign it to a material
|
||||
NE_MaterialTexLoad(Scene.Material, NE_A1RGB5, 256, 256,
|
||||
NE_TEXGEN_TEXCOORD | NE_TEXTURE_WRAP_S | NE_TEXTURE_WRAP_T,
|
||||
teapotBitmap);
|
||||
|
||||
// Assign material to the model
|
||||
NE_ModelSetMaterial(Scene.Teapot, Scene.Material);
|
||||
|
||||
// Set some properties to the material
|
||||
NE_MaterialSetProperties(Scene.Material,
|
||||
RGB15(24, 24, 24), // Diffuse
|
||||
RGB15(8, 8, 8), // Ambient
|
||||
RGB15(0, 0, 0), // Specular
|
||||
RGB15(0, 0, 0), // Emission
|
||||
false, false); // Vertex color, use shininess table
|
||||
|
||||
// Set initial position of the object
|
||||
NE_ModelSetCoordI(Scene.Teapot,
|
||||
floattof32(0), floattof32(1.5), floattof32(0));
|
||||
}
|
||||
|
||||
printf("\x1b[0;0H"
|
||||
"ABXY: Rotate\n"
|
||||
"Pad: Move\n"
|
||||
"SELECT: Show edges of shadow\n"
|
||||
"START: Exit to loader\n");
|
||||
|
||||
while (1)
|
||||
{
|
||||
NE_WaitForVBL(0);
|
||||
|
||||
// Refresh keys
|
||||
scanKeys();
|
||||
uint32_t keys = keysHeld();
|
||||
|
||||
// Move model using the pad
|
||||
if (keys & KEY_UP)
|
||||
NE_ModelTranslate(Scene.Teapot, 0, 0, 0.05);
|
||||
if (keys & KEY_DOWN)
|
||||
NE_ModelTranslate(Scene.Teapot, 0, 0, -0.05);
|
||||
if (keys & KEY_RIGHT)
|
||||
NE_ModelTranslate(Scene.Teapot, -0.05, 0, 0);
|
||||
if (keys & KEY_LEFT)
|
||||
NE_ModelTranslate(Scene.Teapot, 0.05, 0, 0);
|
||||
|
||||
// Rotate model using the pad
|
||||
if (keys & KEY_Y)
|
||||
NE_ModelRotate(Scene.Teapot, 0, 0, 2);
|
||||
if (keys & KEY_B)
|
||||
NE_ModelRotate(Scene.Teapot, 0, 0, -2);
|
||||
if (keys & KEY_X)
|
||||
NE_ModelRotate(Scene.Teapot, 0, 2, 0);
|
||||
if (keys & KEY_A)
|
||||
NE_ModelRotate(Scene.Teapot, 0, -2, 0);
|
||||
|
||||
if (keys & KEY_SELECT)
|
||||
Scene.draw_edges = true;
|
||||
else
|
||||
Scene.draw_edges = false;
|
||||
|
||||
if (keys & KEY_START)
|
||||
break;
|
||||
|
||||
// Draw Scene
|
||||
NE_ProcessDualArg(Draw3DSceneBright, Draw3DSceneDark, &Scene, &Scene);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
@ -1,5 +1,25 @@
|
||||
SUBDIRS:= `ls`
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
#
|
||||
# SPDX-FileContributor: Antonio Niño Díaz, 2023-2024
|
||||
|
||||
.PHONY: all clean
|
||||
|
||||
MAKE := make
|
||||
|
||||
all:
|
||||
@for i in $(SUBDIRS); do if test -e $$i/Makefile ; then $(MAKE) -C $$i || { exit 1;} fi; done;
|
||||
@for i in `ls`; do \
|
||||
if test -e $$i/Makefile ; then \
|
||||
cd $$i; \
|
||||
$(MAKE) --no-print-directory || exit 1 ; \
|
||||
cd ..; \
|
||||
fi; \
|
||||
done;
|
||||
|
||||
clean:
|
||||
@for i in $(SUBDIRS); do if test -e $$i/Makefile ; then $(MAKE) -C $$i clean || { exit 1;} fi; done;
|
||||
@for i in `ls`; do \
|
||||
if test -e $$i/Makefile ; then \
|
||||
cd $$i; \
|
||||
$(MAKE) clean --no-print-directory || exit 1 ; \
|
||||
cd ..; \
|
||||
fi; \
|
||||
done;
|
||||
|
@ -1,25 +0,0 @@
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
#
|
||||
# SPDX-FileContributor: Antonio Niño Díaz, 2023
|
||||
|
||||
.PHONY: all clean
|
||||
|
||||
MAKE := make
|
||||
|
||||
all:
|
||||
@for i in `ls`; do \
|
||||
if test -e $$i/Makefile.blocksds ; then \
|
||||
cd $$i; \
|
||||
$(MAKE) -f Makefile.blocksds --no-print-directory || { exit 1;}; \
|
||||
cd ..; \
|
||||
fi; \
|
||||
done;
|
||||
|
||||
clean:
|
||||
@for i in `ls`; do \
|
||||
if test -e $$i/Makefile.blocksds ; then \
|
||||
cd $$i; \
|
||||
$(MAKE) -f Makefile.blocksds clean --no-print-directory || { exit 1;}; \
|
||||
cd ..; \
|
||||
fi; \
|
||||
done;
|
@ -1,220 +1,7 @@
|
||||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#---------------------------------------------------------------------------------
|
||||
# This is a minimal makefile only used for the examples. If you want a makefile
|
||||
# for your project, take one from the templates inside examples/templates.
|
||||
|
||||
ifeq ($(strip $(DEVKITARM)),)
|
||||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
||||
endif
|
||||
BINDIRS := data
|
||||
GFXDIRS := graphics
|
||||
|
||||
include $(DEVKITARM)/ds_rules
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# TARGET is the name of the output
|
||||
# BUILD is the directory where object files & intermediate files will be placed
|
||||
# SOURCES is a list of directories containing source code
|
||||
# INCLUDES is a list of directories containing extra header files
|
||||
# DATA is a list of directories containing binary files embedded using bin2o
|
||||
# GRAPHICS is a list of directories containing image files to be converted with grit
|
||||
# AUDIO is a list of directories containing audio to be converted by maxmod
|
||||
# ICON is the image used to create the game icon, leave blank to use default rule
|
||||
# NITRO is a directory that will be accessible via NitroFS
|
||||
#---------------------------------------------------------------------------------
|
||||
TARGET := $(shell basename $(CURDIR))
|
||||
BUILD := build
|
||||
SOURCES := source
|
||||
INCLUDES := include
|
||||
DATA := data
|
||||
GRAPHICS := graphics
|
||||
AUDIO :=
|
||||
ICON :=
|
||||
|
||||
# specify a directory which contains the nitro filesystem
|
||||
# this is relative to the Makefile
|
||||
NITRO :=
|
||||
|
||||
# These set the information text in the nds file
|
||||
GAME_TITLE := $(shell basename $(CURDIR))
|
||||
GAME_SUBTITLE1 := Nitro Engine example
|
||||
GAME_SUBTITLE2 := github.com/AntonioND/nitro-engine
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# options for code generation
|
||||
#---------------------------------------------------------------------------------
|
||||
ARCH := -marm -mthumb-interwork -march=armv5te -mtune=arm946e-s
|
||||
|
||||
CFLAGS := -g -Wall -O3\
|
||||
$(ARCH) $(INCLUDE) -DARM9
|
||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
|
||||
ASFLAGS := -g $(ARCH)
|
||||
LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# any extra libraries we wish to link with the project (order is important)
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBS := -lNE -lfat -lnds9
|
||||
|
||||
# automatigically add libraries for NitroFS
|
||||
ifneq ($(strip $(NITRO)),)
|
||||
LIBS := -lfilesystem -lfat $(LIBS)
|
||||
endif
|
||||
# automagically add maxmod library
|
||||
ifneq ($(strip $(AUDIO)),)
|
||||
LIBS := -lmm9 $(LIBS)
|
||||
endif
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# list of directories containing libraries, this must be the top level containing
|
||||
# include and lib
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nitro-engine
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# no real need to edit anything past this point unless you need to add additional
|
||||
# rules for different file extensions
|
||||
#---------------------------------------------------------------------------------
|
||||
ifneq ($(BUILD),$(notdir $(CURDIR)))
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
export OUTPUT := $(CURDIR)/$(TARGET)
|
||||
|
||||
export VPATH := $(CURDIR)/$(subst /,,$(dir $(ICON)))\
|
||||
$(foreach dir,$(SOURCES),$(CURDIR)/$(dir))\
|
||||
$(foreach dir,$(DATA),$(CURDIR)/$(dir))\
|
||||
$(foreach dir,$(GRAPHICS),$(CURDIR)/$(dir))
|
||||
|
||||
export DEPSDIR := $(CURDIR)/$(BUILD)
|
||||
|
||||
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
|
||||
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
|
||||
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
|
||||
PNGFILES := $(foreach dir,$(GRAPHICS),$(notdir $(wildcard $(dir)/*.png)))
|
||||
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
|
||||
|
||||
# prepare NitroFS directory
|
||||
ifneq ($(strip $(NITRO)),)
|
||||
export NITRO_FILES := $(CURDIR)/$(NITRO)
|
||||
endif
|
||||
|
||||
# get audio list for maxmod
|
||||
ifneq ($(strip $(AUDIO)),)
|
||||
export MODFILES := $(foreach dir,$(notdir $(wildcard $(AUDIO)/*.*)),$(CURDIR)/$(AUDIO)/$(dir))
|
||||
|
||||
# place the soundbank file in NitroFS if using it
|
||||
ifneq ($(strip $(NITRO)),)
|
||||
export SOUNDBANK := $(NITRO_FILES)/soundbank.bin
|
||||
|
||||
# otherwise, needs to be loaded from memory
|
||||
else
|
||||
export SOUNDBANK := soundbank.bin
|
||||
BINFILES += $(SOUNDBANK)
|
||||
endif
|
||||
endif
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# use CXX for linking C++ projects, CC for standard C
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(CPPFILES)),)
|
||||
#---------------------------------------------------------------------------------
|
||||
export LD := $(CC)
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
#---------------------------------------------------------------------------------
|
||||
export LD := $(CXX)
|
||||
#---------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
|
||||
|
||||
export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
|
||||
|
||||
export OFILES := $(PNGFILES:.png=.o) $(OFILES_BIN) $(OFILES_SOURCES)
|
||||
|
||||
export HFILES := $(PNGFILES:.png=.h) $(addsuffix .h,$(subst .,_,$(BINFILES)))
|
||||
|
||||
export INCLUDE := $(foreach dir,$(INCLUDES),-iquote $(CURDIR)/$(dir))\
|
||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include)\
|
||||
-I$(CURDIR)/$(BUILD)
|
||||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
|
||||
|
||||
ifeq ($(strip $(ICON)),)
|
||||
icons := $(wildcard *.bmp)
|
||||
|
||||
ifneq (,$(findstring $(TARGET).bmp,$(icons)))
|
||||
export GAME_ICON := $(CURDIR)/$(TARGET).bmp
|
||||
else
|
||||
ifneq (,$(findstring icon.bmp,$(icons)))
|
||||
export GAME_ICON := $(CURDIR)/icon.bmp
|
||||
endif
|
||||
endif
|
||||
else
|
||||
ifeq ($(suffix $(ICON)), .grf)
|
||||
export GAME_ICON := $(CURDIR)/$(ICON)
|
||||
else
|
||||
export GAME_ICON := $(CURDIR)/$(BUILD)/$(notdir $(basename $(ICON))).grf
|
||||
endif
|
||||
endif
|
||||
|
||||
.PHONY: $(BUILD) clean
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
$(BUILD):
|
||||
@mkdir -p $@
|
||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
clean:
|
||||
@echo clean ...
|
||||
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(SOUNDBANK)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# main targets
|
||||
#---------------------------------------------------------------------------------
|
||||
$(OUTPUT).nds: $(OUTPUT).elf $(GAME_ICON)
|
||||
$(OUTPUT).elf: $(OFILES)
|
||||
|
||||
# source files depend on generated headers
|
||||
$(OFILES_SOURCES) : $(HFILES)
|
||||
|
||||
# need to build soundbank first
|
||||
$(OFILES): $(SOUNDBANK)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# rule to build solution from music files
|
||||
#---------------------------------------------------------------------------------
|
||||
$(SOUNDBANK) : $(MODFILES)
|
||||
#---------------------------------------------------------------------------------
|
||||
mmutil $^ -d -o$@ -hsoundbank.h
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.bin.o %_bin.h : %.bin
|
||||
#---------------------------------------------------------------------------------
|
||||
@echo $(notdir $<)
|
||||
@$(bin2o)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# This rule creates assembly source files using grit
|
||||
# grit takes an image file and a .grit describing how the file is to be processed
|
||||
# add additional rules like this for each image extension
|
||||
# you use in the graphics folders
|
||||
#---------------------------------------------------------------------------------
|
||||
%.s %.h: %.png %.grit
|
||||
#---------------------------------------------------------------------------------
|
||||
grit $< -fts -o$*
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# Convert non-GRF game icon to GRF if needed
|
||||
#---------------------------------------------------------------------------------
|
||||
$(GAME_ICON): $(notdir $(ICON))
|
||||
#---------------------------------------------------------------------------------
|
||||
@echo convert $(notdir $<)
|
||||
@grit $< -g -gt -gB4 -gT FF00FF -m! -p -pe 16 -fh! -ftr
|
||||
|
||||
-include $(DEPSDIR)/*.d
|
||||
|
||||
#---------------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------------
|
||||
include ../../Makefile.example
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
NITRO_ENGINE=$DEVKITPRO/nitro-engine
|
||||
NITRO_ENGINE=../../..
|
||||
ASSETS=$NITRO_ENGINE/examples/assets
|
||||
TOOLS=$NITRO_ENGINE/tools
|
||||
MD5_TO_DSMA=$TOOLS/md5_to_dsma/md5_to_dsma.py
|
||||
|
@ -1,6 +1,6 @@
|
||||
// SPDX-License-Identifier: CC0-1.0
|
||||
//
|
||||
// SPDX-FileContributor: Antonio Niño Díaz, 2008-2011, 2019, 2022
|
||||
// SPDX-FileContributor: Antonio Niño Díaz, 2008-2024
|
||||
//
|
||||
// This file is part of Nitro Engine
|
||||
|
||||
@ -10,22 +10,26 @@
|
||||
#include "robot_wave_dsa_bin.h"
|
||||
#include "texture.h"
|
||||
|
||||
NE_Camera *Camera;
|
||||
NE_Model *Model;
|
||||
NE_Animation *Animation;
|
||||
NE_Material *Texture;
|
||||
typedef struct {
|
||||
NE_Camera *Camera;
|
||||
NE_Model *Model;
|
||||
} SceneData;
|
||||
|
||||
void Draw3DScene(void)
|
||||
void Draw3DScene(void *arg)
|
||||
{
|
||||
SceneData *Scene = arg;
|
||||
|
||||
NE_PolyFormat(31, 0, NE_LIGHT_0, NE_CULL_BACK, 0);
|
||||
|
||||
NE_CameraUse(Camera);
|
||||
NE_CameraUse(Scene->Camera);
|
||||
|
||||
NE_ModelDraw(Model);
|
||||
NE_ModelDraw(Scene->Model);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
SceneData Scene = { 0 };
|
||||
|
||||
irqEnable(IRQ_HBLANK);
|
||||
irqSet(IRQ_VBLANK, NE_VBLFunc);
|
||||
irqSet(IRQ_HBLANK, NE_HBLFunc);
|
||||
@ -33,25 +37,25 @@ int main(void)
|
||||
NE_Init3D();
|
||||
NE_InitConsole();
|
||||
|
||||
Camera = NE_CameraCreate();
|
||||
Model = NE_ModelCreate(NE_Animated);
|
||||
Animation = NE_AnimationCreate();
|
||||
Scene.Camera = NE_CameraCreate();
|
||||
Scene.Model = NE_ModelCreate(NE_Animated);
|
||||
NE_Animation *Animation = NE_AnimationCreate();
|
||||
|
||||
NE_AnimationLoad(Animation, robot_wave_dsa_bin);
|
||||
NE_ModelLoadDSM(Model, robot_dsm_bin);
|
||||
NE_ModelSetAnimation(Model, Animation);
|
||||
NE_ModelAnimStart(Model, NE_ANIM_LOOP, floattof32(0.1));
|
||||
NE_ModelLoadDSM(Scene.Model, robot_dsm_bin);
|
||||
NE_ModelSetAnimation(Scene.Model, Animation);
|
||||
NE_ModelAnimStart(Scene.Model, NE_ANIM_LOOP, floattof32(0.1));
|
||||
|
||||
NE_CameraSet(Camera,
|
||||
NE_CameraSet(Scene.Camera,
|
||||
6, 3, -4,
|
||||
0, 3, 0,
|
||||
0, 1, 0);
|
||||
|
||||
Texture = NE_MaterialCreate();
|
||||
NE_Material *Texture = NE_MaterialCreate();
|
||||
NE_MaterialTexLoad(Texture, NE_A1RGB5, 256, 256, NE_TEXGEN_TEXCOORD,
|
||||
textureBitmap);
|
||||
|
||||
NE_ModelSetMaterial(Model, Texture);
|
||||
NE_ModelSetMaterial(Scene.Model, Texture);
|
||||
|
||||
NE_LightSet(0, NE_White, -0.9, 0, 0);
|
||||
NE_ClearColorSet(NE_Black, 31, 63);
|
||||
@ -64,19 +68,20 @@ int main(void)
|
||||
uint32_t keys = keysHeld();
|
||||
|
||||
if (keys & KEY_RIGHT)
|
||||
NE_ModelRotate(Model,0,2,0);
|
||||
NE_ModelRotate(Scene.Model, 0, 2, 0);
|
||||
if (keys & KEY_LEFT)
|
||||
NE_ModelRotate(Model,0,-2,0);
|
||||
NE_ModelRotate(Scene.Model, 0, -2, 0);
|
||||
if (keys & KEY_UP)
|
||||
NE_ModelRotate(Model,0,0,2);
|
||||
NE_ModelRotate(Scene.Model, 0, 0, 2);
|
||||
if (keys & KEY_DOWN)
|
||||
NE_ModelRotate(Model,0,0,-2);
|
||||
NE_ModelRotate(Scene.Model, 0, 0, -2);
|
||||
|
||||
printf("\x1b[0;0H"
|
||||
"CPU%%: %d \nFrame: %.3f ",
|
||||
NE_GetCPUPercent(), f32tofloat(NE_ModelAnimGetFrame(Model)));
|
||||
NE_GetCPUPercent(),
|
||||
f32tofloat(NE_ModelAnimGetFrame(Scene.Model)));
|
||||
|
||||
NE_Process(Draw3DScene);
|
||||
NE_ProcessArg(Draw3DScene, &Scene);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -3,4 +3,4 @@
|
||||
|
||||
BINDIRS := data
|
||||
|
||||
include ../../Makefile.example.blocksds
|
||||
include ../../Makefile.example
|
13
examples/loading/assign_transform_matrix/assets.sh
Normal file
13
examples/loading/assign_transform_matrix/assets.sh
Normal file
@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
|
||||
NITRO_ENGINE=../../..
|
||||
ASSETS=$NITRO_ENGINE/examples/assets
|
||||
TOOLS=$NITRO_ENGINE/tools
|
||||
OBJ2DL=$TOOLS/obj2dl/obj2dl.py
|
||||
|
||||
mkdir -p data
|
||||
|
||||
python3 $OBJ2DL \
|
||||
--input $ASSETS/sphere.obj \
|
||||
--output data/sphere.bin \
|
||||
--texture 32 32
|
BIN
examples/loading/assign_transform_matrix/data/sphere.bin
Normal file
BIN
examples/loading/assign_transform_matrix/data/sphere.bin
Normal file
Binary file not shown.
105
examples/loading/assign_transform_matrix/source/main.c
Normal file
105
examples/loading/assign_transform_matrix/source/main.c
Normal file
@ -0,0 +1,105 @@
|
||||
// SPDX-License-Identifier: CC0-1.0
|
||||
//
|
||||
// SPDX-FileContributor: Antonio Niño Díaz, 2008-2024
|
||||
//
|
||||
// This file is part of Nitro Engine
|
||||
|
||||
// TODO
|
||||
|
||||
#include <NEMain.h>
|
||||
|
||||
#include "sphere_bin.h"
|
||||
|
||||
typedef struct {
|
||||
NE_Camera *Camera;
|
||||
NE_Model *ModelWithoutMatrix;
|
||||
NE_Model *ModelWithMatrix;
|
||||
} SceneData;
|
||||
|
||||
void Draw3DScene(void *arg)
|
||||
{
|
||||
SceneData *Scene = arg;
|
||||
|
||||
NE_CameraUse(Scene->Camera);
|
||||
|
||||
NE_ModelDraw(Scene->ModelWithoutMatrix);
|
||||
NE_ModelDraw(Scene->ModelWithMatrix);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
SceneData Scene = { 0 };
|
||||
|
||||
irqEnable(IRQ_HBLANK);
|
||||
irqSet(IRQ_VBLANK, NE_VBLFunc);
|
||||
irqSet(IRQ_HBLANK, NE_HBLFunc);
|
||||
|
||||
// Init Nitro Engine.
|
||||
NE_Init3D();
|
||||
// libnds uses VRAM_C for the text console, reserve A and B only
|
||||
NE_TextureSystemReset(0, 0, NE_VRAM_AB);
|
||||
// Init console in non-3D screen
|
||||
consoleDemoInit();
|
||||
|
||||
// Allocate space for everything.
|
||||
Scene.ModelWithoutMatrix = NE_ModelCreate(NE_Static);
|
||||
Scene.ModelWithMatrix = NE_ModelCreate(NE_Static);
|
||||
|
||||
Scene.Camera = NE_CameraCreate();
|
||||
|
||||
// Setup camera
|
||||
NE_CameraSet(Scene.Camera,
|
||||
0, 0, 3,
|
||||
0, 0, 0,
|
||||
0, 1, 0);
|
||||
|
||||
// Load models
|
||||
NE_ModelLoadStaticMesh(Scene.ModelWithoutMatrix, sphere_bin);
|
||||
NE_ModelLoadStaticMesh(Scene.ModelWithMatrix, sphere_bin);
|
||||
|
||||
// Set up light
|
||||
NE_LightSet(0, NE_Yellow, 0, -0.5, -0.5);
|
||||
|
||||
// Set start coordinates/rotation of the models
|
||||
NE_ModelSetCoord(Scene.ModelWithoutMatrix, -1, 0, 0);
|
||||
|
||||
// Transformation matrix we are going to use for a model. Note that this
|
||||
// matrix is transposed compared to what most 3D documentation describes.
|
||||
m4x3 matrix = {{
|
||||
// 3x3 transformation
|
||||
inttof32(1), 0, 0,
|
||||
0, inttof32(1), 0,
|
||||
0, 0, inttof32(1),
|
||||
// Translation vector
|
||||
inttof32(2), 0, 0
|
||||
}};
|
||||
|
||||
int translation = inttof32(2);
|
||||
|
||||
printf("The right ball uses a matrix\n"
|
||||
"assigned by the user, the left\n"
|
||||
"one has rotation managed by\n"
|
||||
"Nitro Engine.");
|
||||
|
||||
while (1)
|
||||
{
|
||||
NE_WaitForVBL(0);
|
||||
|
||||
// Rotate the first model
|
||||
NE_ModelRotate(Scene.ModelWithoutMatrix, -1, 2, 1);
|
||||
|
||||
// Update matrix manually
|
||||
translation += floattof32(0.05);
|
||||
if (translation > inttof32(3))
|
||||
translation = inttof32(1);
|
||||
matrix.m[9] = translation;
|
||||
|
||||
// Assign matrix again
|
||||
NE_ModelSetMatrix(Scene.ModelWithMatrix, &matrix);
|
||||
|
||||
// Draw scene
|
||||
NE_ProcessArg(Draw3DScene, &Scene);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
@ -1,220 +1,6 @@
|
||||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#---------------------------------------------------------------------------------
|
||||
# This is a minimal makefile only used for the examples. If you want a makefile
|
||||
# for your project, take one from the templates inside examples/templates.
|
||||
|
||||
ifeq ($(strip $(DEVKITARM)),)
|
||||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
||||
endif
|
||||
BINDIRS := data
|
||||
|
||||
include $(DEVKITARM)/ds_rules
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# TARGET is the name of the output
|
||||
# BUILD is the directory where object files & intermediate files will be placed
|
||||
# SOURCES is a list of directories containing source code
|
||||
# INCLUDES is a list of directories containing extra header files
|
||||
# DATA is a list of directories containing binary files embedded using bin2o
|
||||
# GRAPHICS is a list of directories containing image files to be converted with grit
|
||||
# AUDIO is a list of directories containing audio to be converted by maxmod
|
||||
# ICON is the image used to create the game icon, leave blank to use default rule
|
||||
# NITRO is a directory that will be accessible via NitroFS
|
||||
#---------------------------------------------------------------------------------
|
||||
TARGET := $(shell basename $(CURDIR))
|
||||
BUILD := build
|
||||
SOURCES := source
|
||||
INCLUDES := include
|
||||
DATA := data
|
||||
GRAPHICS :=
|
||||
AUDIO :=
|
||||
ICON :=
|
||||
|
||||
# specify a directory which contains the nitro filesystem
|
||||
# this is relative to the Makefile
|
||||
NITRO :=
|
||||
|
||||
# These set the information text in the nds file
|
||||
GAME_TITLE := $(shell basename $(CURDIR))
|
||||
GAME_SUBTITLE1 := Nitro Engine example
|
||||
GAME_SUBTITLE2 := github.com/AntonioND/nitro-engine
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# options for code generation
|
||||
#---------------------------------------------------------------------------------
|
||||
ARCH := -marm -mthumb-interwork -march=armv5te -mtune=arm946e-s
|
||||
|
||||
CFLAGS := -g -Wall -O3\
|
||||
$(ARCH) $(INCLUDE) -DARM9
|
||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
|
||||
ASFLAGS := -g $(ARCH)
|
||||
LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# any extra libraries we wish to link with the project (order is important)
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBS := -lNE -lfat -lnds9
|
||||
|
||||
# automatigically add libraries for NitroFS
|
||||
ifneq ($(strip $(NITRO)),)
|
||||
LIBS := -lfilesystem -lfat $(LIBS)
|
||||
endif
|
||||
# automagically add maxmod library
|
||||
ifneq ($(strip $(AUDIO)),)
|
||||
LIBS := -lmm9 $(LIBS)
|
||||
endif
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# list of directories containing libraries, this must be the top level containing
|
||||
# include and lib
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nitro-engine
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# no real need to edit anything past this point unless you need to add additional
|
||||
# rules for different file extensions
|
||||
#---------------------------------------------------------------------------------
|
||||
ifneq ($(BUILD),$(notdir $(CURDIR)))
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
export OUTPUT := $(CURDIR)/$(TARGET)
|
||||
|
||||
export VPATH := $(CURDIR)/$(subst /,,$(dir $(ICON)))\
|
||||
$(foreach dir,$(SOURCES),$(CURDIR)/$(dir))\
|
||||
$(foreach dir,$(DATA),$(CURDIR)/$(dir))\
|
||||
$(foreach dir,$(GRAPHICS),$(CURDIR)/$(dir))
|
||||
|
||||
export DEPSDIR := $(CURDIR)/$(BUILD)
|
||||
|
||||
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
|
||||
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
|
||||
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
|
||||
PNGFILES := $(foreach dir,$(GRAPHICS),$(notdir $(wildcard $(dir)/*.png)))
|
||||
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
|
||||
|
||||
# prepare NitroFS directory
|
||||
ifneq ($(strip $(NITRO)),)
|
||||
export NITRO_FILES := $(CURDIR)/$(NITRO)
|
||||
endif
|
||||
|
||||
# get audio list for maxmod
|
||||
ifneq ($(strip $(AUDIO)),)
|
||||
export MODFILES := $(foreach dir,$(notdir $(wildcard $(AUDIO)/*.*)),$(CURDIR)/$(AUDIO)/$(dir))
|
||||
|
||||
# place the soundbank file in NitroFS if using it
|
||||
ifneq ($(strip $(NITRO)),)
|
||||
export SOUNDBANK := $(NITRO_FILES)/soundbank.bin
|
||||
|
||||
# otherwise, needs to be loaded from memory
|
||||
else
|
||||
export SOUNDBANK := soundbank.bin
|
||||
BINFILES += $(SOUNDBANK)
|
||||
endif
|
||||
endif
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# use CXX for linking C++ projects, CC for standard C
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(CPPFILES)),)
|
||||
#---------------------------------------------------------------------------------
|
||||
export LD := $(CC)
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
#---------------------------------------------------------------------------------
|
||||
export LD := $(CXX)
|
||||
#---------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
|
||||
|
||||
export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
|
||||
|
||||
export OFILES := $(PNGFILES:.png=.o) $(OFILES_BIN) $(OFILES_SOURCES)
|
||||
|
||||
export HFILES := $(PNGFILES:.png=.h) $(addsuffix .h,$(subst .,_,$(BINFILES)))
|
||||
|
||||
export INCLUDE := $(foreach dir,$(INCLUDES),-iquote $(CURDIR)/$(dir))\
|
||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include)\
|
||||
-I$(CURDIR)/$(BUILD)
|
||||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
|
||||
|
||||
ifeq ($(strip $(ICON)),)
|
||||
icons := $(wildcard *.bmp)
|
||||
|
||||
ifneq (,$(findstring $(TARGET).bmp,$(icons)))
|
||||
export GAME_ICON := $(CURDIR)/$(TARGET).bmp
|
||||
else
|
||||
ifneq (,$(findstring icon.bmp,$(icons)))
|
||||
export GAME_ICON := $(CURDIR)/icon.bmp
|
||||
endif
|
||||
endif
|
||||
else
|
||||
ifeq ($(suffix $(ICON)), .grf)
|
||||
export GAME_ICON := $(CURDIR)/$(ICON)
|
||||
else
|
||||
export GAME_ICON := $(CURDIR)/$(BUILD)/$(notdir $(basename $(ICON))).grf
|
||||
endif
|
||||
endif
|
||||
|
||||
.PHONY: $(BUILD) clean
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
$(BUILD):
|
||||
@mkdir -p $@
|
||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
clean:
|
||||
@echo clean ...
|
||||
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(SOUNDBANK)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# main targets
|
||||
#---------------------------------------------------------------------------------
|
||||
$(OUTPUT).nds: $(OUTPUT).elf $(GAME_ICON)
|
||||
$(OUTPUT).elf: $(OFILES)
|
||||
|
||||
# source files depend on generated headers
|
||||
$(OFILES_SOURCES) : $(HFILES)
|
||||
|
||||
# need to build soundbank first
|
||||
$(OFILES): $(SOUNDBANK)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# rule to build solution from music files
|
||||
#---------------------------------------------------------------------------------
|
||||
$(SOUNDBANK) : $(MODFILES)
|
||||
#---------------------------------------------------------------------------------
|
||||
mmutil $^ -d -o$@ -hsoundbank.h
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.bin.o %_bin.h : %.bin
|
||||
#---------------------------------------------------------------------------------
|
||||
@echo $(notdir $<)
|
||||
@$(bin2o)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# This rule creates assembly source files using grit
|
||||
# grit takes an image file and a .grit describing how the file is to be processed
|
||||
# add additional rules like this for each image extension
|
||||
# you use in the graphics folders
|
||||
#---------------------------------------------------------------------------------
|
||||
%.s %.h: %.png %.grit
|
||||
#---------------------------------------------------------------------------------
|
||||
grit $< -fts -o$*
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# Convert non-GRF game icon to GRF if needed
|
||||
#---------------------------------------------------------------------------------
|
||||
$(GAME_ICON): $(notdir $(ICON))
|
||||
#---------------------------------------------------------------------------------
|
||||
@echo convert $(notdir $<)
|
||||
@grit $< -g -gt -gB4 -gT FF00FF -m! -p -pe 16 -fh! -ftr
|
||||
|
||||
-include $(DEPSDIR)/*.d
|
||||
|
||||
#---------------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------------
|
||||
include ../../Makefile.example
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
NITRO_ENGINE=$DEVKITPRO/nitro-engine
|
||||
NITRO_ENGINE=../../..
|
||||
ASSETS=$NITRO_ENGINE/examples/assets
|
||||
TOOLS=$NITRO_ENGINE/tools
|
||||
OBJ2DL=$TOOLS/obj2dl/obj2dl.py
|
||||
|
Binary file not shown.
@ -1,18 +1,9 @@
|
||||
// SPDX-License-Identifier: CC0-1.0
|
||||
//
|
||||
// SPDX-FileContributor: Antonio Niño Díaz, 2008-2011, 2019, 2022
|
||||
// SPDX-FileContributor: Antonio Niño Díaz, 2008-2024
|
||||
//
|
||||
// This file is part of Nitro Engine
|
||||
|
||||
#include <NEMain.h>
|
||||
|
||||
#include "sphere_bin.h"
|
||||
|
||||
#define NUM_MODELS 16
|
||||
|
||||
NE_Camera *Camera;
|
||||
NE_Model *Model[NUM_MODELS];
|
||||
|
||||
// Cloning models will avoid loading into memory the same mesh many times. This
|
||||
// is really useful when you want to draw lots of the same model in different
|
||||
// locations, with different animations, etc. You won't need to store multiple
|
||||
@ -21,13 +12,26 @@ NE_Model *Model[NUM_MODELS];
|
||||
// If you clone an animated model you will be able to set different animations
|
||||
// for each model.
|
||||
|
||||
void Draw3DScene(void)
|
||||
#include <NEMain.h>
|
||||
|
||||
#include "sphere_bin.h"
|
||||
|
||||
#define NUM_MODELS 16
|
||||
|
||||
typedef struct {
|
||||
NE_Camera *Camera;
|
||||
NE_Model *Model[NUM_MODELS];
|
||||
} SceneData;
|
||||
|
||||
void Draw3DScene(void *arg)
|
||||
{
|
||||
SceneData *Scene = arg;
|
||||
|
||||
// Setup camera and draw all objects.
|
||||
NE_CameraUse(Camera);
|
||||
NE_CameraUse(Scene->Camera);
|
||||
|
||||
for (int i = 0; i < NUM_MODELS; i++)
|
||||
NE_ModelDraw(Model[i]);
|
||||
NE_ModelDraw(Scene->Model[i]);
|
||||
|
||||
// Get some information AFTER drawing but BEFORE returning from the
|
||||
// function.
|
||||
@ -35,8 +39,10 @@ void Draw3DScene(void)
|
||||
NE_GetPolygonCount(), NE_GetVertexCount());
|
||||
}
|
||||
|
||||
int main(void)
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
SceneData Scene = { 0 };
|
||||
|
||||
irqEnable(IRQ_HBLANK);
|
||||
irqSet(IRQ_VBLANK, NE_VBLFunc);
|
||||
irqSet(IRQ_HBLANK, NE_HBLFunc);
|
||||
@ -50,37 +56,34 @@ int main(void)
|
||||
|
||||
// Allocate space for everything.
|
||||
for (int i = 0; i < NUM_MODELS; i++)
|
||||
Model[i] = NE_ModelCreate(NE_Static);
|
||||
Scene.Model[i] = NE_ModelCreate(NE_Static);
|
||||
|
||||
Camera = NE_CameraCreate();
|
||||
Scene.Camera = NE_CameraCreate();
|
||||
|
||||
// Setup camera
|
||||
NE_CameraSet(Camera,
|
||||
NE_CameraSet(Scene.Camera,
|
||||
-3.5, 1.5, 1.25,
|
||||
0, 1.5, 1.25,
|
||||
0, 1, 0);
|
||||
|
||||
// Load model once
|
||||
NE_ModelLoadStaticMesh(Model[0], sphere_bin);
|
||||
NE_ModelLoadStaticMesh(Scene.Model[0], sphere_bin);
|
||||
|
||||
// Clone model to the test of the objects
|
||||
for (int i = 1; i < NUM_MODELS; i++)
|
||||
{
|
||||
NE_ModelClone(Model[i], // Destination
|
||||
Model[0]); // Source model
|
||||
NE_ModelClone(Scene.Model[i], // Destination
|
||||
Scene.Model[0]); // Source model
|
||||
}
|
||||
|
||||
// Set up light
|
||||
NE_LightSet(0, NE_Yellow, 0, -0.5, -0.5);
|
||||
|
||||
// Enable shading
|
||||
NE_ShadingEnable(true);
|
||||
|
||||
// Set start coordinates/rotation of the models
|
||||
for (int i = 0; i < NUM_MODELS; i++)
|
||||
{
|
||||
NE_ModelSetRot(Model[i], i, i * 30, i * 20);
|
||||
NE_ModelSetCoord(Model[i], 0, i % 4, i / 4);
|
||||
NE_ModelSetRot(Scene.Model[i], i, i * 30, i * 20);
|
||||
NE_ModelSetCoord(Scene.Model[i], 0, i % 4, i / 4);
|
||||
}
|
||||
|
||||
while (1)
|
||||
@ -89,10 +92,10 @@ int main(void)
|
||||
|
||||
// Rotate every model
|
||||
for (int i = 0; i < NUM_MODELS; i++)
|
||||
NE_ModelRotate(Model[i], -i, i % 5, 5 - i);
|
||||
NE_ModelRotate(Scene.Model[i], -i, i % 5, 5 - i);
|
||||
|
||||
// Draw scene
|
||||
NE_Process(Draw3DScene);
|
||||
NE_ProcessArg(Draw3DScene, &Scene);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -1,220 +1,6 @@
|
||||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#---------------------------------------------------------------------------------
|
||||
# This is a minimal makefile only used for the examples. If you want a makefile
|
||||
# for your project, take one from the templates inside examples/templates.
|
||||
|
||||
ifeq ($(strip $(DEVKITARM)),)
|
||||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
||||
endif
|
||||
BINDIRS := data
|
||||
|
||||
include $(DEVKITARM)/ds_rules
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# TARGET is the name of the output
|
||||
# BUILD is the directory where object files & intermediate files will be placed
|
||||
# SOURCES is a list of directories containing source code
|
||||
# INCLUDES is a list of directories containing extra header files
|
||||
# DATA is a list of directories containing binary files embedded using bin2o
|
||||
# GRAPHICS is a list of directories containing image files to be converted with grit
|
||||
# AUDIO is a list of directories containing audio to be converted by maxmod
|
||||
# ICON is the image used to create the game icon, leave blank to use default rule
|
||||
# NITRO is a directory that will be accessible via NitroFS
|
||||
#---------------------------------------------------------------------------------
|
||||
TARGET := $(shell basename $(CURDIR))
|
||||
BUILD := build
|
||||
SOURCES := source
|
||||
INCLUDES := include
|
||||
DATA := data
|
||||
GRAPHICS :=
|
||||
AUDIO :=
|
||||
ICON :=
|
||||
|
||||
# specify a directory which contains the nitro filesystem
|
||||
# this is relative to the Makefile
|
||||
NITRO :=
|
||||
|
||||
# These set the information text in the nds file
|
||||
GAME_TITLE := $(shell basename $(CURDIR))
|
||||
GAME_SUBTITLE1 := Nitro Engine example
|
||||
GAME_SUBTITLE2 := github.com/AntonioND/nitro-engine
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# options for code generation
|
||||
#---------------------------------------------------------------------------------
|
||||
ARCH := -marm -mthumb-interwork -march=armv5te -mtune=arm946e-s
|
||||
|
||||
CFLAGS := -g -Wall -O3\
|
||||
$(ARCH) $(INCLUDE) -DARM9
|
||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
|
||||
ASFLAGS := -g $(ARCH)
|
||||
LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# any extra libraries we wish to link with the project (order is important)
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBS := -lNE -lfat -lnds9
|
||||
|
||||
# automatigically add libraries for NitroFS
|
||||
ifneq ($(strip $(NITRO)),)
|
||||
LIBS := -lfilesystem -lfat $(LIBS)
|
||||
endif
|
||||
# automagically add maxmod library
|
||||
ifneq ($(strip $(AUDIO)),)
|
||||
LIBS := -lmm9 $(LIBS)
|
||||
endif
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# list of directories containing libraries, this must be the top level containing
|
||||
# include and lib
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nitro-engine
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# no real need to edit anything past this point unless you need to add additional
|
||||
# rules for different file extensions
|
||||
#---------------------------------------------------------------------------------
|
||||
ifneq ($(BUILD),$(notdir $(CURDIR)))
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
export OUTPUT := $(CURDIR)/$(TARGET)
|
||||
|
||||
export VPATH := $(CURDIR)/$(subst /,,$(dir $(ICON)))\
|
||||
$(foreach dir,$(SOURCES),$(CURDIR)/$(dir))\
|
||||
$(foreach dir,$(DATA),$(CURDIR)/$(dir))\
|
||||
$(foreach dir,$(GRAPHICS),$(CURDIR)/$(dir))
|
||||
|
||||
export DEPSDIR := $(CURDIR)/$(BUILD)
|
||||
|
||||
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
|
||||
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
|
||||
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
|
||||
PNGFILES := $(foreach dir,$(GRAPHICS),$(notdir $(wildcard $(dir)/*.png)))
|
||||
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
|
||||
|
||||
# prepare NitroFS directory
|
||||
ifneq ($(strip $(NITRO)),)
|
||||
export NITRO_FILES := $(CURDIR)/$(NITRO)
|
||||
endif
|
||||
|
||||
# get audio list for maxmod
|
||||
ifneq ($(strip $(AUDIO)),)
|
||||
export MODFILES := $(foreach dir,$(notdir $(wildcard $(AUDIO)/*.*)),$(CURDIR)/$(AUDIO)/$(dir))
|
||||
|
||||
# place the soundbank file in NitroFS if using it
|
||||
ifneq ($(strip $(NITRO)),)
|
||||
export SOUNDBANK := $(NITRO_FILES)/soundbank.bin
|
||||
|
||||
# otherwise, needs to be loaded from memory
|
||||
else
|
||||
export SOUNDBANK := soundbank.bin
|
||||
BINFILES += $(SOUNDBANK)
|
||||
endif
|
||||
endif
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# use CXX for linking C++ projects, CC for standard C
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(CPPFILES)),)
|
||||
#---------------------------------------------------------------------------------
|
||||
export LD := $(CC)
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
#---------------------------------------------------------------------------------
|
||||
export LD := $(CXX)
|
||||
#---------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
|
||||
|
||||
export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
|
||||
|
||||
export OFILES := $(PNGFILES:.png=.o) $(OFILES_BIN) $(OFILES_SOURCES)
|
||||
|
||||
export HFILES := $(PNGFILES:.png=.h) $(addsuffix .h,$(subst .,_,$(BINFILES)))
|
||||
|
||||
export INCLUDE := $(foreach dir,$(INCLUDES),-iquote $(CURDIR)/$(dir))\
|
||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include)\
|
||||
-I$(CURDIR)/$(BUILD)
|
||||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
|
||||
|
||||
ifeq ($(strip $(ICON)),)
|
||||
icons := $(wildcard *.bmp)
|
||||
|
||||
ifneq (,$(findstring $(TARGET).bmp,$(icons)))
|
||||
export GAME_ICON := $(CURDIR)/$(TARGET).bmp
|
||||
else
|
||||
ifneq (,$(findstring icon.bmp,$(icons)))
|
||||
export GAME_ICON := $(CURDIR)/icon.bmp
|
||||
endif
|
||||
endif
|
||||
else
|
||||
ifeq ($(suffix $(ICON)), .grf)
|
||||
export GAME_ICON := $(CURDIR)/$(ICON)
|
||||
else
|
||||
export GAME_ICON := $(CURDIR)/$(BUILD)/$(notdir $(basename $(ICON))).grf
|
||||
endif
|
||||
endif
|
||||
|
||||
.PHONY: $(BUILD) clean
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
$(BUILD):
|
||||
@mkdir -p $@
|
||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
clean:
|
||||
@echo clean ...
|
||||
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(SOUNDBANK)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# main targets
|
||||
#---------------------------------------------------------------------------------
|
||||
$(OUTPUT).nds: $(OUTPUT).elf $(GAME_ICON)
|
||||
$(OUTPUT).elf: $(OFILES)
|
||||
|
||||
# source files depend on generated headers
|
||||
$(OFILES_SOURCES) : $(HFILES)
|
||||
|
||||
# need to build soundbank first
|
||||
$(OFILES): $(SOUNDBANK)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# rule to build solution from music files
|
||||
#---------------------------------------------------------------------------------
|
||||
$(SOUNDBANK) : $(MODFILES)
|
||||
#---------------------------------------------------------------------------------
|
||||
mmutil $^ -d -o$@ -hsoundbank.h
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.bin.o %_bin.h : %.bin
|
||||
#---------------------------------------------------------------------------------
|
||||
@echo $(notdir $<)
|
||||
@$(bin2o)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# This rule creates assembly source files using grit
|
||||
# grit takes an image file and a .grit describing how the file is to be processed
|
||||
# add additional rules like this for each image extension
|
||||
# you use in the graphics folders
|
||||
#---------------------------------------------------------------------------------
|
||||
%.s %.h: %.png %.grit
|
||||
#---------------------------------------------------------------------------------
|
||||
grit $< -fts -o$*
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# Convert non-GRF game icon to GRF if needed
|
||||
#---------------------------------------------------------------------------------
|
||||
$(GAME_ICON): $(notdir $(ICON))
|
||||
#---------------------------------------------------------------------------------
|
||||
@echo convert $(notdir $<)
|
||||
@grit $< -g -gt -gB4 -gT FF00FF -m! -p -pe 16 -fh! -ftr
|
||||
|
||||
-include $(DEPSDIR)/*.d
|
||||
|
||||
#---------------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------------
|
||||
include ../../Makefile.example
|
||||
|
@ -1,6 +0,0 @@
|
||||
# This is a minimal makefile only used for the examples. If you want a makefile
|
||||
# for your project, take one from the templates inside examples/templates.
|
||||
|
||||
BINDIRS := data
|
||||
|
||||
include ../../Makefile.example.blocksds
|
@ -3,14 +3,16 @@
|
||||
rm -rf data
|
||||
mkdir -p data
|
||||
|
||||
BLOCKSDSEXT="${BLOCKSDSEXT:-/opt/blocksds/external/}"
|
||||
|
||||
# ptexconv can be obtained here: https://github.com/Garhoogin/ptexconv/
|
||||
|
||||
/opt/blocksds/external/ptexconv/ptexconv \
|
||||
$BLOCKSDSEXT/ptexconv/ptexconv \
|
||||
-gt -ob -k FF00FF -v -f tex4x4 \
|
||||
-o data/grill \
|
||||
assets/grill.png
|
||||
|
||||
/opt/blocksds/external/ptexconv/ptexconv \
|
||||
$BLOCKSDSEXT/ptexconv/ptexconv \
|
||||
-gt -ob -k FF00FF -v -f tex4x4 \
|
||||
-o data/landscape \
|
||||
assets/landscape.jpg
|
||||
|
@ -1,6 +1,6 @@
|
||||
// SPDX-License-Identifier: CC0-1.0
|
||||
//
|
||||
// SPDX-FileContributor: Antonio Niño Díaz, 2008-2011, 2019, 2022
|
||||
// SPDX-FileContributor: Antonio Niño Díaz, 2008-2024
|
||||
//
|
||||
// This file is part of Nitro Engine
|
||||
|
||||
@ -13,33 +13,45 @@
|
||||
#include "landscape_pal_bin.h"
|
||||
#include "landscape_tex_bin.h"
|
||||
|
||||
NE_Material *Material1, *Material2;
|
||||
NE_Palette *Palette1, *Palette2;
|
||||
typedef struct {
|
||||
NE_Material *Material1;
|
||||
} SceneData1;
|
||||
|
||||
void Draw3DScene1(void)
|
||||
typedef struct {
|
||||
NE_Material *Material2;
|
||||
} SceneData2;
|
||||
|
||||
void Draw3DScene1(void *arg)
|
||||
{
|
||||
SceneData1 *Scene = arg;
|
||||
|
||||
NE_ClearColorSet(RGB15(5, 5, 10), 31, 63);
|
||||
|
||||
NE_2DViewInit();
|
||||
|
||||
NE_2DDrawTexturedQuad(32, 32,
|
||||
32 + 128, 32 + 128,
|
||||
0, Material1);
|
||||
0, Scene->Material1);
|
||||
}
|
||||
|
||||
void Draw3DScene2(void)
|
||||
void Draw3DScene2(void *arg)
|
||||
{
|
||||
SceneData2 *Scene = arg;
|
||||
|
||||
NE_ClearColorSet(RGB15(10, 5, 0), 31, 63);
|
||||
|
||||
NE_2DViewInit();
|
||||
|
||||
NE_2DDrawTexturedQuad(64, 0,
|
||||
64 + 128, 0 + 128,
|
||||
0, Material2);
|
||||
0, Scene->Material2);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
SceneData1 Scene1 = { 0 };
|
||||
SceneData2 Scene2 = { 0 };
|
||||
|
||||
irqEnable(IRQ_HBLANK);
|
||||
irqSet(IRQ_VBLANK, NE_VBLFunc);
|
||||
irqSet(IRQ_HBLANK, NE_HBLFunc);
|
||||
@ -47,28 +59,29 @@ int main(void)
|
||||
NE_InitDual3D();
|
||||
|
||||
// Allocate objects
|
||||
Material1 = NE_MaterialCreate();
|
||||
Material2 = NE_MaterialCreate();
|
||||
Palette1 = NE_PaletteCreate();
|
||||
Palette2 = NE_PaletteCreate();
|
||||
Scene1.Material1 = NE_MaterialCreate();
|
||||
Scene2.Material2 = NE_MaterialCreate();
|
||||
|
||||
NE_MaterialTex4x4Load(Material1, 128, 128, NE_TEXGEN_TEXCOORD,
|
||||
NE_Palette *Palette1 = NE_PaletteCreate();
|
||||
NE_Palette *Palette2 = NE_PaletteCreate();
|
||||
|
||||
NE_MaterialTex4x4Load(Scene1.Material1, 128, 128, NE_TEXGEN_TEXCOORD,
|
||||
grill_tex_bin, grill_idx_bin);
|
||||
NE_PaletteLoadSize(Palette1, grill_pal_bin, grill_pal_bin_size,
|
||||
NE_TEX4X4);
|
||||
NE_MaterialSetPalette(Material1, Palette1);
|
||||
NE_MaterialSetPalette(Scene1.Material1, Palette1);
|
||||
|
||||
NE_MaterialTex4x4Load(Material2, 128, 128, NE_TEXGEN_TEXCOORD,
|
||||
NE_MaterialTex4x4Load(Scene2.Material2, 128, 128, NE_TEXGEN_TEXCOORD,
|
||||
landscape_tex_bin, landscape_idx_bin);
|
||||
NE_PaletteLoadSize(Palette2, landscape_pal_bin,
|
||||
landscape_pal_bin_size, NE_TEX4X4);
|
||||
NE_MaterialSetPalette(Material2, Palette2);
|
||||
NE_MaterialSetPalette(Scene2.Material2, Palette2);
|
||||
|
||||
while (1)
|
||||
{
|
||||
NE_WaitForVBL(0);
|
||||
|
||||
NE_ProcessDual(Draw3DScene1, Draw3DScene2);
|
||||
NE_ProcessDualArg(Draw3DScene1, Draw3DScene2, &Scene1, &Scene2);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -1,220 +1,6 @@
|
||||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#---------------------------------------------------------------------------------
|
||||
# This is a minimal makefile only used for the examples. If you want a makefile
|
||||
# for your project, take one from the templates inside examples/templates.
|
||||
|
||||
ifeq ($(strip $(DEVKITARM)),)
|
||||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
||||
endif
|
||||
NITROFSDIR := nitrofiles
|
||||
|
||||
include $(DEVKITARM)/ds_rules
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# TARGET is the name of the output
|
||||
# BUILD is the directory where object files & intermediate files will be placed
|
||||
# SOURCES is a list of directories containing source code
|
||||
# INCLUDES is a list of directories containing extra header files
|
||||
# DATA is a list of directories containing binary files embedded using bin2o
|
||||
# GRAPHICS is a list of directories containing image files to be converted with grit
|
||||
# AUDIO is a list of directories containing audio to be converted by maxmod
|
||||
# ICON is the image used to create the game icon, leave blank to use default rule
|
||||
# NITRO is a directory that will be accessible via NitroFS
|
||||
#---------------------------------------------------------------------------------
|
||||
TARGET := $(shell basename $(CURDIR))
|
||||
BUILD := build
|
||||
SOURCES := source
|
||||
INCLUDES := include
|
||||
DATA := data
|
||||
GRAPHICS :=
|
||||
AUDIO :=
|
||||
ICON :=
|
||||
|
||||
# specify a directory which contains the nitro filesystem
|
||||
# this is relative to the Makefile
|
||||
NITRO := nitrofiles
|
||||
|
||||
# These set the information text in the nds file
|
||||
GAME_TITLE := $(shell basename $(CURDIR))
|
||||
GAME_SUBTITLE1 := Nitro Engine example
|
||||
GAME_SUBTITLE2 := github.com/AntonioND/nitro-engine
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# options for code generation
|
||||
#---------------------------------------------------------------------------------
|
||||
ARCH := -marm -mthumb-interwork -march=armv5te -mtune=arm946e-s
|
||||
|
||||
CFLAGS := -g -Wall -O3\
|
||||
$(ARCH) $(INCLUDE) -DARM9
|
||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
|
||||
ASFLAGS := -g $(ARCH)
|
||||
LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# any extra libraries we wish to link with the project (order is important)
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBS := -lNE -lfat -lnds9
|
||||
|
||||
# automatigically add libraries for NitroFS
|
||||
ifneq ($(strip $(NITRO)),)
|
||||
LIBS := -lfilesystem -lfat $(LIBS)
|
||||
endif
|
||||
# automagically add maxmod library
|
||||
ifneq ($(strip $(AUDIO)),)
|
||||
LIBS := -lmm9 $(LIBS)
|
||||
endif
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# list of directories containing libraries, this must be the top level containing
|
||||
# include and lib
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nitro-engine
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# no real need to edit anything past this point unless you need to add additional
|
||||
# rules for different file extensions
|
||||
#---------------------------------------------------------------------------------
|
||||
ifneq ($(BUILD),$(notdir $(CURDIR)))
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
export OUTPUT := $(CURDIR)/$(TARGET)
|
||||
|
||||
export VPATH := $(CURDIR)/$(subst /,,$(dir $(ICON)))\
|
||||
$(foreach dir,$(SOURCES),$(CURDIR)/$(dir))\
|
||||
$(foreach dir,$(DATA),$(CURDIR)/$(dir))\
|
||||
$(foreach dir,$(GRAPHICS),$(CURDIR)/$(dir))
|
||||
|
||||
export DEPSDIR := $(CURDIR)/$(BUILD)
|
||||
|
||||
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
|
||||
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
|
||||
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
|
||||
PNGFILES := $(foreach dir,$(GRAPHICS),$(notdir $(wildcard $(dir)/*.png)))
|
||||
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
|
||||
|
||||
# prepare NitroFS directory
|
||||
ifneq ($(strip $(NITRO)),)
|
||||
export NITRO_FILES := $(CURDIR)/$(NITRO)
|
||||
endif
|
||||
|
||||
# get audio list for maxmod
|
||||
ifneq ($(strip $(AUDIO)),)
|
||||
export MODFILES := $(foreach dir,$(notdir $(wildcard $(AUDIO)/*.*)),$(CURDIR)/$(AUDIO)/$(dir))
|
||||
|
||||
# place the soundbank file in NitroFS if using it
|
||||
ifneq ($(strip $(NITRO)),)
|
||||
export SOUNDBANK := $(NITRO_FILES)/soundbank.bin
|
||||
|
||||
# otherwise, needs to be loaded from memory
|
||||
else
|
||||
export SOUNDBANK := soundbank.bin
|
||||
BINFILES += $(SOUNDBANK)
|
||||
endif
|
||||
endif
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# use CXX for linking C++ projects, CC for standard C
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(CPPFILES)),)
|
||||
#---------------------------------------------------------------------------------
|
||||
export LD := $(CC)
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
#---------------------------------------------------------------------------------
|
||||
export LD := $(CXX)
|
||||
#---------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
|
||||
|
||||
export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
|
||||
|
||||
export OFILES := $(PNGFILES:.png=.o) $(OFILES_BIN) $(OFILES_SOURCES)
|
||||
|
||||
export HFILES := $(PNGFILES:.png=.h) $(addsuffix .h,$(subst .,_,$(BINFILES)))
|
||||
|
||||
export INCLUDE := $(foreach dir,$(INCLUDES),-iquote $(CURDIR)/$(dir))\
|
||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include)\
|
||||
-I$(CURDIR)/$(BUILD)
|
||||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
|
||||
|
||||
ifeq ($(strip $(ICON)),)
|
||||
icons := $(wildcard *.bmp)
|
||||
|
||||
ifneq (,$(findstring $(TARGET).bmp,$(icons)))
|
||||
export GAME_ICON := $(CURDIR)/$(TARGET).bmp
|
||||
else
|
||||
ifneq (,$(findstring icon.bmp,$(icons)))
|
||||
export GAME_ICON := $(CURDIR)/icon.bmp
|
||||
endif
|
||||
endif
|
||||
else
|
||||
ifeq ($(suffix $(ICON)), .grf)
|
||||
export GAME_ICON := $(CURDIR)/$(ICON)
|
||||
else
|
||||
export GAME_ICON := $(CURDIR)/$(BUILD)/$(notdir $(basename $(ICON))).grf
|
||||
endif
|
||||
endif
|
||||
|
||||
.PHONY: $(BUILD) clean
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
$(BUILD):
|
||||
@mkdir -p $@
|
||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
clean:
|
||||
@echo clean ...
|
||||
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(SOUNDBANK)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# main targets
|
||||
#---------------------------------------------------------------------------------
|
||||
$(OUTPUT).nds: $(OUTPUT).elf $(GAME_ICON)
|
||||
$(OUTPUT).elf: $(OFILES)
|
||||
|
||||
# source files depend on generated headers
|
||||
$(OFILES_SOURCES) : $(HFILES)
|
||||
|
||||
# need to build soundbank first
|
||||
$(OFILES): $(SOUNDBANK)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# rule to build solution from music files
|
||||
#---------------------------------------------------------------------------------
|
||||
$(SOUNDBANK) : $(MODFILES)
|
||||
#---------------------------------------------------------------------------------
|
||||
mmutil $^ -d -o$@ -hsoundbank.h
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.bin.o %_bin.h : %.bin
|
||||
#---------------------------------------------------------------------------------
|
||||
@echo $(notdir $<)
|
||||
@$(bin2o)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# This rule creates assembly source files using grit
|
||||
# grit takes an image file and a .grit describing how the file is to be processed
|
||||
# add additional rules like this for each image extension
|
||||
# you use in the graphics folders
|
||||
#---------------------------------------------------------------------------------
|
||||
%.s %.h: %.png %.grit
|
||||
#---------------------------------------------------------------------------------
|
||||
grit $< -fts -o$*
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# Convert non-GRF game icon to GRF if needed
|
||||
#---------------------------------------------------------------------------------
|
||||
$(GAME_ICON): $(notdir $(ICON))
|
||||
#---------------------------------------------------------------------------------
|
||||
@echo convert $(notdir $<)
|
||||
@grit $< -g -gt -gB4 -gT FF00FF -m! -p -pe 16 -fh! -ftr
|
||||
|
||||
-include $(DEPSDIR)/*.d
|
||||
|
||||
#---------------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------------
|
||||
include ../../Makefile.example
|
||||
|
@ -1,10 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
NITRO_ENGINE=$DEVKITPRO/nitro-engine
|
||||
NITRO_ENGINE=../../..
|
||||
ASSETS=$NITRO_ENGINE/examples/assets
|
||||
TOOLS=$NITRO_ENGINE/tools
|
||||
MD5_TO_DSMA=$TOOLS/md5_to_dsma/md5_to_dsma.py
|
||||
GRIT=grit
|
||||
BLOCKSDS="${BLOCKSDS:-/opt/blocksds/core/}"
|
||||
GRIT=$BLOCKSDS/tools/grit/grit
|
||||
|
||||
rm -rf nitrofiles
|
||||
mkdir -p nitrofiles
|
||||
|
@ -1,25 +0,0 @@
|
||||
|
||||
//{{BLOCK(texture)
|
||||
|
||||
//======================================================================
|
||||
//
|
||||
// texture, 256x256@16,
|
||||
// Alphabit on.
|
||||
// + bitmap not compressed
|
||||
// Total size: 131072 = 131072
|
||||
//
|
||||
// Time-stamp: 2024-01-27, 18:07:12
|
||||
// Exported by Cearn's GBA Image Transmogrifier, v0.9.2
|
||||
// ( http://www.coranac.com/projects/#grit )
|
||||
//
|
||||
//======================================================================
|
||||
|
||||
#ifndef GRIT_TEXTURE_H
|
||||
#define GRIT_TEXTURE_H
|
||||
|
||||
#define textureBitmapLen 131072
|
||||
extern const unsigned int textureBitmap[32768];
|
||||
|
||||
#endif // GRIT_TEXTURE_H
|
||||
|
||||
//}}BLOCK(texture)
|
@ -1,6 +1,6 @@
|
||||
// SPDX-License-Identifier: CC0-1.0
|
||||
//
|
||||
// SPDX-FileContributor: Antonio Niño Díaz, 2008-2011, 2019, 2022
|
||||
// SPDX-FileContributor: Antonio Niño Díaz, 2008-2024
|
||||
//
|
||||
// This file is part of Nitro Engine
|
||||
|
||||
@ -11,22 +11,24 @@
|
||||
|
||||
#include <NEMain.h>
|
||||
|
||||
NE_Camera *Camera;
|
||||
NE_Model *Model;
|
||||
NE_Animation *Animation;
|
||||
NE_Material *Material;
|
||||
typedef struct {
|
||||
NE_Camera *Camera;
|
||||
NE_Model *Model;
|
||||
} SceneData;
|
||||
|
||||
void Draw3DScene(void)
|
||||
void Draw3DScene(void *arg)
|
||||
{
|
||||
NE_CameraUse(Camera);
|
||||
SceneData *Scene = arg;
|
||||
|
||||
NE_CameraUse(Scene->Camera);
|
||||
|
||||
NE_PolyFormat(31, 0, NE_LIGHT_0, NE_CULL_NONE, 0);
|
||||
NE_ModelDraw(Model);
|
||||
NE_ModelDraw(Scene->Model);
|
||||
}
|
||||
|
||||
void WaitLoop(void)
|
||||
{
|
||||
while(1)
|
||||
while (1)
|
||||
{
|
||||
swiWaitForVBlank();
|
||||
scanKeys();
|
||||
@ -35,8 +37,10 @@ void WaitLoop(void)
|
||||
}
|
||||
}
|
||||
|
||||
int main(void)
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
SceneData Scene = { 0 };
|
||||
|
||||
irqEnable(IRQ_HBLANK);
|
||||
irqSet(IRQ_VBLANK, NE_VBLFunc);
|
||||
irqSet(IRQ_HBLANK, NE_HBLFunc);
|
||||
@ -55,18 +59,18 @@ int main(void)
|
||||
}
|
||||
|
||||
// Allocate space for objects...
|
||||
Model = NE_ModelCreate(NE_Animated);
|
||||
Camera = NE_CameraCreate();
|
||||
Material = NE_MaterialCreate();
|
||||
Animation = NE_AnimationCreate();
|
||||
Scene.Model = NE_ModelCreate(NE_Animated);
|
||||
Scene.Camera = NE_CameraCreate();
|
||||
NE_Material *Material = NE_MaterialCreate();
|
||||
NE_Animation *Animation = NE_AnimationCreate();
|
||||
|
||||
// Setup camera
|
||||
NE_CameraSet(Camera,
|
||||
NE_CameraSet(Scene.Camera,
|
||||
6, 3, -4,
|
||||
0, 3, 0,
|
||||
0, 1, 0);
|
||||
|
||||
if (NE_ModelLoadDSMFAT(Model, "robot.dsm") == 0)
|
||||
if (NE_ModelLoadDSMFAT(Scene.Model, "robot.dsm") == 0)
|
||||
{
|
||||
printf("Couldn't load model...");
|
||||
WaitLoop();
|
||||
@ -89,10 +93,10 @@ int main(void)
|
||||
}
|
||||
|
||||
// Assign material to the model
|
||||
NE_ModelSetMaterial(Model, Material);
|
||||
NE_ModelSetMaterial(Scene.Model, Material);
|
||||
|
||||
NE_ModelSetAnimation(Model, Animation);
|
||||
NE_ModelAnimStart(Model, NE_ANIM_LOOP, floattof32(0.1));
|
||||
NE_ModelSetAnimation(Scene.Model, Animation);
|
||||
NE_ModelAnimStart(Scene.Model, NE_ANIM_LOOP, floattof32(0.1));
|
||||
|
||||
NE_LightSet(0, NE_White, 0, -1, -1);
|
||||
|
||||
@ -111,16 +115,15 @@ int main(void)
|
||||
break;
|
||||
|
||||
if (keys & KEY_RIGHT)
|
||||
NE_ModelRotate(Model, 0, 2, 0);
|
||||
NE_ModelRotate(Scene.Model, 0, 2, 0);
|
||||
if (keys & KEY_LEFT)
|
||||
NE_ModelRotate(Model, 0, -2, 0);
|
||||
NE_ModelRotate(Scene.Model, 0, -2, 0);
|
||||
if (keys & KEY_UP)
|
||||
NE_ModelRotate(Model, 0, 0, 2);
|
||||
NE_ModelRotate(Scene.Model, 0, 0, 2);
|
||||
if (keys & KEY_DOWN)
|
||||
NE_ModelRotate(Model, 0, 0, -2);
|
||||
NE_ModelRotate(Scene.Model, 0, 0, -2);
|
||||
|
||||
// Draw scene...
|
||||
NE_Process(Draw3DScene);
|
||||
NE_ProcessArg(Draw3DScene, &Scene);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -1,220 +1,6 @@
|
||||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#---------------------------------------------------------------------------------
|
||||
# This is a minimal makefile only used for the examples. If you want a makefile
|
||||
# for your project, take one from the templates inside examples/templates.
|
||||
|
||||
ifeq ($(strip $(DEVKITARM)),)
|
||||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
||||
endif
|
||||
NITROFSDIR := nitrofiles
|
||||
|
||||
include $(DEVKITARM)/ds_rules
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# TARGET is the name of the output
|
||||
# BUILD is the directory where object files & intermediate files will be placed
|
||||
# SOURCES is a list of directories containing source code
|
||||
# INCLUDES is a list of directories containing extra header files
|
||||
# DATA is a list of directories containing binary files embedded using bin2o
|
||||
# GRAPHICS is a list of directories containing image files to be converted with grit
|
||||
# AUDIO is a list of directories containing audio to be converted by maxmod
|
||||
# ICON is the image used to create the game icon, leave blank to use default rule
|
||||
# NITRO is a directory that will be accessible via NitroFS
|
||||
#---------------------------------------------------------------------------------
|
||||
TARGET := $(shell basename $(CURDIR))
|
||||
BUILD := build
|
||||
SOURCES := source
|
||||
INCLUDES := include
|
||||
DATA := data
|
||||
GRAPHICS :=
|
||||
AUDIO :=
|
||||
ICON :=
|
||||
|
||||
# specify a directory which contains the nitro filesystem
|
||||
# this is relative to the Makefile
|
||||
NITRO := nitrofiles
|
||||
|
||||
# These set the information text in the nds file
|
||||
GAME_TITLE := $(shell basename $(CURDIR))
|
||||
GAME_SUBTITLE1 := Nitro Engine example
|
||||
GAME_SUBTITLE2 := github.com/AntonioND/nitro-engine
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# options for code generation
|
||||
#---------------------------------------------------------------------------------
|
||||
ARCH := -marm -mthumb-interwork -march=armv5te -mtune=arm946e-s
|
||||
|
||||
CFLAGS := -g -Wall -O3\
|
||||
$(ARCH) $(INCLUDE) -DARM9
|
||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
|
||||
ASFLAGS := -g $(ARCH)
|
||||
LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# any extra libraries we wish to link with the project (order is important)
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBS := -lNE -lfat -lnds9
|
||||
|
||||
# automatigically add libraries for NitroFS
|
||||
ifneq ($(strip $(NITRO)),)
|
||||
LIBS := -lfilesystem -lfat $(LIBS)
|
||||
endif
|
||||
# automagically add maxmod library
|
||||
ifneq ($(strip $(AUDIO)),)
|
||||
LIBS := -lmm9 $(LIBS)
|
||||
endif
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# list of directories containing libraries, this must be the top level containing
|
||||
# include and lib
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nitro-engine
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# no real need to edit anything past this point unless you need to add additional
|
||||
# rules for different file extensions
|
||||
#---------------------------------------------------------------------------------
|
||||
ifneq ($(BUILD),$(notdir $(CURDIR)))
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
export OUTPUT := $(CURDIR)/$(TARGET)
|
||||
|
||||
export VPATH := $(CURDIR)/$(subst /,,$(dir $(ICON)))\
|
||||
$(foreach dir,$(SOURCES),$(CURDIR)/$(dir))\
|
||||
$(foreach dir,$(DATA),$(CURDIR)/$(dir))\
|
||||
$(foreach dir,$(GRAPHICS),$(CURDIR)/$(dir))
|
||||
|
||||
export DEPSDIR := $(CURDIR)/$(BUILD)
|
||||
|
||||
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
|
||||
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
|
||||
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
|
||||
PNGFILES := $(foreach dir,$(GRAPHICS),$(notdir $(wildcard $(dir)/*.png)))
|
||||
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
|
||||
|
||||
# prepare NitroFS directory
|
||||
ifneq ($(strip $(NITRO)),)
|
||||
export NITRO_FILES := $(CURDIR)/$(NITRO)
|
||||
endif
|
||||
|
||||
# get audio list for maxmod
|
||||
ifneq ($(strip $(AUDIO)),)
|
||||
export MODFILES := $(foreach dir,$(notdir $(wildcard $(AUDIO)/*.*)),$(CURDIR)/$(AUDIO)/$(dir))
|
||||
|
||||
# place the soundbank file in NitroFS if using it
|
||||
ifneq ($(strip $(NITRO)),)
|
||||
export SOUNDBANK := $(NITRO_FILES)/soundbank.bin
|
||||
|
||||
# otherwise, needs to be loaded from memory
|
||||
else
|
||||
export SOUNDBANK := soundbank.bin
|
||||
BINFILES += $(SOUNDBANK)
|
||||
endif
|
||||
endif
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# use CXX for linking C++ projects, CC for standard C
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(CPPFILES)),)
|
||||
#---------------------------------------------------------------------------------
|
||||
export LD := $(CC)
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
#---------------------------------------------------------------------------------
|
||||
export LD := $(CXX)
|
||||
#---------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
|
||||
|
||||
export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
|
||||
|
||||
export OFILES := $(PNGFILES:.png=.o) $(OFILES_BIN) $(OFILES_SOURCES)
|
||||
|
||||
export HFILES := $(PNGFILES:.png=.h) $(addsuffix .h,$(subst .,_,$(BINFILES)))
|
||||
|
||||
export INCLUDE := $(foreach dir,$(INCLUDES),-iquote $(CURDIR)/$(dir))\
|
||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include)\
|
||||
-I$(CURDIR)/$(BUILD)
|
||||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
|
||||
|
||||
ifeq ($(strip $(ICON)),)
|
||||
icons := $(wildcard *.bmp)
|
||||
|
||||
ifneq (,$(findstring $(TARGET).bmp,$(icons)))
|
||||
export GAME_ICON := $(CURDIR)/$(TARGET).bmp
|
||||
else
|
||||
ifneq (,$(findstring icon.bmp,$(icons)))
|
||||
export GAME_ICON := $(CURDIR)/icon.bmp
|
||||
endif
|
||||
endif
|
||||
else
|
||||
ifeq ($(suffix $(ICON)), .grf)
|
||||
export GAME_ICON := $(CURDIR)/$(ICON)
|
||||
else
|
||||
export GAME_ICON := $(CURDIR)/$(BUILD)/$(notdir $(basename $(ICON))).grf
|
||||
endif
|
||||
endif
|
||||
|
||||
.PHONY: $(BUILD) clean
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
$(BUILD):
|
||||
@mkdir -p $@
|
||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
clean:
|
||||
@echo clean ...
|
||||
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(SOUNDBANK)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# main targets
|
||||
#---------------------------------------------------------------------------------
|
||||
$(OUTPUT).nds: $(OUTPUT).elf $(GAME_ICON)
|
||||
$(OUTPUT).elf: $(OFILES)
|
||||
|
||||
# source files depend on generated headers
|
||||
$(OFILES_SOURCES) : $(HFILES)
|
||||
|
||||
# need to build soundbank first
|
||||
$(OFILES): $(SOUNDBANK)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# rule to build solution from music files
|
||||
#---------------------------------------------------------------------------------
|
||||
$(SOUNDBANK) : $(MODFILES)
|
||||
#---------------------------------------------------------------------------------
|
||||
mmutil $^ -d -o$@ -hsoundbank.h
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.bin.o %_bin.h : %.bin
|
||||
#---------------------------------------------------------------------------------
|
||||
@echo $(notdir $<)
|
||||
@$(bin2o)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# This rule creates assembly source files using grit
|
||||
# grit takes an image file and a .grit describing how the file is to be processed
|
||||
# add additional rules like this for each image extension
|
||||
# you use in the graphics folders
|
||||
#---------------------------------------------------------------------------------
|
||||
%.s %.h: %.png %.grit
|
||||
#---------------------------------------------------------------------------------
|
||||
grit $< -fts -o$*
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# Convert non-GRF game icon to GRF if needed
|
||||
#---------------------------------------------------------------------------------
|
||||
$(GAME_ICON): $(notdir $(ICON))
|
||||
#---------------------------------------------------------------------------------
|
||||
@echo convert $(notdir $<)
|
||||
@grit $< -g -gt -gB4 -gT FF00FF -m! -p -pe 16 -fh! -ftr
|
||||
|
||||
-include $(DEPSDIR)/*.d
|
||||
|
||||
#---------------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------------
|
||||
include ../../Makefile.example
|
||||
|
@ -1,6 +0,0 @@
|
||||
# This is a minimal makefile only used for the examples. If you want a makefile
|
||||
# for your project, take one from the templates inside examples/templates.
|
||||
|
||||
NITROFSDIR := nitrofiles
|
||||
|
||||
include ../../Makefile.example.blocksds
|
@ -1,10 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
NITRO_ENGINE=$DEVKITPRO/nitro-engine
|
||||
NITRO_ENGINE=../../..
|
||||
ASSETS=$NITRO_ENGINE/examples/assets
|
||||
TOOLS=$NITRO_ENGINE/tools
|
||||
OBJ2DL=$TOOLS/obj2dl/obj2dl.py
|
||||
GRIT=grit
|
||||
BLOCKSDS="${BLOCKSDS:-/opt/blocksds/core/}"
|
||||
GRIT=$BLOCKSDS/tools/grit/grit
|
||||
|
||||
rm -rf nitrofiles
|
||||
mkdir -p nitrofiles
|
||||
|
@ -1,6 +1,6 @@
|
||||
// SPDX-License-Identifier: CC0-1.0
|
||||
//
|
||||
// SPDX-FileContributor: Antonio Niño Díaz, 2008-2011, 2019, 2022
|
||||
// SPDX-FileContributor: Antonio Niño Díaz, 2008-2024
|
||||
//
|
||||
// This file is part of Nitro Engine
|
||||
|
||||
@ -10,21 +10,25 @@
|
||||
|
||||
#include <NEMain.h>
|
||||
|
||||
NE_Camera *Camera;
|
||||
NE_Model *Model;
|
||||
NE_Material *MaterialBlue, *MaterialRed;
|
||||
NE_Palette *PaletteBlue, *PaletteRed;
|
||||
typedef struct {
|
||||
NE_Camera *Camera;
|
||||
NE_Model *Model;
|
||||
} SceneData;
|
||||
|
||||
void Draw3DScene(void)
|
||||
void Draw3DScene(void *arg)
|
||||
{
|
||||
NE_CameraUse(Camera);
|
||||
SceneData *Scene = arg;
|
||||
|
||||
NE_CameraUse(Scene->Camera);
|
||||
|
||||
NE_PolyFormat(31, 0, NE_LIGHT_0, NE_CULL_NONE, 0);
|
||||
NE_ModelDraw(Model);
|
||||
NE_ModelDraw(Scene->Model);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
SceneData Scene = { 0 };
|
||||
|
||||
irqEnable(IRQ_HBLANK);
|
||||
irqSet(IRQ_VBLANK, NE_VBLFunc);
|
||||
irqSet(IRQ_HBLANK, NE_HBLFunc);
|
||||
@ -48,21 +52,21 @@ int main(void)
|
||||
}
|
||||
|
||||
// Allocate space for objects...
|
||||
Model = NE_ModelCreate(NE_Static);
|
||||
Camera = NE_CameraCreate();
|
||||
MaterialBlue = NE_MaterialCreate();
|
||||
MaterialRed = NE_MaterialCreate();
|
||||
PaletteBlue = NE_PaletteCreate();
|
||||
PaletteRed = NE_PaletteCreate();
|
||||
Scene.Model = NE_ModelCreate(NE_Static);
|
||||
Scene.Camera = NE_CameraCreate();
|
||||
NE_Material *MaterialBlue = NE_MaterialCreate();
|
||||
NE_Material *MaterialRed = NE_MaterialCreate();
|
||||
NE_Palette *PaletteBlue = NE_PaletteCreate();
|
||||
NE_Palette *PaletteRed = NE_PaletteCreate();
|
||||
|
||||
// Setup camera
|
||||
NE_CameraSet(Camera,
|
||||
NE_CameraSet(Scene.Camera,
|
||||
-1, -1, -1,
|
||||
0, 0, 0,
|
||||
0, 1, 0);
|
||||
|
||||
// Load things from FAT
|
||||
NE_ModelLoadStaticMeshFAT(Model, "cube.bin");
|
||||
NE_ModelLoadStaticMeshFAT(Scene.Model, "cube.bin");
|
||||
|
||||
NE_MaterialTexLoadFAT(MaterialBlue, NE_A3PAL32, 64, 64, NE_TEXGEN_TEXCOORD,
|
||||
"spiral_blue_pal32.img.bin");
|
||||
@ -76,7 +80,7 @@ int main(void)
|
||||
NE_MaterialSetPalette(MaterialRed, PaletteRed);
|
||||
|
||||
// Assign material to model
|
||||
NE_ModelSetMaterial(Model, MaterialBlue);
|
||||
NE_ModelSetMaterial(Scene.Model, MaterialBlue);
|
||||
|
||||
// Set up light
|
||||
NE_LightSet(0, NE_White, 0, -1, -1);
|
||||
@ -96,19 +100,18 @@ int main(void)
|
||||
|
||||
// Change material if pressed
|
||||
if (keys & KEY_B)
|
||||
NE_ModelSetMaterial(Model, MaterialBlue);
|
||||
NE_ModelSetMaterial(Scene.Model, MaterialBlue);
|
||||
if (keys & KEY_A)
|
||||
NE_ModelSetMaterial(Model, MaterialRed);
|
||||
NE_ModelSetMaterial(Scene.Model, MaterialRed);
|
||||
|
||||
printf("\x1b[0;0HA/B: Change material.\n\nSTART: Exit.");
|
||||
|
||||
// Increase rotation, you can't get the rotation angle after
|
||||
// this. If you want to know always the angle, you should use
|
||||
// NE_ModelSetRot().
|
||||
NE_ModelRotate(Model, 1, 2, 0);
|
||||
NE_ModelRotate(Scene.Model, 1, 2, 0);
|
||||
|
||||
// Draw scene...
|
||||
NE_Process(Draw3DScene);
|
||||
NE_ProcessArg(Draw3DScene, &Scene);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -1,220 +1,6 @@
|
||||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#---------------------------------------------------------------------------------
|
||||
# This is a minimal makefile only used for the examples. If you want a makefile
|
||||
# for your project, take one from the templates inside examples/templates.
|
||||
|
||||
ifeq ($(strip $(DEVKITARM)),)
|
||||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
||||
endif
|
||||
NITROFSDIR := nitrofiles
|
||||
|
||||
include $(DEVKITARM)/ds_rules
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# TARGET is the name of the output
|
||||
# BUILD is the directory where object files & intermediate files will be placed
|
||||
# SOURCES is a list of directories containing source code
|
||||
# INCLUDES is a list of directories containing extra header files
|
||||
# DATA is a list of directories containing binary files embedded using bin2o
|
||||
# GRAPHICS is a list of directories containing image files to be converted with grit
|
||||
# AUDIO is a list of directories containing audio to be converted by maxmod
|
||||
# ICON is the image used to create the game icon, leave blank to use default rule
|
||||
# NITRO is a directory that will be accessible via NitroFS
|
||||
#---------------------------------------------------------------------------------
|
||||
TARGET := $(shell basename $(CURDIR))
|
||||
BUILD := build
|
||||
SOURCES := source
|
||||
INCLUDES := include
|
||||
DATA :=
|
||||
GRAPHICS :=
|
||||
AUDIO :=
|
||||
ICON :=
|
||||
|
||||
# specify a directory which contains the nitro filesystem
|
||||
# this is relative to the Makefile
|
||||
NITRO := nitrofiles
|
||||
|
||||
# These set the information text in the nds file
|
||||
GAME_TITLE := $(shell basename $(CURDIR))
|
||||
GAME_SUBTITLE1 := Nitro Engine example
|
||||
GAME_SUBTITLE2 := github.com/AntonioND/nitro-engine
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# options for code generation
|
||||
#---------------------------------------------------------------------------------
|
||||
ARCH := -marm -mthumb-interwork -march=armv5te -mtune=arm946e-s
|
||||
|
||||
CFLAGS := -g -Wall -O3\
|
||||
$(ARCH) $(INCLUDE) -DARM9
|
||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
|
||||
ASFLAGS := -g $(ARCH)
|
||||
LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# any extra libraries we wish to link with the project (order is important)
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBS := -lNE -lfat -lnds9
|
||||
|
||||
# automatigically add libraries for NitroFS
|
||||
ifneq ($(strip $(NITRO)),)
|
||||
LIBS := -lfilesystem -lfat $(LIBS)
|
||||
endif
|
||||
# automagically add maxmod library
|
||||
ifneq ($(strip $(AUDIO)),)
|
||||
LIBS := -lmm9 $(LIBS)
|
||||
endif
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# list of directories containing libraries, this must be the top level containing
|
||||
# include and lib
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nitro-engine
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# no real need to edit anything past this point unless you need to add additional
|
||||
# rules for different file extensions
|
||||
#---------------------------------------------------------------------------------
|
||||
ifneq ($(BUILD),$(notdir $(CURDIR)))
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
export OUTPUT := $(CURDIR)/$(TARGET)
|
||||
|
||||
export VPATH := $(CURDIR)/$(subst /,,$(dir $(ICON)))\
|
||||
$(foreach dir,$(SOURCES),$(CURDIR)/$(dir))\
|
||||
$(foreach dir,$(DATA),$(CURDIR)/$(dir))\
|
||||
$(foreach dir,$(GRAPHICS),$(CURDIR)/$(dir))
|
||||
|
||||
export DEPSDIR := $(CURDIR)/$(BUILD)
|
||||
|
||||
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
|
||||
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
|
||||
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
|
||||
PNGFILES := $(foreach dir,$(GRAPHICS),$(notdir $(wildcard $(dir)/*.png)))
|
||||
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
|
||||
|
||||
# prepare NitroFS directory
|
||||
ifneq ($(strip $(NITRO)),)
|
||||
export NITRO_FILES := $(CURDIR)/$(NITRO)
|
||||
endif
|
||||
|
||||
# get audio list for maxmod
|
||||
ifneq ($(strip $(AUDIO)),)
|
||||
export MODFILES := $(foreach dir,$(notdir $(wildcard $(AUDIO)/*.*)),$(CURDIR)/$(AUDIO)/$(dir))
|
||||
|
||||
# place the soundbank file in NitroFS if using it
|
||||
ifneq ($(strip $(NITRO)),)
|
||||
export SOUNDBANK := $(NITRO_FILES)/soundbank.bin
|
||||
|
||||
# otherwise, needs to be loaded from memory
|
||||
else
|
||||
export SOUNDBANK := soundbank.bin
|
||||
BINFILES += $(SOUNDBANK)
|
||||
endif
|
||||
endif
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# use CXX for linking C++ projects, CC for standard C
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(CPPFILES)),)
|
||||
#---------------------------------------------------------------------------------
|
||||
export LD := $(CC)
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
#---------------------------------------------------------------------------------
|
||||
export LD := $(CXX)
|
||||
#---------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
|
||||
|
||||
export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
|
||||
|
||||
export OFILES := $(PNGFILES:.png=.o) $(OFILES_BIN) $(OFILES_SOURCES)
|
||||
|
||||
export HFILES := $(PNGFILES:.png=.h) $(addsuffix .h,$(subst .,_,$(BINFILES)))
|
||||
|
||||
export INCLUDE := $(foreach dir,$(INCLUDES),-iquote $(CURDIR)/$(dir))\
|
||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include)\
|
||||
-I$(CURDIR)/$(BUILD)
|
||||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
|
||||
|
||||
ifeq ($(strip $(ICON)),)
|
||||
icons := $(wildcard *.bmp)
|
||||
|
||||
ifneq (,$(findstring $(TARGET).bmp,$(icons)))
|
||||
export GAME_ICON := $(CURDIR)/$(TARGET).bmp
|
||||
else
|
||||
ifneq (,$(findstring icon.bmp,$(icons)))
|
||||
export GAME_ICON := $(CURDIR)/icon.bmp
|
||||
endif
|
||||
endif
|
||||
else
|
||||
ifeq ($(suffix $(ICON)), .grf)
|
||||
export GAME_ICON := $(CURDIR)/$(ICON)
|
||||
else
|
||||
export GAME_ICON := $(CURDIR)/$(BUILD)/$(notdir $(basename $(ICON))).grf
|
||||
endif
|
||||
endif
|
||||
|
||||
.PHONY: $(BUILD) clean
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
$(BUILD):
|
||||
@mkdir -p $@
|
||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
clean:
|
||||
@echo clean ...
|
||||
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(SOUNDBANK)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# main targets
|
||||
#---------------------------------------------------------------------------------
|
||||
$(OUTPUT).nds: $(OUTPUT).elf $(GAME_ICON)
|
||||
$(OUTPUT).elf: $(OFILES)
|
||||
|
||||
# source files depend on generated headers
|
||||
$(OFILES_SOURCES) : $(HFILES)
|
||||
|
||||
# need to build soundbank first
|
||||
$(OFILES): $(SOUNDBANK)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# rule to build solution from music files
|
||||
#---------------------------------------------------------------------------------
|
||||
$(SOUNDBANK) : $(MODFILES)
|
||||
#---------------------------------------------------------------------------------
|
||||
mmutil $^ -d -o$@ -hsoundbank.h
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.bin.o %_bin.h : %.bin
|
||||
#---------------------------------------------------------------------------------
|
||||
@echo $(notdir $<)
|
||||
@$(bin2o)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# This rule creates assembly source files using grit
|
||||
# grit takes an image file and a .grit describing how the file is to be processed
|
||||
# add additional rules like this for each image extension
|
||||
# you use in the graphics folders
|
||||
#---------------------------------------------------------------------------------
|
||||
%.s %.h: %.png %.grit
|
||||
#---------------------------------------------------------------------------------
|
||||
grit $< -fts -o$*
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# Convert non-GRF game icon to GRF if needed
|
||||
#---------------------------------------------------------------------------------
|
||||
$(GAME_ICON): $(notdir $(ICON))
|
||||
#---------------------------------------------------------------------------------
|
||||
@echo convert $(notdir $<)
|
||||
@grit $< -g -gt -gB4 -gT FF00FF -m! -p -pe 16 -fh! -ftr
|
||||
|
||||
-include $(DEPSDIR)/*.d
|
||||
|
||||
#---------------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------------
|
||||
include ../../Makefile.example
|
||||
|
@ -1,7 +0,0 @@
|
||||
# This is a minimal makefile only used for the examples. If you want a makefile
|
||||
# for your project, take one from the templates inside examples/templates.
|
||||
|
||||
BINDIRS := data
|
||||
NITROFSDIR := nitrofiles
|
||||
|
||||
include ../../Makefile.example.blocksds
|
@ -1,10 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
NITRO_ENGINE=$DEVKITPRO/nitro-engine
|
||||
NITRO_ENGINE=../../..
|
||||
ASSETS=$NITRO_ENGINE/examples/assets
|
||||
TOOLS=$NITRO_ENGINE/tools
|
||||
OBJ2DL=$TOOLS/obj2dl/obj2dl.py
|
||||
GRIT=grit
|
||||
BLOCKSDS="${BLOCKSDS:-/opt/blocksds/core/}"
|
||||
GRIT=$BLOCKSDS/tools/grit/grit
|
||||
|
||||
rm -rf nitrofiles
|
||||
mkdir -p nitrofiles
|
||||
|
@ -1,25 +0,0 @@
|
||||
|
||||
//{{BLOCK(texture)
|
||||
|
||||
//======================================================================
|
||||
//
|
||||
// texture, 256x256@16,
|
||||
// Alphabit on.
|
||||
// + bitmap not compressed
|
||||
// Total size: 131072 = 131072
|
||||
//
|
||||
// Time-stamp: 2024-01-27, 18:13:28
|
||||
// Exported by Cearn's GBA Image Transmogrifier, v0.9.2
|
||||
// ( http://www.coranac.com/projects/#grit )
|
||||
//
|
||||
//======================================================================
|
||||
|
||||
#ifndef GRIT_TEXTURE_H
|
||||
#define GRIT_TEXTURE_H
|
||||
|
||||
#define textureBitmapLen 131072
|
||||
extern const unsigned int textureBitmap[32768];
|
||||
|
||||
#endif // GRIT_TEXTURE_H
|
||||
|
||||
//}}BLOCK(texture)
|
@ -1,6 +1,6 @@
|
||||
// SPDX-License-Identifier: CC0-1.0
|
||||
//
|
||||
// SPDX-FileContributor: Antonio Niño Díaz, 2008-2011, 2019, 2022
|
||||
// SPDX-FileContributor: Antonio Niño Díaz, 2008-2024
|
||||
//
|
||||
// This file is part of Nitro Engine
|
||||
|
||||
@ -8,18 +8,23 @@
|
||||
|
||||
#include <filesystem.h>
|
||||
|
||||
NE_Camera *Camera;
|
||||
NE_Model *Model;
|
||||
NE_Material *Material;
|
||||
typedef struct {
|
||||
NE_Camera *Camera;
|
||||
NE_Model *Model;
|
||||
} SceneData;
|
||||
|
||||
void Draw3DScene(void)
|
||||
void Draw3DScene(void *arg)
|
||||
{
|
||||
NE_CameraUse(Camera);
|
||||
NE_ModelDraw(Model);
|
||||
SceneData *Scene = arg;
|
||||
|
||||
NE_CameraUse(Scene->Camera);
|
||||
NE_ModelDraw(Scene->Model);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
SceneData Scene = { 0 };
|
||||
|
||||
irqEnable(IRQ_HBLANK);
|
||||
irqSet(IRQ_VBLANK, NE_VBLFunc);
|
||||
irqSet(IRQ_HBLANK, NE_HBLFunc);
|
||||
@ -40,32 +45,30 @@ int main(void)
|
||||
NE_WaitForVBL(0);
|
||||
|
||||
scanKeys();
|
||||
uint32_t keys = keysHeld();
|
||||
|
||||
if (keys & KEY_START)
|
||||
return 0;
|
||||
if (keysHeld() & KEY_START)
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Allocate space for the objects we'll use
|
||||
Model = NE_ModelCreate(NE_Static);
|
||||
Camera = NE_CameraCreate();
|
||||
Material = NE_MaterialCreate();
|
||||
Scene.Model = NE_ModelCreate(NE_Static);
|
||||
Scene.Camera = NE_CameraCreate();
|
||||
NE_Material *Material = NE_MaterialCreate();
|
||||
|
||||
// Set coordinates for the camera
|
||||
NE_CameraSet(Camera,
|
||||
NE_CameraSet(Scene.Camera,
|
||||
-8, 3, 0, // Position
|
||||
0, 3, 0, // Look at
|
||||
0, 1, 0); // Up direction
|
||||
|
||||
// Load mesh from the filesystem and assign it to the object "Model".
|
||||
NE_ModelLoadStaticMeshFAT(Model, "robot.bin");
|
||||
NE_ModelLoadStaticMeshFAT(Scene.Model, "robot.bin");
|
||||
// Load a RGB texture from RAM and assign it to "Material".
|
||||
NE_MaterialTexLoadFAT(Material, NE_RGB5, 256, 256, NE_TEXGEN_TEXCOORD,
|
||||
NE_MaterialTexLoadFAT(Material, NE_A1RGB5, 256, 256, NE_TEXGEN_TEXCOORD,
|
||||
"texture.img.bin");
|
||||
|
||||
// Assign texture to model...
|
||||
NE_ModelSetMaterial(Model, Material);
|
||||
NE_ModelSetMaterial(Scene.Model, Material);
|
||||
|
||||
// We set up a light and its color
|
||||
NE_LightSet(0, NE_White, -0.5, -0.5, -0.5);
|
||||
@ -83,16 +86,16 @@ int main(void)
|
||||
|
||||
// Rotate model using the pad
|
||||
if (keys & KEY_UP)
|
||||
NE_ModelRotate(Model, 0, 0, -2);
|
||||
NE_ModelRotate(Scene.Model, 0, 0, -2);
|
||||
if (keys & KEY_DOWN)
|
||||
NE_ModelRotate(Model, 0, 0, 2);
|
||||
NE_ModelRotate(Scene.Model, 0, 0, 2);
|
||||
if (keys & KEY_RIGHT)
|
||||
NE_ModelRotate(Model, 0, 2, 0);
|
||||
NE_ModelRotate(Scene.Model, 0, 2, 0);
|
||||
if (keys & KEY_LEFT)
|
||||
NE_ModelRotate(Model, 0, -2, 0);
|
||||
NE_ModelRotate(Scene.Model, 0, -2, 0);
|
||||
|
||||
// Draw scene
|
||||
NE_Process(Draw3DScene);
|
||||
NE_ProcessArg(Draw3DScene, &Scene);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -3,4 +3,4 @@
|
||||
|
||||
NITROFSDIR := nitrofiles
|
||||
|
||||
include ../../Makefile.example.blocksds
|
||||
include ../../Makefile.example
|
@ -1,6 +0,0 @@
|
||||
# This is a minimal makefile only used for the examples. If you want a makefile
|
||||
# for your project, take one from the templates inside examples/templates.
|
||||
|
||||
NITROFSDIR := nitrofiles
|
||||
|
||||
include ../../Makefile.example.blocksds
|
@ -1,6 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
GRIT=/opt/blocksds/core/tools/grit/grit
|
||||
BLOCKSDS="${BLOCKSDS:-/opt/blocksds/core/}"
|
||||
GRIT=$BLOCKSDS/tools/grit/grit
|
||||
|
||||
rm -rf nitrofiles
|
||||
mkdir -p nitrofiles
|
||||
|
Binary file not shown.
Binary file not shown.
@ -10,25 +10,34 @@
|
||||
#include <filesystem.h>
|
||||
#include <NEMain.h>
|
||||
|
||||
NE_Material *Material1, *Material2;
|
||||
NE_Palette *Palette2;
|
||||
typedef struct {
|
||||
NE_Material *Material1;
|
||||
} SceneData1;
|
||||
|
||||
void Draw3DScene(void)
|
||||
typedef struct {
|
||||
NE_Material *Material2;
|
||||
} SceneData2;
|
||||
|
||||
void Draw3DScene(void *arg)
|
||||
{
|
||||
SceneData1 *Scene = arg;
|
||||
|
||||
NE_2DViewInit();
|
||||
|
||||
NE_2DDrawTexturedQuad(0, 0,
|
||||
256, 192,
|
||||
0, Material1);
|
||||
0, Scene->Material1);
|
||||
}
|
||||
|
||||
void Draw3DScene2(void)
|
||||
void Draw3DScene2(void *arg)
|
||||
{
|
||||
SceneData2 *Scene = arg;
|
||||
|
||||
NE_2DViewInit();
|
||||
|
||||
NE_2DDrawTexturedQuad(64, 32,
|
||||
64 + 128, 32 + 128,
|
||||
0, Material2);
|
||||
0, Scene->Material2);
|
||||
}
|
||||
|
||||
__attribute__((noreturn)) void WaitLoop(void)
|
||||
@ -43,8 +52,11 @@ __attribute__((noreturn)) void WaitLoop(void)
|
||||
}
|
||||
}
|
||||
|
||||
int main(void)
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
SceneData1 Scene1 = { 0 };
|
||||
SceneData2 Scene2 = { 0 };
|
||||
|
||||
irqEnable(IRQ_HBLANK);
|
||||
irqSet(IRQ_VBLANK, NE_VBLFunc);
|
||||
irqSet(IRQ_HBLANK, NE_HBLFunc);
|
||||
@ -62,18 +74,20 @@ int main(void)
|
||||
NE_InitConsole();
|
||||
|
||||
// Allocate objects
|
||||
Material1 = NE_MaterialCreate();
|
||||
Material2 = NE_MaterialCreate();
|
||||
Palette2 = NE_PaletteCreate();
|
||||
Scene1.Material1 = NE_MaterialCreate();
|
||||
Scene2.Material2 = NE_MaterialCreate();
|
||||
|
||||
if (NE_MaterialTexLoadGRF(Material1, NULL, NE_TEXGEN_TEXCOORD,
|
||||
if (NE_MaterialTexLoadGRF(Scene1.Material1, NULL, NE_TEXGEN_TEXCOORD,
|
||||
"a1rgb5_png.grf") == 0)
|
||||
{
|
||||
printf("Failed to load GRF 1\n");
|
||||
WaitLoop();
|
||||
}
|
||||
|
||||
if (NE_MaterialTexLoadGRF(Material2, Palette2, NE_TEXGEN_TEXCOORD,
|
||||
// This material has a palette, but we don't care about it. By setting the
|
||||
// pointer to NULL it will be marked to be autoedeleted when the material is
|
||||
// deleted.
|
||||
if (NE_MaterialTexLoadGRF(Scene2.Material2, NULL, NE_TEXGEN_TEXCOORD,
|
||||
"a3pal32_png.grf") == 0)
|
||||
{
|
||||
printf("Failed to load GRF 2\n");
|
||||
@ -84,7 +98,7 @@ int main(void)
|
||||
{
|
||||
NE_WaitForVBL(0);
|
||||
|
||||
NE_ProcessDual(Draw3DScene, Draw3DScene2);
|
||||
NE_ProcessDualArg(Draw3DScene, Draw3DScene2, &Scene1, &Scene2);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -1,220 +1,6 @@
|
||||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#---------------------------------------------------------------------------------
|
||||
# This is a minimal makefile only used for the examples. If you want a makefile
|
||||
# for your project, take one from the templates inside examples/templates.
|
||||
|
||||
ifeq ($(strip $(DEVKITARM)),)
|
||||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
||||
endif
|
||||
GFXDIRS := graphics
|
||||
|
||||
include $(DEVKITARM)/ds_rules
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# TARGET is the name of the output
|
||||
# BUILD is the directory where object files & intermediate files will be placed
|
||||
# SOURCES is a list of directories containing source code
|
||||
# INCLUDES is a list of directories containing extra header files
|
||||
# DATA is a list of directories containing binary files embedded using bin2o
|
||||
# GRAPHICS is a list of directories containing image files to be converted with grit
|
||||
# AUDIO is a list of directories containing audio to be converted by maxmod
|
||||
# ICON is the image used to create the game icon, leave blank to use default rule
|
||||
# NITRO is a directory that will be accessible via NitroFS
|
||||
#---------------------------------------------------------------------------------
|
||||
TARGET := $(shell basename $(CURDIR))
|
||||
BUILD := build
|
||||
SOURCES := source
|
||||
INCLUDES := include
|
||||
DATA :=
|
||||
GRAPHICS := graphics
|
||||
AUDIO :=
|
||||
ICON :=
|
||||
|
||||
# specify a directory which contains the nitro filesystem
|
||||
# this is relative to the Makefile
|
||||
NITRO :=
|
||||
|
||||
# These set the information text in the nds file
|
||||
GAME_TITLE := $(shell basename $(CURDIR))
|
||||
GAME_SUBTITLE1 := Nitro Engine example
|
||||
GAME_SUBTITLE2 := github.com/AntonioND/nitro-engine
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# options for code generation
|
||||
#---------------------------------------------------------------------------------
|
||||
ARCH := -marm -mthumb-interwork -march=armv5te -mtune=arm946e-s
|
||||
|
||||
CFLAGS := -g -Wall -O3\
|
||||
$(ARCH) $(INCLUDE) -DARM9
|
||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
|
||||
ASFLAGS := -g $(ARCH)
|
||||
LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# any extra libraries we wish to link with the project (order is important)
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBS := -lNE -lfat -lnds9
|
||||
|
||||
# automatigically add libraries for NitroFS
|
||||
ifneq ($(strip $(NITRO)),)
|
||||
LIBS := -lfilesystem -lfat $(LIBS)
|
||||
endif
|
||||
# automagically add maxmod library
|
||||
ifneq ($(strip $(AUDIO)),)
|
||||
LIBS := -lmm9 $(LIBS)
|
||||
endif
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# list of directories containing libraries, this must be the top level containing
|
||||
# include and lib
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nitro-engine
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# no real need to edit anything past this point unless you need to add additional
|
||||
# rules for different file extensions
|
||||
#---------------------------------------------------------------------------------
|
||||
ifneq ($(BUILD),$(notdir $(CURDIR)))
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
export OUTPUT := $(CURDIR)/$(TARGET)
|
||||
|
||||
export VPATH := $(CURDIR)/$(subst /,,$(dir $(ICON)))\
|
||||
$(foreach dir,$(SOURCES),$(CURDIR)/$(dir))\
|
||||
$(foreach dir,$(DATA),$(CURDIR)/$(dir))\
|
||||
$(foreach dir,$(GRAPHICS),$(CURDIR)/$(dir))
|
||||
|
||||
export DEPSDIR := $(CURDIR)/$(BUILD)
|
||||
|
||||
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
|
||||
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
|
||||
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
|
||||
PNGFILES := $(foreach dir,$(GRAPHICS),$(notdir $(wildcard $(dir)/*.png)))
|
||||
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
|
||||
|
||||
# prepare NitroFS directory
|
||||
ifneq ($(strip $(NITRO)),)
|
||||
export NITRO_FILES := $(CURDIR)/$(NITRO)
|
||||
endif
|
||||
|
||||
# get audio list for maxmod
|
||||
ifneq ($(strip $(AUDIO)),)
|
||||
export MODFILES := $(foreach dir,$(notdir $(wildcard $(AUDIO)/*.*)),$(CURDIR)/$(AUDIO)/$(dir))
|
||||
|
||||
# place the soundbank file in NitroFS if using it
|
||||
ifneq ($(strip $(NITRO)),)
|
||||
export SOUNDBANK := $(NITRO_FILES)/soundbank.bin
|
||||
|
||||
# otherwise, needs to be loaded from memory
|
||||
else
|
||||
export SOUNDBANK := soundbank.bin
|
||||
BINFILES += $(SOUNDBANK)
|
||||
endif
|
||||
endif
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# use CXX for linking C++ projects, CC for standard C
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(CPPFILES)),)
|
||||
#---------------------------------------------------------------------------------
|
||||
export LD := $(CC)
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
#---------------------------------------------------------------------------------
|
||||
export LD := $(CXX)
|
||||
#---------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
|
||||
|
||||
export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
|
||||
|
||||
export OFILES := $(PNGFILES:.png=.o) $(OFILES_BIN) $(OFILES_SOURCES)
|
||||
|
||||
export HFILES := $(PNGFILES:.png=.h) $(addsuffix .h,$(subst .,_,$(BINFILES)))
|
||||
|
||||
export INCLUDE := $(foreach dir,$(INCLUDES),-iquote $(CURDIR)/$(dir))\
|
||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include)\
|
||||
-I$(CURDIR)/$(BUILD)
|
||||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
|
||||
|
||||
ifeq ($(strip $(ICON)),)
|
||||
icons := $(wildcard *.bmp)
|
||||
|
||||
ifneq (,$(findstring $(TARGET).bmp,$(icons)))
|
||||
export GAME_ICON := $(CURDIR)/$(TARGET).bmp
|
||||
else
|
||||
ifneq (,$(findstring icon.bmp,$(icons)))
|
||||
export GAME_ICON := $(CURDIR)/icon.bmp
|
||||
endif
|
||||
endif
|
||||
else
|
||||
ifeq ($(suffix $(ICON)), .grf)
|
||||
export GAME_ICON := $(CURDIR)/$(ICON)
|
||||
else
|
||||
export GAME_ICON := $(CURDIR)/$(BUILD)/$(notdir $(basename $(ICON))).grf
|
||||
endif
|
||||
endif
|
||||
|
||||
.PHONY: $(BUILD) clean
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
$(BUILD):
|
||||
@mkdir -p $@
|
||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
clean:
|
||||
@echo clean ...
|
||||
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(SOUNDBANK)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# main targets
|
||||
#---------------------------------------------------------------------------------
|
||||
$(OUTPUT).nds: $(OUTPUT).elf $(GAME_ICON)
|
||||
$(OUTPUT).elf: $(OFILES)
|
||||
|
||||
# source files depend on generated headers
|
||||
$(OFILES_SOURCES) : $(HFILES)
|
||||
|
||||
# need to build soundbank first
|
||||
$(OFILES): $(SOUNDBANK)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# rule to build solution from music files
|
||||
#---------------------------------------------------------------------------------
|
||||
$(SOUNDBANK) : $(MODFILES)
|
||||
#---------------------------------------------------------------------------------
|
||||
mmutil $^ -d -o$@ -hsoundbank.h
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.bin.o %_bin.h : %.bin
|
||||
#---------------------------------------------------------------------------------
|
||||
@echo $(notdir $<)
|
||||
@$(bin2o)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# This rule creates assembly source files using grit
|
||||
# grit takes an image file and a .grit describing how the file is to be processed
|
||||
# add additional rules like this for each image extension
|
||||
# you use in the graphics folders
|
||||
#---------------------------------------------------------------------------------
|
||||
%.s %.h: %.png %.grit
|
||||
#---------------------------------------------------------------------------------
|
||||
grit $< -fts -o$*
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# Convert non-GRF game icon to GRF if needed
|
||||
#---------------------------------------------------------------------------------
|
||||
$(GAME_ICON): $(notdir $(ICON))
|
||||
#---------------------------------------------------------------------------------
|
||||
@echo convert $(notdir $<)
|
||||
@grit $< -g -gt -gB4 -gT FF00FF -m! -p -pe 16 -fh! -ftr
|
||||
|
||||
-include $(DEPSDIR)/*.d
|
||||
|
||||
#---------------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------------
|
||||
include ../../Makefile.example
|
||||
|
@ -1,6 +0,0 @@
|
||||
# This is a minimal makefile only used for the examples. If you want a makefile
|
||||
# for your project, take one from the templates inside examples/templates.
|
||||
|
||||
GFXDIRS := graphics
|
||||
|
||||
include ../../Makefile.example.blocksds
|
@ -1,17 +1,9 @@
|
||||
// SPDX-License-Identifier: CC0-1.0
|
||||
//
|
||||
// SPDX-FileContributor: Antonio Niño Díaz, 2008-2011, 2019, 2022
|
||||
// SPDX-FileContributor: Antonio Niño Díaz, 2008-2024
|
||||
//
|
||||
// This file is part of Nitro Engine
|
||||
|
||||
#include <NEMain.h>
|
||||
|
||||
#include "a3pal32.h"
|
||||
#include "pal4.h"
|
||||
|
||||
NE_Material *Material, *Material2;
|
||||
NE_Palette *Palette, *Palette2;
|
||||
|
||||
// This is an example to show how Nitro Engine can load textures of any height.
|
||||
// Internally, the NDS thinks that the texture is bigger, but Nitro Engine only
|
||||
// uses the parts that the user has loaded.
|
||||
@ -28,21 +20,34 @@ NE_Palette *Palette, *Palette2;
|
||||
// - They save space in the final ROM, but you can achieve the same effect
|
||||
// compressing them with LZSS compression, for example.
|
||||
|
||||
void Draw3DScene(void)
|
||||
#include <NEMain.h>
|
||||
|
||||
#include "a3pal32.h"
|
||||
#include "pal4.h"
|
||||
|
||||
typedef struct {
|
||||
NE_Material *Material, *Material2;
|
||||
} SceneData;
|
||||
|
||||
void Draw3DScene(void *arg)
|
||||
{
|
||||
SceneData *Scene = arg;
|
||||
|
||||
NE_2DViewInit();
|
||||
|
||||
NE_2DDrawTexturedQuad(40, 10,
|
||||
40 + 32, 10 + 100,
|
||||
0, Material);
|
||||
0, Scene->Material);
|
||||
|
||||
NE_2DDrawTexturedQuad(128, 10,
|
||||
128 + 64, 10 + 100,
|
||||
0, Material2);
|
||||
0, Scene->Material2);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
SceneData Scene = { 0 };
|
||||
|
||||
irqEnable(IRQ_HBLANK);
|
||||
irqSet(IRQ_VBLANK, NE_VBLFunc);
|
||||
irqSet(IRQ_HBLANK, NE_HBLFunc);
|
||||
@ -51,31 +56,31 @@ int main(void)
|
||||
NE_Init3D();
|
||||
|
||||
// Allocate objects for a material
|
||||
Material = NE_MaterialCreate();
|
||||
Palette = NE_PaletteCreate();
|
||||
Scene.Material = NE_MaterialCreate();
|
||||
NE_Palette *Palette = NE_PaletteCreate();
|
||||
|
||||
NE_MaterialTexLoad(Material,
|
||||
NE_MaterialTexLoad(Scene.Material,
|
||||
NE_A3PAL32, // Texture type
|
||||
64, 200, // Width, height (in pixels)
|
||||
NE_TEXGEN_TEXCOORD, a3pal32Bitmap);
|
||||
NE_PaletteLoad(Palette, a3pal32Pal, 32, NE_A3PAL32);
|
||||
NE_MaterialSetPalette(Material, Palette);
|
||||
NE_MaterialSetPalette(Scene.Material, Palette);
|
||||
|
||||
// Allocate objects for another material
|
||||
Material2 = NE_MaterialCreate();
|
||||
Palette2 = NE_PaletteCreate();
|
||||
Scene.Material2 = NE_MaterialCreate();
|
||||
NE_Palette *Palette2 = NE_PaletteCreate();
|
||||
|
||||
NE_MaterialTexLoad(Material2, NE_PAL4, 64, 100, NE_TEXGEN_TEXCOORD,
|
||||
NE_MaterialTexLoad(Scene.Material2, NE_PAL4, 64, 100, NE_TEXGEN_TEXCOORD,
|
||||
pal4Bitmap);
|
||||
NE_PaletteLoad(Palette2, pal4Pal, 4, NE_PAL4);
|
||||
NE_MaterialSetPalette(Material2, Palette2);
|
||||
NE_MaterialSetPalette(Scene.Material2, Palette2);
|
||||
|
||||
while (1)
|
||||
{
|
||||
NE_WaitForVBL(0);
|
||||
|
||||
// Draw 3D scene
|
||||
NE_Process(Draw3DScene);
|
||||
NE_ProcessArg(Draw3DScene, &Scene);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -1,220 +1,7 @@
|
||||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#---------------------------------------------------------------------------------
|
||||
# This is a minimal makefile only used for the examples. If you want a makefile
|
||||
# for your project, take one from the templates inside examples/templates.
|
||||
|
||||
ifeq ($(strip $(DEVKITARM)),)
|
||||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
||||
endif
|
||||
BINDIRS := data
|
||||
GFXDIRS := graphics
|
||||
|
||||
include $(DEVKITARM)/ds_rules
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# TARGET is the name of the output
|
||||
# BUILD is the directory where object files & intermediate files will be placed
|
||||
# SOURCES is a list of directories containing source code
|
||||
# INCLUDES is a list of directories containing extra header files
|
||||
# DATA is a list of directories containing binary files embedded using bin2o
|
||||
# GRAPHICS is a list of directories containing image files to be converted with grit
|
||||
# AUDIO is a list of directories containing audio to be converted by maxmod
|
||||
# ICON is the image used to create the game icon, leave blank to use default rule
|
||||
# NITRO is a directory that will be accessible via NitroFS
|
||||
#---------------------------------------------------------------------------------
|
||||
TARGET := $(shell basename $(CURDIR))
|
||||
BUILD := build
|
||||
SOURCES := source
|
||||
INCLUDES := include
|
||||
DATA := data
|
||||
GRAPHICS := graphics
|
||||
AUDIO :=
|
||||
ICON :=
|
||||
|
||||
# specify a directory which contains the nitro filesystem
|
||||
# this is relative to the Makefile
|
||||
NITRO :=
|
||||
|
||||
# These set the information text in the nds file
|
||||
GAME_TITLE := $(shell basename $(CURDIR))
|
||||
GAME_SUBTITLE1 := Nitro Engine example
|
||||
GAME_SUBTITLE2 := github.com/AntonioND/nitro-engine
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# options for code generation
|
||||
#---------------------------------------------------------------------------------
|
||||
ARCH := -marm -mthumb-interwork -march=armv5te -mtune=arm946e-s
|
||||
|
||||
CFLAGS := -g -Wall -O3\
|
||||
$(ARCH) $(INCLUDE) -DARM9
|
||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
|
||||
ASFLAGS := -g $(ARCH)
|
||||
LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# any extra libraries we wish to link with the project (order is important)
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBS := -lNE -lfat -lnds9
|
||||
|
||||
# automatigically add libraries for NitroFS
|
||||
ifneq ($(strip $(NITRO)),)
|
||||
LIBS := -lfilesystem -lfat $(LIBS)
|
||||
endif
|
||||
# automagically add maxmod library
|
||||
ifneq ($(strip $(AUDIO)),)
|
||||
LIBS := -lmm9 $(LIBS)
|
||||
endif
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# list of directories containing libraries, this must be the top level containing
|
||||
# include and lib
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nitro-engine
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# no real need to edit anything past this point unless you need to add additional
|
||||
# rules for different file extensions
|
||||
#---------------------------------------------------------------------------------
|
||||
ifneq ($(BUILD),$(notdir $(CURDIR)))
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
export OUTPUT := $(CURDIR)/$(TARGET)
|
||||
|
||||
export VPATH := $(CURDIR)/$(subst /,,$(dir $(ICON)))\
|
||||
$(foreach dir,$(SOURCES),$(CURDIR)/$(dir))\
|
||||
$(foreach dir,$(DATA),$(CURDIR)/$(dir))\
|
||||
$(foreach dir,$(GRAPHICS),$(CURDIR)/$(dir))
|
||||
|
||||
export DEPSDIR := $(CURDIR)/$(BUILD)
|
||||
|
||||
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
|
||||
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
|
||||
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
|
||||
PNGFILES := $(foreach dir,$(GRAPHICS),$(notdir $(wildcard $(dir)/*.png)))
|
||||
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
|
||||
|
||||
# prepare NitroFS directory
|
||||
ifneq ($(strip $(NITRO)),)
|
||||
export NITRO_FILES := $(CURDIR)/$(NITRO)
|
||||
endif
|
||||
|
||||
# get audio list for maxmod
|
||||
ifneq ($(strip $(AUDIO)),)
|
||||
export MODFILES := $(foreach dir,$(notdir $(wildcard $(AUDIO)/*.*)),$(CURDIR)/$(AUDIO)/$(dir))
|
||||
|
||||
# place the soundbank file in NitroFS if using it
|
||||
ifneq ($(strip $(NITRO)),)
|
||||
export SOUNDBANK := $(NITRO_FILES)/soundbank.bin
|
||||
|
||||
# otherwise, needs to be loaded from memory
|
||||
else
|
||||
export SOUNDBANK := soundbank.bin
|
||||
BINFILES += $(SOUNDBANK)
|
||||
endif
|
||||
endif
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# use CXX for linking C++ projects, CC for standard C
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(CPPFILES)),)
|
||||
#---------------------------------------------------------------------------------
|
||||
export LD := $(CC)
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
#---------------------------------------------------------------------------------
|
||||
export LD := $(CXX)
|
||||
#---------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
|
||||
|
||||
export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
|
||||
|
||||
export OFILES := $(PNGFILES:.png=.o) $(OFILES_BIN) $(OFILES_SOURCES)
|
||||
|
||||
export HFILES := $(PNGFILES:.png=.h) $(addsuffix .h,$(subst .,_,$(BINFILES)))
|
||||
|
||||
export INCLUDE := $(foreach dir,$(INCLUDES),-iquote $(CURDIR)/$(dir))\
|
||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include)\
|
||||
-I$(CURDIR)/$(BUILD)
|
||||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
|
||||
|
||||
ifeq ($(strip $(ICON)),)
|
||||
icons := $(wildcard *.bmp)
|
||||
|
||||
ifneq (,$(findstring $(TARGET).bmp,$(icons)))
|
||||
export GAME_ICON := $(CURDIR)/$(TARGET).bmp
|
||||
else
|
||||
ifneq (,$(findstring icon.bmp,$(icons)))
|
||||
export GAME_ICON := $(CURDIR)/icon.bmp
|
||||
endif
|
||||
endif
|
||||
else
|
||||
ifeq ($(suffix $(ICON)), .grf)
|
||||
export GAME_ICON := $(CURDIR)/$(ICON)
|
||||
else
|
||||
export GAME_ICON := $(CURDIR)/$(BUILD)/$(notdir $(basename $(ICON))).grf
|
||||
endif
|
||||
endif
|
||||
|
||||
.PHONY: $(BUILD) clean
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
$(BUILD):
|
||||
@mkdir -p $@
|
||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
clean:
|
||||
@echo clean ...
|
||||
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(SOUNDBANK)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# main targets
|
||||
#---------------------------------------------------------------------------------
|
||||
$(OUTPUT).nds: $(OUTPUT).elf $(GAME_ICON)
|
||||
$(OUTPUT).elf: $(OFILES)
|
||||
|
||||
# source files depend on generated headers
|
||||
$(OFILES_SOURCES) : $(HFILES)
|
||||
|
||||
# need to build soundbank first
|
||||
$(OFILES): $(SOUNDBANK)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# rule to build solution from music files
|
||||
#---------------------------------------------------------------------------------
|
||||
$(SOUNDBANK) : $(MODFILES)
|
||||
#---------------------------------------------------------------------------------
|
||||
mmutil $^ -d -o$@ -hsoundbank.h
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.bin.o %_bin.h : %.bin
|
||||
#---------------------------------------------------------------------------------
|
||||
@echo $(notdir $<)
|
||||
@$(bin2o)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# This rule creates assembly source files using grit
|
||||
# grit takes an image file and a .grit describing how the file is to be processed
|
||||
# add additional rules like this for each image extension
|
||||
# you use in the graphics folders
|
||||
#---------------------------------------------------------------------------------
|
||||
%.s %.h: %.png %.grit
|
||||
#---------------------------------------------------------------------------------
|
||||
grit $< -fts -o$*
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# Convert non-GRF game icon to GRF if needed
|
||||
#---------------------------------------------------------------------------------
|
||||
$(GAME_ICON): $(notdir $(ICON))
|
||||
#---------------------------------------------------------------------------------
|
||||
@echo convert $(notdir $<)
|
||||
@grit $< -g -gt -gB4 -gT FF00FF -m! -p -pe 16 -fh! -ftr
|
||||
|
||||
-include $(DEPSDIR)/*.d
|
||||
|
||||
#---------------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------------
|
||||
include ../../Makefile.example
|
||||
|
@ -1,7 +0,0 @@
|
||||
# This is a minimal makefile only used for the examples. If you want a makefile
|
||||
# for your project, take one from the templates inside examples/templates.
|
||||
|
||||
BINDIRS := data
|
||||
GFXDIRS := graphics
|
||||
|
||||
include ../../Makefile.example.blocksds
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user