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

sLevin

New Member
Newbie
Joined
Aug 13, 2016
Messages
4
Trophies
0
Age
31
XP
41
Country
Gambia, The
You may want to set the viewport to native resolution (400x240) load the texture in native resolution (512x512), draw it into a 600x600 quad, and move the view to (200,240) or whatever position the player is. If you plan making bigger map sizes I suggest you to think about an occlusion algorithm (to load just the part the player can view).
Yep that is what I want to do. But first I need to render my tiles to a map and use that. Machinamentum suggested rendering it to the frambuffer and using it as a new texture. Sound good, but how do I get the current data from the framebuffer into a sf2d_texture? As far as I know gfxGetFramebuffer() returns an pointer to the current framebuffer. How to I store the content in my sf2d_texture?
 

Urbanshadow

Well-Known Member
Member
Joined
Oct 16, 2015
Messages
1,578
Trophies
0
Age
33
XP
1,723
Country
Yep that is what I want to do. But first I need to render my tiles to a map and use that. Machinamentum suggested rendering it to the frambuffer and using it as a new texture. Sound good, but how do I get the current data from the framebuffer into a sf2d_texture? As far as I know gfxGetFramebuffer() returns an pointer to the current framebuffer. How to I store the content in my sf2d_texture?
I dont really know why would you do that, honestly. I'd just would draw every needed tile and adjust the viewport accordingly. I don't remember the function in sf2dlib right now but something along the lines of RenderTiledTextureQuad should allow you to render just a region of your texture to the drawing space. Just render every texture where it should be and adjust the viewport accordingly.

Edit: I think it's just a name? You can wrap render calls to a Map object and with proper instantiation you should be able to define maps during execution (loading!) time and have the Map rendered with just a call.
 
Last edited by Urbanshadow,

sLevin

New Member
Newbie
Joined
Aug 13, 2016
Messages
4
Trophies
0
Age
31
XP
41
Country
Gambia, The
I dont really know why would you do that, honestly. I'd just would draw every needed tile and adjust the viewport accordingly. I don't remember the function in sf2dlib right now but something along the lines of RenderTiledTextureQuad should allow you to render just a region of your texture to the drawing space. Just render every texture where it should be and adjust the viewport accordingly.

Edit: I think it's just a name? You can wrap render calls to a Map object and with proper instantiation you should be able to define maps during execution (loading!) time and have the Map rendered with just a call.

Hi, thanks for taking the time to help me. My problem is that I want to render the map on the fly to get a neverending platformer kind of game. Right now I am filling an array with the map currently viewable and a little bit as a buffer. To make all the calculations with the offsets easier I want to render my map on a texture and just move the texutre around instead of moving my tiles in the render routine around, because especially when switching the map it gets a lot more easy when you have the whole thing rendered on one texture. In SDL I was able to render my title textures directly on an other texutre and that is what I am trying to do. So instead of

Code:
sf2d_start_frame(GFX_TOP, GFX_LEFT);
for(int y = 0; y < 10; y++) {
     for(int x = 0; x < 14; x++) {
       if(map.getField(x, y) == 1) {

         sf2d_draw_texture(platL_image, x*24 + 32, (9-y)*24);

       } else if (map.getField(x, y) == 2) {

         sf2d_draw_texture(platM_image, x*24 + 32, (9-y)*24);

       } else if (map.getField(x, y) == 3) {

         sf2d_draw_texture(platR_image, x*24 + 32, (9-y)*24);

       }
     }
   }
sf2d_end_frame();

I want to redirect the draw calls to a texture instead. Because then I can adjust the viewport when I am drawing the map texture. Basicly it is the same as described in this article http://www.wildbunny.co.uk/blog/2011/12/11/how-to-make-a-2d-platform-game-part-1/ under tiles follow camera.
 

Urbanshadow

Well-Known Member
Member
Joined
Oct 16, 2015
Messages
1,578
Trophies
0
Age
33
XP
1,723
Country
Code:
sf2d_start_frame(GFX_TOP, GFX_LEFT);
for(int y = 0; y < 10; y++) {
     for(int x = 0; x < 14; x++) {
       if(map.getField(x, y) == 1) {

         sf2d_draw_texture(platL_image, x*24 + 32, (9-y)*24);

       } else if (map.getField(x, y) == 2) {

         sf2d_draw_texture(platM_image, x*24 + 32, (9-y)*24);

       } else if (map.getField(x, y) == 3) {

         sf2d_draw_texture(platR_image, x*24 + 32, (9-y)*24);

       }
     }
   }
sf2d_end_frame();

I want to redirect the draw calls to a texture instead. Because then I can adjust the viewport when I am drawing the map texture. Basicly it is the same as described in this article http://www.wildbunny.co.uk/blog/2011/12/11/how-to-make-a-2d-platform-game-part-1/ under tiles follow camera.[/QUOTE]

I still don't really get it. I don't think you need to create any textures and it's not the way to do it.

Every texture you render to the scene stays in it's place. The position of the view in the scene is independant to the position of every object in the scene. In world coordinates, you can generate your map in any form you wish. The player then is centered and move with the view of the scene.

As your linked article notes, you write conceptual tiles to the scene (being them your render objects). The article does not create a texture and render them. Instead of that, provides a set of textures which laid one next to another can create the world you need.

figure1.png

This figure in your article describes the issue directly, being the blue rect the 400x240 screen and each black square a renderable tile, represented by a position in your current map matrix. Each position has an int that selects a texture. Each texture can be a different file or in the same file but a selected region.

But then again, you do not produce a new render-able texture and just stick it to a quad. you need at least a quad and a texture for each black, green and red squares in the figure.

If you need more assistance I suggest you to open a new thread instead of cluttering the sf2dlib thread.
 

nop90

Well-Known Member
Member
Joined
Jan 11, 2014
Messages
1,556
Trophies
0
Location
Rome
XP
3,136
Country
Italy
@xerpi : Seems there is a problem with sfil loadng bmp files, at leaat 24 bpp ones.

Now I have a very bad connection where I'am si I can't open an issue on gitgub with code example, bit the problem should be easy to reproduce.
 
D

Deleted User

Guest
Posting here because I didn't know where else this would fit: Loading larger images (though smaller than 1024px in width/height) with sfillib results in fragments of other textures to be displayed, as if they were mixed up in memory. Is there any fix for this?
 

elhobbs

Well-Known Member
Member
Joined
Jul 28, 2008
Messages
1,044
Trophies
1
XP
3,033
Country
United States
Posting here because I didn't know where else this would fit: Loading larger images (though smaller than 1024px in width/height) with sfillib results in fragments of other textures to be displayed, as if they were mixed up in memory. Is there any fix for this?
Can you create a small example that exhibits this issue? It would likely be the best way towards getting a resolution.
 
D

Deleted User

Guest
Can you create a small example that exhibits this issue? It would likely be the best way towards getting a resolution.

Here's an example from my program:

Code:
// load image from buffer, which is loaded directly from a file (inefficient, but it doesn't seem to make a difference)
image = sfil_load_PNG_buffer(img_buffer, SF2D_PLACE_RAM);

cb = app::run_img(image, theme, vm, false);

Inside run_img, through a bunch of other functions called by it:

Code:
sf2d_draw_texture_part_scale(image, 0.0F, 0.0F, loc_x, loc_y, scale, scale * (5.0 * 3.0), 400.0 / scale, 240.0 / scale);

And, just for reference, one of the images being loaded is 594x864 pixels in dimension.
 

elhobbs

Well-Known Member
Member
Joined
Jul 28, 2008
Messages
1,044
Trophies
1
XP
3,033
Country
United States
Here's an example from my program:

Code:
// load image from buffer, which is loaded directly from a file (inefficient, but it doesn't seem to make a difference)
image = sfil_load_PNG_buffer(img_buffer, SF2D_PLACE_RAM);

cb = app::run_img(image, theme, vm, false);

Inside run_img, through a bunch of other functions called by it:

Code:
sf2d_draw_texture_part_scale(image, 0.0F, 0.0F, loc_x, loc_y, scale, scale * (5.0 * 3.0), 400.0 / scale, 240.0 / scale);

And, just for reference, one of the images being loaded is 594x864 pixels in dimension.
The 3ds hardware requires textures to have dimensions that are powers of 2. From 8 or 16 (depending on the texture format) to 1024. The textures can be rectangular - so the width and height don't need to match.
For repeating textures you will need to scale them to powers of 2. For non-repeating you can pad or scale.
 
D

Deleted User

Guest
The 3ds hardware requires textures to have dimensions that are powers of 2. From 8 or 16 (depending on the texture format) to 1024. The textures can be rectangular - so the width and height don't need to match.
For repeating textures you will need to scale them to powers of 2. For non-repeating you can pad or scale.

So, because my images aren't a power of 2, it's causing the 3DS hardware to allocate these images into memory incorrectly, and thus display these images with "junk" off to the side?

I find that odd, because earlier in my testing, I loaded an image into memory and it loaded fine, with no junk pixels to the side or anything. I later added menus and tried loading the same image again, and that's where I ran into this problem. Could it be that I just that I loaded it first before all other images?
 

Urbanshadow

Well-Known Member
Member
Joined
Oct 16, 2015
Messages
1,578
Trophies
0
Age
33
XP
1,723
Country
So, because my images aren't a power of 2, it's causing the 3DS hardware to allocate these images into memory incorrectly, and thus display these images with "junk" off to the side?

I find that odd, because earlier in my testing, I loaded an image into memory and it loaded fine, with no junk pixels to the side or anything. I later added menus and tried loading the same image again, and that's where I ran into this problem. Could it be that I just that I loaded it first before all other images?

As I said in one or two pages earlier, the PICAGPU uses quite an strage format of storing textures which in citro3ds is called "tiled" format where sets of BGR pixels are stored recursively in power of two's squares. Example:
For a 4x8 image (each number represents a BGR8 pixel, i don't know how alpha is rendered but I think it's done separately):
Code:
0  1  2  3  4  5  6  7
8  9  10 11 12 13 14 15
16 17 18 19 20 21 22 23
24 25 26 27 28 29 30 31

The tiling should do this:
Code:
0  1  4  5  16 17 20 21
2  3  6  7  18 19 22 23
8  9  12 13 24 25 28 29
10 11 14 15 26 27 30 31

So if you put anything but a power of two's size in any coordinate, some of the power of two squares will be empty, or lacking pixels, or even full with memory garbage. It's not a biggie, but if you put a 513x513 px image the system will either crash (by memory access) or show your picture somewhere in a 1024x1024? px tex full of garbage. ( I still don't know if the system can handle sums of powers of two instead of jumping to the next size )

I really wonder what's the reasoning behind this..
 
Last edited by Urbanshadow,
  • Like
Reactions: elhobbs

nop90

Well-Known Member
Member
Joined
Jan 11, 2014
Messages
1,556
Trophies
0
Location
Rome
XP
3,136
Country
Italy
I use sf2dlib with every image sizes and have no problem. The intern a l buffer has powers of 2 sizes, but the code handles all the needed clipping to the teal image size.

The only real problem is that there ia a limit in the images sizes (max 1024 pr side if I remember well)
 

elhobbs

Well-Known Member
Member
Joined
Jul 28, 2008
Messages
1,044
Trophies
1
XP
3,033
Country
United States
So, because my images aren't a power of 2, it's causing the 3DS hardware to allocate these images into memory incorrectly, and thus display these images with "junk" off to the side?

I find that odd, because earlier in my testing, I loaded an image into memory and it loaded fine, with no junk pixels to the side or anything. I later added menus and tried loading the same image again, and that's where I ran into this problem. Could it be that I just that I loaded it first before all other images?
You are free to find it odd - did it help? :)
Here is a clip from sf2d_create_texture - C3D_TexInit(&texture->tex, next_pow2(width), next_pow2(height), pixel_format);
Notice the next_pow2 calls? The sfil png load call works by decoding the png into calculated row offsets using the pow2 values). Based on this it will leave the right edge and bottom of the image as garbage. However, if you are not tiling the image you should be able to scale your texture coordinates. For example if the width was 400 then the right edge would be 400/512 rather than 1.0.

--------------------- MERGED ---------------------------

I use sf2dlib with every image sizes and have no problem. The intern a l buffer has powers of 2 sizes, but the code handles all the needed clipping to the teal image size.

The only real problem is that there ia a limit in the images sizes (max 1024 pr side if I remember well)
I stand corrected - looking at the sd2d code that does appear to be the case. No idea then - good luck.

--------------------- MERGED ---------------------------

As I said in one or two pages earlier, the PICAGPU uses quite an strage format of storing textures which in citro3ds is called "tiled" format where sets of BGR pixels are stored recursively in power of two's squares. Example:
For a 4x8 image (each number represents a BGR8 pixel, i don't know how alpha is rendered but I think it's done separately):
Code:
0  1  2  3  4  5  6  7
8  9  10 11 12 13 14 15
16 17 18 19 20 21 22 23
24 25 26 27 28 29 30 31

The tiling should do this:
Code:
0  1  4  5  16 17 20 21
2  3  6  7  18 19 22 23
8  9  12 13 24 25 28 29
10 11 14 15 26 27 30 31

So if you put anything but a power of two's size in any coordinate, some of the power of two squares will be empty, or lacking pixels, or even full with memory garbage. It's not a biggie, but if you put a 513x513 px image the system will either crash (by memory access) or show your picture somewhere in a 1024x1024? px tex full of garbage. ( I still don't know if the system can handle sums of powers of two instead of jumping to the next size )

I really wonder what's the reasoning behind this..
I can say that the tiling of the textures is an optimization for the 3D hardware which is also tile based. I believe the idea is cache locality - keep all the needed texels close together to limits reads.
 

Urbanshadow

Well-Known Member
Member
Joined
Oct 16, 2015
Messages
1,578
Trophies
0
Age
33
XP
1,723
Country
I can say that the tiling of the textures is an optimization for the 3D hardware which is also tile based. I believe the idea is cache locality - keep all the needed texels close together to limits reads.

Oh! That might come in handy for a "CUDA" style arch (cuda cores tend to share "L2" cache in matrix proximity) but I naively thought the PICA was a streamlined GPU. You have raised a good point there.
 

Joel16

Ils ne passeront pas
Member
Joined
May 8, 2011
Messages
933
Trophies
2
Age
27
Location
Doesn't concern you.
XP
5,289
Country
United States
It's been over a month since Cyanogen3DS has been broken. I honestly don't know what went wrong, but just after the major changes in the GPU API, the controls don't work, and also seems to lag. (The analog, c-stick and d-pad works though, so you can move the cursor but can't press anything. And you can also notice how slow the cursor moves - which in my impression is quite 'laggy').

What's weird is, I didn't mess with the source. It was working fine as is, but when I had to update to the latest versions of Citro3D, sf2d, sftd and sfil lib, that's when I started facing this issue.

Any word on this @xerpi ?
It's really annoying me now, and I may just drop the project due to this issue.
 
D

Deleted User

Guest
You are free to find it odd - did it help? :)
Here is a clip from sf2d_create_texture - C3D_TexInit(&texture->tex, next_pow2(width), next_pow2(height), pixel_format);
Notice the next_pow2 calls? The sfil png load call works by decoding the png into calculated row offsets using the pow2 values). Based on this it will leave the right edge and bottom of the image as garbage. However, if you are not tiling the image you should be able to scale your texture coordinates. For example if the width was 400 then the right edge would be 400/512 rather than 1.0.

--------------------- MERGED ---------------------------


I stand corrected - looking at the sd2d code that does appear to be the case. No idea then - good luck.

--------------------- MERGED ---------------------------


I can say that the tiling of the textures is an optimization for the 3D hardware which is also tile based. I believe the idea is cache locality - keep all the needed texels close together to limits reads.

No, you were correct. Resizing the images to 1024x1024 does seem to solve the problem. However, the problem is that my program deals with images of variable size, and I can't know for certain the image sizes people will throw at my program, so I can't just leave the images at this dimension.

I use sf2dlib with every image sizes and have no problem. The intern a l buffer has powers of 2 sizes, but the code handles all the needed clipping to the teal image size.

The only real problem is that there ia a limit in the images sizes (max 1024 pr side if I remember well)

How would one go about setting up a buffer with sizes of a power of 2? I'm loading these images via sfillib, would it be possible to set up a 1024x1024 buffer with sfillib?

EDIT: Actually, never mind. I got around this by drawing only up to the image dimensions, not past them. This "hides" the junk data from view. Thank you all!
 
Last edited by ,

ThatBenderGuy

Well-Known Member
Member
Joined
Dec 16, 2013
Messages
150
Trophies
0
Age
31
XP
348
Country
United States
I am following a tutorial that uses sf2lib but is there no precompiled sf2lib? I try to run the makefile for sf2lib and this is what I get
Code:
C:\Users\thatb\Desktop\sf2dlib-master\libsf2d>make
sf2d_draw.c
arm-none-eabi-gcc -MMD -MP -MF /c/Users/thatb/Desktop/sf2dlib-master/libsf2d/build/sf2d_draw.d -g -Wall -Werror -O2 -mword-relocations -ffunction-sections -fno-strict-aliasing -fomit-frame-pointer -march=armv6k -mtune=mpcore -mfloat-abi=hard -mtp=soft -I/c/Users/thatb/Desktop/sf2dlib-master/libsf2d/include -I/c/devkitPro/libctru/include -I/c/Users/thatb/Desktop/sf2dlib-master/libsf2d/build -DARM11 -D_3DS -c /c/Users/thatb/Desktop/sf2dlib-master/libsf2d/source/sf2d_draw.c -o sf2d_draw.o
c:/Users/thatb/Desktop/sf2dlib-master/libsf2d/source/sf2d_draw.c: In function 'sf2d_draw_rectangle_rotate':
c:/Users/thatb/Desktop/sf2dlib-master/libsf2d/source/sf2d_draw.c:129:2: error: too many arguments to function 'Mtx_Translate'
  Mtx_Translate(&m, x+w2, y+h2, 0, true);
  ^
In file included from c:/devkitPro/libctru/include/citro3d.h:12:0,
                 from c:/Users/thatb/Desktop/sf2dlib-master/libsf2d/include/sf2d.h:9,
                 from c:/Users/thatb/Desktop/sf2dlib-master/libsf2d/source/sf2d_draw.c:1:
c:/devkitPro/libctru/include/c3d/maths.h:65:6: note: declared here
 void Mtx_Translate(C3D_Mtx* mtx, float x, float y, float z);
      ^
c:/Users/thatb/Desktop/sf2dlib-master/libsf2d/source/sf2d_draw.c: In function 'sf2d_draw_rectangle_gradient_rotate':
c:/Users/thatb/Desktop/sf2dlib-master/libsf2d/source/sf2d_draw.c:175:2: error: too many arguments to function 'Mtx_Translate'
  Mtx_Translate(&m, x+w2, y+h2, 0, true);
  ^
In file included from c:/devkitPro/libctru/include/citro3d.h:12:0,
                 from c:/Users/thatb/Desktop/sf2dlib-master/libsf2d/include/sf2d.h:9,
                 from c:/Users/thatb/Desktop/sf2dlib-master/libsf2d/source/sf2d_draw.c:1:
c:/devkitPro/libctru/include/c3d/maths.h:65:6: note: declared here
 void Mtx_Translate(C3D_Mtx* mtx, float x, float y, float z);
      ^
make[1]: *** [sf2d_draw.o] Error 1
make: *** [build] Error 2

and then there is nothing in the lib folder after running it. I am running the latest version of devkitPro (The updater at least said I was) and I do have the devKitARM module installed. Here is my installed.ini
Code:
[msys]
Version=1.0.17
[devkitARM]
Version=45
[devkitPPC]
Version=27
[devkitPSP]
Version=16-1
[libgba]
Version=20090222
[libgbafat]
Version=1.0.14
[maxmodgba]
Version=1.0.9
[libnds]
Version=1.5.12
[libndsfat]
Version=1.0.14
[defaultarm7]
Version=0.6.0
[filesystem]
Version=0.9.12
[dswifi]
Version=0.3.17
[libmirko]
Version=0.9.7
[maxmodds]
Version=1.0.9
[libctru]
Version=1.1.0
[citro3d]
Version=1.1.0
[libogc]
Version=1.8.12
[libogcfat]
Version=1.0.14
[3dsexamples]
Version=20160106
[ndsexamples]
Version=20140401
[gbaexamples]
Version=20090222
[gp32examples]
Version=20051021
[cubeexamples]
Version=20110620
[wiiexamples]
Version=20110620
[pspdoc]
Version=20051113
[gcube]
Version=0.4.0
[insight]
Version=7.3.50.20110803
[pnotepad]
Version=2.0.8.718

Any help would be appreciated
 

elhobbs

Well-Known Member
Member
Joined
Jul 28, 2008
Messages
1,044
Trophies
1
XP
3,033
Country
United States
I am following a tutorial that uses sf2lib but is there no precompiled sf2lib? I try to run the makefile for sf2lib and this is what I get
Code:
C:\Users\thatb\Desktop\sf2dlib-master\libsf2d>make
sf2d_draw.c
arm-none-eabi-gcc -MMD -MP -MF /c/Users/thatb/Desktop/sf2dlib-master/libsf2d/build/sf2d_draw.d -g -Wall -Werror -O2 -mword-relocations -ffunction-sections -fno-strict-aliasing -fomit-frame-pointer -march=armv6k -mtune=mpcore -mfloat-abi=hard -mtp=soft -I/c/Users/thatb/Desktop/sf2dlib-master/libsf2d/include -I/c/devkitPro/libctru/include -I/c/Users/thatb/Desktop/sf2dlib-master/libsf2d/build -DARM11 -D_3DS -c /c/Users/thatb/Desktop/sf2dlib-master/libsf2d/source/sf2d_draw.c -o sf2d_draw.o
c:/Users/thatb/Desktop/sf2dlib-master/libsf2d/source/sf2d_draw.c: In function 'sf2d_draw_rectangle_rotate':
c:/Users/thatb/Desktop/sf2dlib-master/libsf2d/source/sf2d_draw.c:129:2: error: too many arguments to function 'Mtx_Translate'
  Mtx_Translate(&m, x+w2, y+h2, 0, true);
  ^
In file included from c:/devkitPro/libctru/include/citro3d.h:12:0,
                 from c:/Users/thatb/Desktop/sf2dlib-master/libsf2d/include/sf2d.h:9,
                 from c:/Users/thatb/Desktop/sf2dlib-master/libsf2d/source/sf2d_draw.c:1:
c:/devkitPro/libctru/include/c3d/maths.h:65:6: note: declared here
void Mtx_Translate(C3D_Mtx* mtx, float x, float y, float z);
      ^
c:/Users/thatb/Desktop/sf2dlib-master/libsf2d/source/sf2d_draw.c: In function 'sf2d_draw_rectangle_gradient_rotate':
c:/Users/thatb/Desktop/sf2dlib-master/libsf2d/source/sf2d_draw.c:175:2: error: too many arguments to function 'Mtx_Translate'
  Mtx_Translate(&m, x+w2, y+h2, 0, true);
  ^
In file included from c:/devkitPro/libctru/include/citro3d.h:12:0,
                 from c:/Users/thatb/Desktop/sf2dlib-master/libsf2d/include/sf2d.h:9,
                 from c:/Users/thatb/Desktop/sf2dlib-master/libsf2d/source/sf2d_draw.c:1:
c:/devkitPro/libctru/include/c3d/maths.h:65:6: note: declared here
void Mtx_Translate(C3D_Mtx* mtx, float x, float y, float z);
      ^
make[1]: *** [sf2d_draw.o] Error 1
make: *** [build] Error 2

and then there is nothing in the lib folder after running it. I am running the latest version of devkitPro (The updater at least said I was) and I do have the devKitARM module installed. Here is my installed.ini
Code:
[msys]
Version=1.0.17
[devkitARM]
Version=45
[devkitPPC]
Version=27
[devkitPSP]
Version=16-1
[libgba]
Version=20090222
[libgbafat]
Version=1.0.14
[maxmodgba]
Version=1.0.9
[libnds]
Version=1.5.12
[libndsfat]
Version=1.0.14
[defaultarm7]
Version=0.6.0
[filesystem]
Version=0.9.12
[dswifi]
Version=0.3.17
[libmirko]
Version=0.9.7
[maxmodds]
Version=1.0.9
[libctru]
Version=1.1.0
[citro3d]
Version=1.1.0
[libogc]
Version=1.8.12
[libogcfat]
Version=1.0.14
[3dsexamples]
Version=20160106
[ndsexamples]
Version=20140401
[gbaexamples]
Version=20090222
[gp32examples]
Version=20051021
[cubeexamples]
Version=20110620
[wiiexamples]
Version=20110620
[pspdoc]
Version=20051113
[gcube]
Version=0.4.0
[insight]
Version=7.3.50.20110803
[pnotepad]
Version=2.0.8.718

Any help would be appreciated
You likely need to get the latest version of ctrulib from github. Then you will need to make and install it.
 

ThatBenderGuy

Well-Known Member
Member
Joined
Dec 16, 2013
Messages
150
Trophies
0
Age
31
XP
348
Country
United States
You likely need to get the latest version of ctrulib from github. Then you will need to make and install it.
Well I tried that now I get this error when I try to make sf2dlib

Code:
C:\Users\thatb\Desktop\sf2dlib-master\libsf2d>make
sf2d.c
arm-none-eabi-gcc -MMD -MP -MF /c/Users/thatb/Desktop/sf2dlib-master/libsf2d/build/sf2d.d -g -Wall -Werror -O2 -mword-relocations -ffunction-sections -fno-strict-aliasing -fomit-frame-pointer -march=armv6k -mtune=mpcore -mfloat-abi=hard -mtp=soft -I/c/Users/thatb/Desktop/sf2dlib-master/libsf2d/include -I/c/devkitPro/libctru/include -I/c/Users/thatb/Desktop/sf2dlib-master/libsf2d/build -DARM11 -D_3DS -c /c/Users/thatb/Desktop/sf2dlib-master/libsf2d/source/sf2d.c -o sf2d.o
In file included from c:/Users/thatb/Desktop/sf2dlib-master/libsf2d/source/sf2d.c:2:0:
c:/Users/thatb/Desktop/sf2dlib-master/libsf2d/include/sf2d.h:9:21: fatal error: citro3d.h: No such file or directory
compilation terminated.
make[1]: *** [sf2d.o] Error 1
make: *** [build] Error 2

EDIT:
Nevermind I just needed to make install the latest citro3D to build sf2dlib
 
Last edited by ThatBenderGuy,

Cid2mizard

Well-Known Member
Member
Joined
Aug 16, 2007
Messages
401
Trophies
1
Age
43
Location
Maubeuge
XP
2,445
Country
France
New install, new problem !!!

Code:
sf2d_draw.c
arm-none-eabi-gcc -MMD -MP -MF /c/Users/mrbri/Downloads/sf2dlib-master/libsf2d/build/sf2d_draw.d -g -Wall -Werror -O2 -mword-relocations -ffunction-sections -fno-strict-aliasing -fomit-frame-pointer -march=armv6k -mtune=mpcore -mfloat-abi=hard -mtp=soft -I/c/Users/mrbri/Downloads/sf2dlib-master/libsf2d/include -I/c/devkitPro/libctru/include -I/c/Users/mrbri/Downloads/sf2dlib-master/libsf2d/build -DARM11 -D_3DS -c /c/Users/mrbri/Downloads/sf2dlib-master/libsf2d/source/sf2d_draw.c -o sf2d_draw.o
c:/Users/mrbri/Downloads/sf2dlib-master/libsf2d/source/sf2d_draw.c: In function 'sf2d_draw_rectangle_rotate':
c:/Users/mrbri/Downloads/sf2dlib-master/libsf2d/source/sf2d_draw.c:129:2: error: too many arguments to function 'Mtx_Translate'
  Mtx_Translate(&m, x+w2, y+h2, 0, true);
  ^
In file included from c:/devkitPro/libctru/include/citro3d.h:12:0,
                 from c:/Users/mrbri/Downloads/sf2dlib-master/libsf2d/include/sf2d.h:9,
                 from c:/Users/mrbri/Downloads/sf2dlib-master/libsf2d/source/sf2d_draw.c:1:
c:/devkitPro/libctru/include/c3d/maths.h:65:6: note: declared here
void Mtx_Translate(C3D_Mtx* mtx, float x, float y, float z);
      ^
c:/Users/mrbri/Downloads/sf2dlib-master/libsf2d/source/sf2d_draw.c: In function 'sf2d_draw_rectangle_gradient_rotate':
c:/Users/mrbri/Downloads/sf2dlib-master/libsf2d/source/sf2d_draw.c:175:2: error: too many arguments to function 'Mtx_Translate'
  Mtx_Translate(&m, x+w2, y+h2, 0, true);
  ^
In file included from c:/devkitPro/libctru/include/citro3d.h:12:0,
                 from c:/Users/mrbri/Downloads/sf2dlib-master/libsf2d/include/sf2d.h:9,
                 from c:/Users/mrbri/Downloads/sf2dlib-master/libsf2d/source/sf2d_draw.c:1:
c:/devkitPro/libctru/include/c3d/maths.h:65:6: note: declared here
void Mtx_Translate(C3D_Mtx* mtx, float x, float y, float z);
      ^
make[1]: *** [sf2d_draw.o] Error 1
make: *** [build] Error 2

Edit : Resolved, i have just install last citro3d :)
 
Last edited by Cid2mizard,

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • BakerMan
    I rather enjoy a life of taking it easy. I haven't reached that life yet though.
  • BigOnYa
  • Xdqwerty
    what are you looking at?
    BakerMan @ BakerMan: @The Real Jdbye @SylverReZ @Xdqwerty @BigOnYa @BakerMan :creep: +2