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

MRJPGames

Pretty great guy
Member
Joined
Aug 17, 2013
Messages
1,199
Trophies
1
Location
The Netherlands
Website
fizazy.com
XP
1,686
Country
Netherlands
Hi, I want to render a texture that is manipulated by another class ("object"). For this is the main rendering code this is done for the specific thing that causes the program to crash (when I used a local texture it worked fine):
Code:
sf2d_draw_texture_scale(gol.getMapTexture(), -mapX, -mapY, scale, scale);
In GoL.h this is how the texture is initialised (as a local variable/pointer):
Code:
sf2d_texture *tex_map = sfil_load_PNG_file("romfs:/template.png", SF2D_PLACE_RAM);
And last but not least here is the function getMapTexture():
Code:
sf2d_texture *GoL::getMapTexture(){
    return tex_map;
}
It also crashes when I do the sf2d_set_pixel operation from the object itself. Also trying to render it from the object itself also crashes, essentially doing anything with it seems to crash the program for some reason.

Anyone know what is causing this, and if I can fix this and if yes, how?
 

Manurocker95

Game Developer & Pokémon Master
Member
Joined
May 29, 2016
Messages
1,512
Trophies
0
Age
29
Location
Madrid
Website
manuelrodriguezmatesanz.com
XP
2,813
Country
Spain
Hi, I want to render a texture that is manipulated by another class ("object"). For this is the main rendering code this is done for the specific thing that causes the program to crash (when I used a local texture it worked fine):
Code:
sf2d_draw_texture_scale(gol.getMapTexture(), -mapX, -mapY, scale, scale);
In GoL.h this is how the texture is initialised (as a local variable/pointer):
Code:
sf2d_texture *tex_map = sfil_load_PNG_file("romfs:/template.png", SF2D_PLACE_RAM);
And last but not least here is the function getMapTexture():
Code:
sf2d_texture *GoL::getMapTexture(){
    return tex_map;
}
It also crashes when I do the sf2d_set_pixel operation from the object itself. Also trying to render it from the object itself also crashes, essentially doing anything with it seems to crash the program for some reason.

Anyone know what is causing this, and if I can fix this and if yes, how?

Tex_map pointer is not saved in gol object. U should have a variable where u save the pointer u r trying to access on getmaptexture
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
    HiradeGirl @ HiradeGirl: Thanks, dear. @K3Nv2