Homebrew game drawing images from the sd card in citro 2d

  • Thread starter Thread starter loglot
  • Start date Start date
  • Views Views 97
  • Replies Replies 0

loglot

Member
Newcomer
Joined
Feb 20, 2022
Messages
10
Reaction score
4
Trophies
0
Age
27
Location
void
Website
loglot.co.in
XP
91
Country
United States
i've been working on a game for a few days, it pulls level data from the sd card, one part of the data is a preview image, it is able to be a png or a jpg file,
First issue, if the image isn't a power of 2, the game crashes,
Second issue, the image just... doesn't render in the first place.

C:
// init code

#define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h"

unsigned char *cover=stbi_load("sdmc:/game/cover.jpg",&imgwid,&imghei,&imgch,4) ;

C3D_Tex* tex = malloc(sizeof(C3D_Tex));
C3D_TexInit(tex, imgwid, imghei, GPU_RGBA8);
tex->border = 0;

C3D_TexUpload(tex, cover);
stbi_image_free(cover);

C2D_Image image = { {tex, NULL}, {0, 0, imgwid, imghei} };

// draw code
C2D_DrawImageAt(image, 0, 0, 1.0, NULL, 1.0, 1.0);

any help would be very much appreciated
 

Site & Scene News

Popular threads in this forum