Homebrew SpriteTools 1.1.1 - SF2D Extension

BtheDestroyer

Member
OP
Newcomer
Joined
Apr 1, 2016
Messages
16
Trophies
0
Age
26
XP
124
Country
United States
Notice
SpriteTools has been rewritten so this post is now outdated! Please check out this thread for new information: https://gbatemp.net/threads/spritetools-a-3ds-development-library-aimed-at-be.465146/

What is SpriteTools?
In short, SpriteTools is a C header that works on top of sf2d to add some powerful tools for rendering sprites on screen.
As of 1.1.1, it adds:

  • Animations with spritesheets
  • Entities that can be rendered and controlled with one function
  • Cameras that can be used to modify how entities are rendered in various ways
Here's a video showcasing what it can do with only 74 lines of code in v1.1:


What's to come:
  • Rooms that store cameras and entities so you can store them together for easier switching
  • 3D rotation of entities utilizing zooming
Most recent update:
For the few wondering, this project is *not* dead, I was just taking a little break. I'm currently adding rooms which store entities (up to 1024), cameras (up to 16), and a background (animation) meaning you can create different rooms for each area (inside a town, floors of a building, rooms of a dungeon, etc.) and then switch the current room rather than switching everything separately and having to keep track.

I've also added collision detection (not implemented in the movement function yet) and will probably add a structure for collision fields as well.

Lastly, you will be able to set a room's default state, so that whenever the player leaves and reenters (or otherwise reloads the room) it will set all of its entities and cameras to the default setting rather than picking up where you left off. This is useful for something like a dungeon in Zelda, where all the enemies respawn when you exit and reenter a room.

Where can I get it?

Here's a link to the Github page.


Here's a link to the releases page.

Here's a link to the tutorial I wrote. It's geared at beginners, so you should be good to go even if you haven't programmed much in the past

If you have curl, you can add this line to your makefile (or just run the command without the @) to automatically download the latest commit to your /include/ folder:

Master branch (fully tested)
Code:
@curl https://raw.githubusercontent.com/BtheDestroyer/SpriteTools/master/spritetools.h  > include/spritetools.h

Gold branch (Not yet tested, may contain some bugs)
Code:
@curl https://raw.githubusercontent.com/BtheDestroyer/SpriteTools/Gold/spritetools.h  > include/spritetools.h
 
Last edited by BtheDestroyer,

BtheDestroyer

Member
OP
Newcomer
Joined
Apr 1, 2016
Messages
16
Trophies
0
Age
26
XP
124
Country
United States
For the few wondering, this project is *not* dead, I was just taking a little break. I'm currently adding rooms which store entities (up to 1024), cameras (up to 16), and a background (animation) meaning you can create different rooms for each area (inside a town, floors of a building, rooms of a dungeon, etc.) and then switch the current room rather than switching everything separately and having to keep track.

I've also added collision detection (not implemented in the movement function yet) and will probably add a structure for collision fields as well.

Lastly, you will be able to set a room's default state, so that whenever the player leaves and reenters (or otherwise reloads the room) it will set all of its entities and cameras to the default setting rather than picking up where you left off. This is useful for something like a dungeon in Zelda, where all the enemies respawn when you exit and reenter a room.
 

catlover007

Developer
Developer
Joined
Oct 23, 2015
Messages
715
Trophies
1
XP
3,865
Country
Germany
Isn't putting everything in a single header file is pretty stupid?

Because when you include it into multiple source file every symbol gets duplicated and weird linker errors occur, because of functions defined more than one time
 

BtheDestroyer

Member
OP
Newcomer
Joined
Apr 1, 2016
Messages
16
Trophies
0
Age
26
XP
124
Country
United States
Isn't putting everything in a single header file is pretty stupid?

Because when you include it into multiple source file every symbol gets duplicated and weird linker errors occur, because of functions defined more than one time
I'm planning on splitting it up in the next update as well. Rather than just spritetools.h there will also be stanimations.h, stentities.h, stcameras.h, strooms.h, etc.

EDIT: Also, does SF2D not do the same thing (only use one header)? I've never had an issue with including headers across multiple source files, so maybe your makefile has something wrong in it.
 
Last edited by BtheDestroyer,

catlover007

Developer
Developer
Joined
Oct 23, 2015
Messages
715
Trophies
1
XP
3,865
Country
Germany
When you do an #include, the file gets actually embedded into the file, this gets done before everything else in the same step where all macros get resolved.
In C you have to seperate your code in header and source files, where the source files contain the actual source code, while the header files contain predefinitons of functions(like so void testFunction(int arg1);). This is needed because the compiler doesn't know by itself about symbols from other source files, except when they get declared like above. Then in the next step, the linker resolves all referenced symbols by gathering the symbol files(.o) and the external linked files(when you use a library). Then the linker outputs the final binary.

See here how to seperate your code correctly: http://stackoverflow.com/documentat...header-include-guards#t=201608102122073242157
 
  • Like
Reactions: BtheDestroyer

BtheDestroyer

Member
OP
Newcomer
Joined
Apr 1, 2016
Messages
16
Trophies
0
Age
26
XP
124
Country
United States
Last edited by BtheDestroyer,

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
    SylverReZ @ SylverReZ: Sup