examples: Migrate 2D examples to grit

This commit is contained in:
Antonio Niño Díaz 2024-01-26 02:49:59 +00:00
parent 1d0b3058aa
commit c8324ca1b9
57 changed files with 60 additions and 141 deletions

View File

@ -23,8 +23,8 @@ TARGET := $(shell basename $(CURDIR))
BUILD := build
SOURCES := source
INCLUDES := include
DATA := data
GRAPHICS :=
DATA :=
GRAPHICS := graphics
AUDIO :=
ICON :=

View File

@ -1,3 +1,3 @@
BINDIRS := data
GFXDIRS := graphics
include ../../Makefile.example.blocksds

View File

@ -1,25 +0,0 @@
#!/bin/sh
NITRO_ENGINE=$DEVKITPRO/nitro-engine
TOOLS=$NITRO_ENGINE/tools
IMG2DS=$TOOLS/img2ds/img2ds.py
mkdir -p data
python3 $IMG2DS \
--input assets/button.png \
--name button \
--output data \
--format PAL256
python3 $IMG2DS \
--input assets/empty.png \
--name empty \
--output data \
--format PAL256
python3 $IMG2DS \
--input assets/true.png \
--name true \
--output data \
--format PAL256

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 678 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 882 B

View File

@ -0,0 +1,2 @@
# 256 color palette
-gx -gb -gB8 -gTFF00FF

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

@ -0,0 +1,2 @@
# 256 color palette
-gx -gb -gB8 -gTFF00FF

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

View File

@ -0,0 +1,2 @@
# 256 color palette
-gx -gb -gB8 -gTFF00FF

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

View File

@ -6,12 +6,9 @@
#include <NEMain.h>
#include "button_tex_bin.h"
#include "button_pal_bin.h"
#include "empty_tex_bin.h"
#include "empty_pal_bin.h"
#include "true_tex_bin.h"
#include "true_pal_bin.h"
#include "button.h"
#include "empty.h"
#include "true.h"
void Draw3DScene(void)
{
@ -50,20 +47,20 @@ int main(void)
NE_MaterialTexLoad(ButtonImg, NE_PAL256, 64, 64,
NE_TEXGEN_TEXCOORD | NE_TEXTURE_COLOR0_TRANSPARENT,
(void *)button_tex_bin);
NE_PaletteLoad(ButtonPal, (void *)button_pal_bin, 256, NE_PAL256);
buttonBitmap);
NE_PaletteLoad(ButtonPal, buttonPal, 256, NE_PAL256);
NE_MaterialSetPalette(ButtonImg, ButtonPal);
NE_MaterialTexLoad(EmptyImg, NE_PAL256, 64, 64,
NE_TEXGEN_TEXCOORD | NE_TEXTURE_COLOR0_TRANSPARENT,
(void *)empty_tex_bin);
NE_PaletteLoad(EmptyPal, (void *)empty_pal_bin, 256, NE_PAL256);
emptyBitmap);
NE_PaletteLoad(EmptyPal, emptyPal, 256, NE_PAL256);
NE_MaterialSetPalette(EmptyImg, EmptyPal);
NE_MaterialTexLoad(TrueImg, NE_PAL256, 64, 64,
NE_TEXGEN_TEXCOORD | NE_TEXTURE_COLOR0_TRANSPARENT,
(void *)true_tex_bin);
NE_PaletteLoad(TruePal, (void *)true_pal_bin, 256, NE_PAL256);
trueBitmap);
NE_PaletteLoad(TruePal, truePal, 256, NE_PAL256);
NE_MaterialSetPalette(TrueImg, TruePal);

View File

@ -23,8 +23,8 @@ TARGET := $(shell basename $(CURDIR))
BUILD := build
SOURCES := source
INCLUDES := include
DATA := data
GRAPHICS :=
DATA :=
GRAPHICS := graphics
AUDIO :=
ICON :=

View File

@ -1,3 +1,3 @@
BINDIRS := data
GFXDIRS := graphics
include ../../Makefile.example.blocksds

View File

@ -1,31 +0,0 @@
#!/bin/sh
NITRO_ENGINE=$DEVKITPRO/nitro-engine
TOOLS=$NITRO_ENGINE/tools
IMG2DS=$TOOLS/img2ds/img2ds.py
mkdir -p data
python3 $IMG2DS \
--input assets/s8.png \
--name s8 \
--output data \
--format PAL16
python3 $IMG2DS \
--input assets/s16.png \
--name s16 \
--output data \
--format PAL16
python3 $IMG2DS \
--input assets/s64.png \
--name s64 \
--output data \
--format PAL16
python3 $IMG2DS \
--input assets/s256.png \
--name s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eA6eA6eA6eA6eA6eA6eA&`A&`A&`A&`A&`A&`A&`A&`Ae6Ae6Ae6Ae6Ae6Ae6Ae6Ae6!DD!DD!DD!DD!DD!DD!DD!DD11111111!!!!!!!!1DD1DD1DD1DD1DD1DD1DD1DDA`&A`&A`&A`&A`&A`&A`&A`&A6eA6eA6eA6eA6eA6eA6eA6eA&`A&`A&`A&`A&`A&`A&`A&`Ae6Ae6Ae6Ae6Ae6Ae6Ae6Ae6!DD!DD!DD!DD!DD!DD!DD!DD11111111!!!!!!!!1DD1DD1DD1DD1DD1DD1DD1DDA`&A`&A`&A`&A`&A`&A`&A`&A6eA6eA6eA6eA6eA6eA6eA6eA&`A&`A&`A&`A&`A&`A&`A&`Ae6Ae6Ae6Ae6Ae6Ae6Ae6Ae6!DD!DD!DD!DD!DD!DD!DD!DD11111111

View File

@ -1 +0,0 @@
!1DDA`&A6eA&`Ae6!DD1

View File

@ -0,0 +1,2 @@
# 16 color palette
-gx -gb -gB4 -gTFF00FF

View File

Before

Width:  |  Height:  |  Size: 606 B

After

Width:  |  Height:  |  Size: 606 B

View File

@ -0,0 +1,2 @@
# 16 color palette
-gx -gb -gB4 -gTFF00FF

View File

Before

Width:  |  Height:  |  Size: 6.8 KiB

After

Width:  |  Height:  |  Size: 6.8 KiB

View File

@ -0,0 +1,2 @@
# 16 color palette
-gx -gb -gB4 -gTFF00FF

View File

Before

Width:  |  Height:  |  Size: 678 B

After

Width:  |  Height:  |  Size: 678 B

View File

@ -0,0 +1,2 @@
# 16 color palette
-gx -gb -gB4 -gTFF00FF

View File

Before

Width:  |  Height:  |  Size: 583 B

After

Width:  |  Height:  |  Size: 583 B

View File

@ -13,14 +13,10 @@
#include <NEMain.h>
#include "s8_tex_bin.h"
#include "s8_pal_bin.h"
#include "s16_tex_bin.h"
#include "s16_pal_bin.h"
#include "s64_tex_bin.h"
#include "s64_pal_bin.h"
#include "s256_tex_bin.h"
#include "s256_pal_bin.h"
#include "s8.h"
#include "s16.h"
#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;
@ -85,21 +81,21 @@ int main(void)
NE_MaterialTexLoad(Material_s8, NE_PAL16, 8, 8,
NE_TEXGEN_TEXCOORD | NE_TEXTURE_WRAP_S | NE_TEXTURE_WRAP_T,
(void *)s8_tex_bin);
s8Bitmap);
NE_MaterialTexLoad(Material_s16, NE_PAL16, 16, 16,
NE_TEXGEN_TEXCOORD | NE_TEXTURE_WRAP_S | NE_TEXTURE_WRAP_T,
(void *)s16_tex_bin);
s16Bitmap);
NE_MaterialTexLoad(Material_s64, NE_PAL16, 64, 64,
NE_TEXGEN_TEXCOORD | NE_TEXTURE_WRAP_S | NE_TEXTURE_WRAP_T,
(void *)s64_tex_bin);
s64Bitmap);
NE_MaterialTexLoad(Material_s256, NE_PAL16, 256, 256,
NE_TEXGEN_TEXCOORD | NE_TEXTURE_WRAP_S | NE_TEXTURE_WRAP_T,
(void *)s256_tex_bin);
s256Bitmap);
NE_PaletteLoad(Palette_s8, (u16 *)s8_pal_bin, 16, NE_PAL16);
NE_PaletteLoad(Palette_s16, (u16 *)s16_pal_bin, 16, NE_PAL16);
NE_PaletteLoad(Palette_s64, (u16 *)s64_pal_bin, 16, NE_PAL16);
NE_PaletteLoad(Palette_s256, (u16 *)s256_pal_bin, 16, NE_PAL16);
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_MaterialSetPalette(Material_s8, Palette_s8);
NE_MaterialSetPalette(Material_s16, Palette_s16);

View File

@ -23,8 +23,8 @@ TARGET := $(shell basename $(CURDIR))
BUILD := build
SOURCES := source
INCLUDES := include
DATA := data
GRAPHICS :=
DATA :=
GRAPHICS := graphics
AUDIO :=
ICON :=

View File

@ -1,3 +1,3 @@
BINDIRS := data
GFXDIRS := graphics
include ../../Makefile.example.blocksds

View File

@ -1,13 +0,0 @@
#!/bin/sh
NITRO_ENGINE=$DEVKITPRO/nitro-engine
TOOLS=$NITRO_ENGINE/tools
IMG2DS=$TOOLS/img2ds/img2ds.py
mkdir -p data
python3 $IMG2DS \
--input assets/icon.png \
--name icon \
--output data \
--format PAL16

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,2 @@
# 16 color palette
-gx -gb -gB4 -gTFF00FF

View File

Before

Width:  |  Height:  |  Size: 796 B

After

Width:  |  Height:  |  Size: 796 B

View File

@ -6,8 +6,7 @@
#include <NEMain.h>
#include "icon_tex_bin.h"
#include "icon_pal_bin.h"
#include "icon.h"
NE_Material *Material;
NE_Palette *Palette;
@ -32,8 +31,8 @@ int main(void)
Palette = NE_PaletteCreate();
NE_MaterialTexLoad(Material, NE_PAL16, 128, 128, NE_TEXGEN_TEXCOORD,
(void *)icon_tex_bin);
NE_PaletteLoad(Palette, (void *)icon_pal_bin, 32, NE_PAL16);
iconBitmap);
NE_PaletteLoad(Palette, iconPal, 32, NE_PAL16);
NE_MaterialSetPalette(Material, Palette);

View File

@ -23,8 +23,8 @@ TARGET := $(shell basename $(CURDIR))
BUILD := build
SOURCES := source
INCLUDES := include
DATA := data
GRAPHICS :=
DATA :=
GRAPHICS := graphics
AUDIO :=
ICON :=

View File

@ -1,3 +1,3 @@
BINDIRS := data
GFXDIRS := graphics
include ../../Makefile.example.blocksds

View File

@ -1,19 +0,0 @@
#!/bin/sh
NITRO_ENGINE=$DEVKITPRO/nitro-engine
TOOLS=$NITRO_ENGINE/tools
IMG2DS=$TOOLS/img2ds/img2ds.py
mkdir -p data
python3 $IMG2DS \
--input assets/text.png \
--name text \
--output data \
--format A1RGB5
python3 $IMG2DS \
--input assets/text2.png \
--name text2 \
--output data \
--format A1RGB5

View File

@ -0,0 +1,2 @@
# 16 bit texture
-gx -gb -gB16 -gT000000

View File

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -0,0 +1,2 @@
# 16 bit texture
-gx -gb -gB16 -gT000000

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -6,8 +6,8 @@
#include <NEMain.h>
#include "text_tex_bin.h"
#include "text2_tex_bin.h"
#include "text.h"
#include "text2.h"
NE_Material *Text, *Text2;
@ -61,9 +61,9 @@ int main(void)
Text = NE_MaterialCreate();
Text2 = NE_MaterialCreate();
NE_MaterialTexLoad(Text, NE_A1RGB5, 256, 64, NE_TEXGEN_TEXCOORD,
(void *)text_tex_bin);
textBitmap);
NE_MaterialTexLoad(Text2, NE_A1RGB5, 512, 128, NE_TEXGEN_TEXCOORD,
(void *)text2_tex_bin);
text2Bitmap);
NE_TextInit(0, // Font slot
Text, // Image