1
General / Problem with rendering (SFML2.1, OOP + <vector>)
« on: June 24, 2014, 10:29:58 am »
Hi guys, i have a big problem which i can't solve after hours and i need your help.
My program task is to make a skin move on the map and pick up item which will go into my inventory.
The problem is that my program doesn't want to render skins properly. Take a look on the code which is long and then i'll give you more details.
main.cpp
Item.h
Item.cpp
Gracz.h
Gracz.cpp
So, as you can take a look at the main.cpp I declared an object of Gracz class and i gave it a skin "skin.png", in my program it's just a black square, but later i gave a skin to an item "item1.png" which was little black heart in square, but what i got is next black square! Just to satisfy my curiosity later a gave Gracz object "item1.png" skin instead of "skin.png" and everything on the map(items and Gracz object) had the same picture(little black heart on square) but with other size(Gracz object had skin 50x50 and item is 30x30)
The next thing when i push_back my items vector the next items don't want to show up on the map. I mean they are on the map, i can pick up them, but i can't see them.
It seems like something would be rendered wrong maybe it's in vector class or my loops, don't really know.
I would appreciate your help.
UPDATE: I found out that when i'll go my Gracz black square to the "invisible item" it shows up that Item is a white square. Sometimes when i pick up "invisible item", a new one respawn with a proper skin.
My program task is to make a skin move on the map and pick up item which will go into my inventory.
The problem is that my program doesn't want to render skins properly. Take a look on the code which is long and then i'll give you more details.
main.cpp
(click to show/hide)
(click to show/hide)
(click to show/hide)
(click to show/hide)
(click to show/hide)
So, as you can take a look at the main.cpp I declared an object of Gracz class and i gave it a skin "skin.png", in my program it's just a black square, but later i gave a skin to an item "item1.png" which was little black heart in square, but what i got is next black square! Just to satisfy my curiosity later a gave Gracz object "item1.png" skin instead of "skin.png" and everything on the map(items and Gracz object) had the same picture(little black heart on square) but with other size(Gracz object had skin 50x50 and item is 30x30)
The next thing when i push_back my items vector the next items don't want to show up on the map. I mean they are on the map, i can pick up them, but i can't see them.
It seems like something would be rendered wrong maybe it's in vector class or my loops, don't really know.
I would appreciate your help.
UPDATE: I found out that when i'll go my Gracz black square to the "invisible item" it shows up that Item is a white square. Sometimes when i pick up "invisible item", a new one respawn with a proper skin.