Skip to content

Commit 569524c

Browse files
committed
add gl2d example code
1 parent 7ee2af5 commit 569524c

83 files changed

Lines changed: 5146 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<Project name="2Dplus3D"><MagicFolder excludeFolders="CVS;.svn" filter="*" name="2Dplus3D" path=""><MagicFolder excludeFolders="CVS;.svn" filter="*" name="build" path="build\"><File path="2Dplus3D.map"></File><File path="cearn_atan.d"></File><File path="cearn_atan.o"></File><File path="Cvertexbuffer.d"></File><File path="Cvertexbuffer.o"></File><File path="enemies.d"></File><File path="enemies.h"></File><File path="enemies.o"></File><File path="enemies.s"></File><File path="flyer.d"></File><File path="flyer.h"></File><File path="flyer.o"></File><File path="flyer.s"></File><File path="main.d"></File><File path="main.o"></File><File path="organ16.d"></File><File path="organ16.h"></File><File path="organ16.o"></File><File path="organ16.s"></File><File path="shuttle.d"></File><File path="shuttle.h"></File><File path="shuttle.o"></File><File path="shuttle.s"></File></MagicFolder><MagicFolder excludeFolders="CVS;.svn" filter="*" name="gfx" path="gfx\"><File path="enemies.bmp"></File><File path="enemies.grit"></File><File path="flyer.grit"></File><File path="flyer.png"></File><File path="organ16.bmp"></File><File path="organ16.grit"></File><File path="shuttle.grit"></File><File path="shuttle.png"></File><File path="Thumbs.db"></File></MagicFolder><MagicFolder excludeFolders="CVS;.svn" filter="*" name="source" path="source\"><File path="cearn_atan.cpp"></File><File path="cearn_atan.h"></File><File path="Cvertexbuffer.cpp"></File><File path="Cvertexbuffer.h"></File><File path="main.cpp"></File><File path="uvcoord_enemies.h"></File></MagicFolder><File path="2Dplus3D.elf"></File><File path="2Dplus3D.nds"></File><File path="2Dplus3D.pnproj"></File><File path="2Dplus3D.pnps"></File><File path="Makefile"></File><File path="readme_2Dplus2D.txt"></File></MagicFolder></Project>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<pd><ViewState><e p="2Dplus3D" x="true"></e><e p="2Dplus3D\2Dplus3D" x="true"></e><e p="2Dplus3D\2Dplus3D\build" x="false"></e><e p="2Dplus3D\2Dplus3D\gfx" x="false"></e><e p="2Dplus3D\2Dplus3D\source" x="true"></e></ViewState></pd>

Graphics/gl2d/2Dplus3D/Makefile

Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
#---------------------------------------------------------------------------------
2+
.SUFFIXES:
3+
#---------------------------------------------------------------------------------
4+
5+
ifeq ($(strip $(DEVKITARM)),)
6+
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
7+
endif
8+
9+
include $(DEVKITARM)/ds_rules
10+
11+
#---------------------------------------------------------------------------------
12+
# TARGET is the name of the output
13+
# BUILD is the directory where object files & intermediate files will be placed
14+
# SOURCES is a list of directories containing source code
15+
# INCLUDES is a list of directories containing extra header files
16+
# DATA is a list of directories containing binary data
17+
# GRAPHICS is a list of directories containing files to be processed by grit
18+
#
19+
# All directories are specified relative to the project directory where
20+
# the makefile is found
21+
#
22+
#---------------------------------------------------------------------------------
23+
TARGET := $(notdir $(CURDIR))
24+
BUILD := build
25+
SOURCES := source
26+
DATA := data
27+
INCLUDES := include
28+
GRAPHICS := gfx
29+
30+
#---------------------------------------------------------------------------------
31+
# options for code generation
32+
#---------------------------------------------------------------------------------
33+
ARCH := -mthumb -mthumb-interwork
34+
35+
CFLAGS := -g -Wall -O2\
36+
-march=armv5te -mtune=arm946e-s \
37+
$(ARCH)
38+
39+
CFLAGS += $(INCLUDE) -DARM9
40+
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
41+
42+
ASFLAGS := -g $(ARCH)
43+
LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
44+
45+
#---------------------------------------------------------------------------------
46+
# any extra libraries we wish to link with the project
47+
#---------------------------------------------------------------------------------
48+
LIBS := -lnds9
49+
50+
51+
#---------------------------------------------------------------------------------
52+
# list of directories containing libraries, this must be the top level containing
53+
# include and lib
54+
#---------------------------------------------------------------------------------
55+
LIBDIRS := $(LIBNDS)
56+
57+
#---------------------------------------------------------------------------------
58+
# no real need to edit anything past this point unless you need to add additional
59+
# rules for different file extensions
60+
#---------------------------------------------------------------------------------
61+
62+
63+
ifneq ($(BUILDDIR), $(CURDIR))
64+
#---------------------------------------------------------------------------------
65+
66+
export OUTPUT := $(CURDIR)/$(TARGET)
67+
68+
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
69+
$(foreach dir,$(DATA),$(CURDIR)/$(dir)) \
70+
$(foreach dir,$(GRAPHICS),$(CURDIR)/$(dir))
71+
72+
export DEPSDIR := $(CURDIR)/$(BUILD)
73+
74+
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
75+
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
76+
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
77+
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
78+
BMPFILES := $(foreach dir,$(GRAPHICS),$(notdir $(wildcard $(dir)/*.bmp)))
79+
PNGFILES := $(foreach dir,$(GRAPHICS),$(notdir $(wildcard $(dir)/*.png)))
80+
81+
#---------------------------------------------------------------------------------
82+
# use CXX for linking C++ projects, CC for standard C
83+
#---------------------------------------------------------------------------------
84+
ifeq ($(strip $(CPPFILES)),)
85+
#---------------------------------------------------------------------------------
86+
export LD := $(CC)
87+
#---------------------------------------------------------------------------------
88+
else
89+
#---------------------------------------------------------------------------------
90+
export LD := $(CXX)
91+
#---------------------------------------------------------------------------------
92+
endif
93+
#---------------------------------------------------------------------------------
94+
95+
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
96+
97+
export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
98+
99+
export OFILES := $(PNGFILES:.png=.o) $(BMPFILES:.bmp=.o) $(OFILES_BIN) $(OFILES_SOURCES)
100+
101+
export HFILES := $(PNGFILES:.png=.h) $(BMPFILES:.bmp=.h) $(addsuffix .h,$(subst .,_,$(BINFILES)))
102+
103+
export INCLUDE := $(foreach dir,$(INCLUDES),-iquote $(CURDIR)/$(dir)) \
104+
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
105+
-I$(CURDIR)/$(BUILD)
106+
107+
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
108+
109+
.PHONY: $(BUILD) clean
110+
111+
#---------------------------------------------------------------------------------
112+
$(BUILD):
113+
@[ -d $@ ] || mkdir -p $@
114+
@make BUILDDIR=`cd $(BUILD) && pwd` --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
115+
116+
#---------------------------------------------------------------------------------
117+
clean:
118+
@echo clean ...
119+
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds
120+
121+
122+
#---------------------------------------------------------------------------------
123+
else
124+
125+
DEPENDS := $(OFILES:.o=.d)
126+
127+
#---------------------------------------------------------------------------------
128+
# main targets
129+
#---------------------------------------------------------------------------------
130+
$(OUTPUT).nds : $(OUTPUT).elf
131+
$(OUTPUT).elf : $(OFILES)
132+
133+
134+
#---------------------------------------------------------------------------------
135+
# The bin2o rule should be copied and modified
136+
# for each extension used in the data directories
137+
#---------------------------------------------------------------------------------
138+
139+
#---------------------------------------------------------------------------------
140+
%.bin.o %_bin.h : %.bin
141+
#---------------------------------------------------------------------------------
142+
@echo $(notdir $<)
143+
@$(bin2o)
144+
145+
#---------------------------------------------------------------------------------
146+
# This rule creates assembly source files using grit
147+
# grit takes an image file and a .grit describing how the file is to be processed
148+
# add additional rules like this for each image extension
149+
# you use in the graphics folders
150+
#---------------------------------------------------------------------------------
151+
%.s %.h : %.bmp %.grit
152+
#---------------------------------------------------------------------------------
153+
grit $< -fts -o$*
154+
155+
#---------------------------------------------------------------------------------
156+
%.s %.h : %.png %.grit
157+
#---------------------------------------------------------------------------------
158+
grit $< -fts -o$*
159+
160+
161+
-include $(DEPENDS)
162+
163+
#---------------------------------------------------------------------------------------
164+
endif
165+
#---------------------------------------------------------------------------------------
24 KB
Binary file not shown.
65.1 KB
Binary file not shown.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Set the warning/log level to 3
2+
-W3
3+
4+
#bitmap mode
5+
-gb
6+
7+
# Set the bit depth to 8 (256 colors)
8+
-gB8
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Set the warning/log level to 3
2+
-W3
3+
4+
#bitmap mode
5+
-gb
6+
7+
# Set the bit depth to 4 (16 colors)
8+
-gB4
9+
10+
#include pal
11+
-p
485 Bytes
Loading
32.1 KB
Binary file not shown.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Set the warning/log level to 3
2+
-W3
3+
4+
#bitmap mode
5+
-gb
6+
7+
# Set the bit depth to 16
8+
-gB16

0 commit comments

Comments
 (0)