Homebrew [Release] {beta} sf2dlib - Simple and Fast 2D library (using the GPU)

  • Thread starter Thread starter xerpi
  • Start date Start date
  • Views Views 97,213
  • Replies Replies 501
  • Likes Likes 32
Code:
git clone https://github.com/xerpi/sf2dlib.git
cd sf2dlib/libsf2d
make
make install

So I did that with libsf2d and it said installed but when I try this with libsftd I get this:

c:\devkitPro\libsftd>make
sftd.c
arm-none-eabi-gcc -MMD -MP -MF /c/devkitPro/libsftd/build/sftd.d -g -Wall -O2 -march=armv6k -mtune=mpcore -mfloat-abi=hard -I/c/devkitPro/libsftd/include -I/c/devkitPro/libctru/include -I/c/devkitPro/portlibs/armv6k/include -I/c/devkitPro/portlibs/3ds/include -I/c/devkitPro/portlibs/armv6k/include/freetype2 -I/c/devkitPro/portlibs/3ds/include/freetype2 -I/c/devkitPro/libsftd/build -DARM11 -D_3DS -c /c/devkitPro/libsftd/source/sftd.c -o sftd.o
c:/devkitPro/libsftd/source/sftd.c:6:22: fatal error: ft2build.h: No such file or directory
compilation terminated.
make[1]: *** [sftd.o] Error 1
make: *** [build] Error 2
 
So I did that with libsf2d and it said installed but when I try this with libsftd I get this:

c:\devkitPro\libsftd>make
sftd.c
arm-none-eabi-gcc -MMD -MP -MF /c/devkitPro/libsftd/build/sftd.d -g -Wall -O2 -march=armv6k -mtune=mpcore -mfloat-abi=hard -I/c/devkitPro/libsftd/include -I/c/devkitPro/libctru/include -I/c/devkitPro/portlibs/armv6k/include -I/c/devkitPro/portlibs/3ds/include -I/c/devkitPro/portlibs/armv6k/include/freetype2 -I/c/devkitPro/portlibs/3ds/include/freetype2 -I/c/devkitPro/libsftd/build -DARM11 -D_3DS -c /c/devkitPro/libsftd/source/sftd.c -o sftd.o
c:/devkitPro/libsftd/source/sftd.c:6:22: fatal error: ft2build.h: No such file or directory
compilation terminated.
make[1]: *** [sftd.o] Error 1
make: *** [build] Error 2

You need to install portlibs first.
 
If you are using cygwin, I don't think it comes with wget by default and you need to install the package yourself.
Thanks for the help btw. I am manually installing free type and I get this error:

checking dynamic linker characteristics... no
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... no
checking whether to build shared libraries... no
checking whether to build static libraries... yes
checking for i686-pc-mingw32-gcc... no
checking for gcc... no
checking for cc... no
configure: error: cannot find native C compiler
make[1]: *** [setup] Error 1
make[1]: Leaving directory `/c/devkitPro/3ds_portlibs-master/freetype-2.6.1'
make: *** [freetype] Error 2
 
Hey,

I'm trying to compile my hb game on Linux. All the stuff at first goes fine (after two hours of removing small typos and fighting with the fact I dared to use more than one file for source), but then linker decides that it needs to go apeshit.

I installed sfil and sf2d libs, and yet I get multiple "undefined reference to 'sfil_load_PNG_file'", "undefined reference to `sf2d_draw_texture'" etc. errors.
Is this an error within the makefile (I just copied the one from 3DS ctrulib examples), or something more serious?
 
Hey,

I'm trying to compile my hb game on Linux. All the stuff at first goes fine (after two hours of removing small typos and fighting with the fact I dared to use more than one file for source), but then linker decides that it needs to go apeshit.

I installed sfil and sf2d libs, and yet I get multiple "undefined reference to 'sfil_load_PNG_file'", "undefined reference to `sf2d_draw_texture'" etc. errors.
Is this an error within the makefile (I just copied the one from 3DS ctrulib examples), or something more serious?

The problem here seems that your linker can't find the sf2d and sftd libraries. I suppose the fix should be between one of this option

1) Have you installed devkitpro in the default places? For linux it is usually /opt/devkitpro. If so, have you installed sf2d and sftd correctly? (a make && make install should do the job

2) Are you possibly using the makefile from the ctrulib's template? If so the error is explained. You should use the makefile from the example contained in the sf2d library (as the makefile from ctrulib doesn't link the sf2d library)
 
  • Like
Reactions: Spaqin
2) Are you possibly using the makefile from the ctrulib's template? If so the error is explained. You should use the makefile from the example contained in the sf2d library (as the makefile from ctrulib doesn't link the sf2d library)
Yup, that was it! I used the one from sfil lib though, and now it compiles!
Oh well, now the worst part, testing.
 
Can someone point me towards loading a texture directly from a .png file instead of adding it as a binary?
 
Can someone point me towards loading a texture directly from a .png file instead of adding it as a binary?
You have to use libpng to get the pixelmap then pass that to sf2d_create_texture_mem_RGBA8. TGA is easier to load and you don't need a separate library, even easier you can also load RAW RGBA8 textures from a file.
 
Inside sure, but it boils down to one function sfil_load_PNG_file() that returns a pointer to sf2d_texture, so if he doesn't want to play with bare libpng and sf2d_create_texture_mem_RGBA8(), I think it's much simpler.
 
  • Like
Reactions: cearp
Hmm... I wonder using this is how many times faster than just regular framebuffer memcpy :P

Also, would it be possible to change the co-ordinate system? The renderer I wrote works from bottom-up, and not top-down, so {x=0,y=0} is the 0th physical pixel (bottom-left on the screen), and {x=0,y=1} is the first physical pixel (above the bottom-left pixel), {x=1,y=0} is the 240th pixel (to the right of the bottom-left pixel), and so on.
 
Hmm... I wonder using this is how many times faster than just regular framebuffer memcpy :P

Also, would it be possible to change the co-ordinate system? The renderer I wrote works from bottom-up, and not top-down, so {x=0,y=0} is the 0th physical pixel (bottom-left on the screen), and {x=0,y=1} is the first physical pixel (above the bottom-left pixel), {x=1,y=0} is the 240th pixel (to the right of the bottom-left pixel), and so on.
You simply have to modify the projection matrix, just switch the bottom and top values.
 
You simply have to modify the projection matrix, just switch the bottom and top values.

The only problem with that is that I have <0% knowledge with the GPU and 3D (my programs are mostly console-based because of this), so I don't know what to edit :blush:
If you could, could you please point me in the right direction?
 

Site & Scene News

Popular threads in this forum