1
Graphics / Some textures become white square when I'm in release mode.
« on: March 01, 2018, 11:37:14 pm »
Hi. I have a question again. Recently, I tried to show tiles on the screen, and there were 2500x3 sprites on the screen. I tried to render them all and it got slow. I tried to render a portion of them according to their position but it didn't work either. It got slow again. I'm always re instantiating the Sprite in a function in draw calls, maybe because of it, but what to do? When I declare the sf::Sprite in class declaration, it gives error when I try to call Window->Draw(sf::Sprite); It's weird.
Whatever, my here is my question: It basically doesn't draw some of my texture on the screen, actually just one texture. You can see texture_interior.png on the code:
Thank you so much. I don't know what to present more, so please ask more if you didn't understand a thing. (I didn't understand too actually )
Whatever, my here is my question: It basically doesn't draw some of my texture on the screen, actually just one texture. You can see texture_interior.png on the code:
#include "TextureManager.hpp"
#include <iostream>
sf::Texture TextureManager::textures[TEXTURENAMES_TEXTURECOUNT];
std::string TextureManager::texturePaths[TEXTURENAMES_TEXTURECOUNT];
TextureManager::TextureManager() {
texturePaths[TEXTURENAMES_ARROWS] = "Bitmaps/System/arrows.png";
texturePaths[TEXTURENAMES_BUTTONS] = "Bitmaps/System/buttons.png";
texturePaths[TEXTURENAMES_FADE] = "Bitmaps/System/fade.png";
texturePaths[TEXTURENAMES_FONT] = "Bitmaps/System/game_font.png";
texturePaths[TEXTURENAMES_ICON] = "Bitmaps/System/icon.png";
texturePaths[TEXTURENAMES_LANGUAGES] = "Bitmaps/System/languages.png";
texturePaths[TEXTURENAMES_SHINE] = "Bitmaps/System/shine.png";
texturePaths[TEXTURENAMES_LOGO] = "Bitmaps/System/system_logo.png";
texturePaths[TEXTURENAMES_WHITEBRUSH] = "Bitmaps/System/white_brush.png";
texturePaths[TEXTURENAMES_CHARBODY] = "Bitmaps/Character/Base/tileset_character_body.png";
texturePaths[TEXTURENAMES_CHARDRESS] = "Bitmaps/Character/Armor/tileset_character_dress.png";
texturePaths[TEXTURENAMES_CHARTOKA] = "Bitmaps/Character/Accessory/tileset_character_toka.png";
texturePaths[TEXTURENAMES_CHARHAIR] = "Bitmaps/Character/Helmet/tileset_character_hair.png";
texturePaths[TEXTURENAMES_WEAPONKIZILCIKSOPASI] = "Bitmaps/Character/Weapon/weapon_kizilcik_sopasi.png";
texturePaths[TEXTURENAMES_TILES_INTERIOR] = "Bitmaps/Environment/tiles_interior.png";
texturePaths[TEXTURENAMES_TILES_FOREST] = "Bitmaps/Environment/tiles_forest.png";
texturePaths[TEXTURENAMES_EMPTY] = "Bitmaps/System/empty.png";
}
bool TextureManager::Initialize() {
if (!SetTextures()) {
return false;
} else {
return true;
}
}
bool TextureManager::SetTextures() {
bool textureLoadedCorrectly = true;
for (int i = 0; i < TEXTURENAMES_TEXTURECOUNT; i++) {
if (!textures[i].loadFromFile(texturePaths[i])) {
textureLoadedCorrectly = false;
break;
}
}
return textureLoadedCorrectly;
}
sf::Texture* TextureManager::GetTexture(const int textureName) {
return &textures[textureName];
}
#include <iostream>
sf::Texture TextureManager::textures[TEXTURENAMES_TEXTURECOUNT];
std::string TextureManager::texturePaths[TEXTURENAMES_TEXTURECOUNT];
TextureManager::TextureManager() {
texturePaths[TEXTURENAMES_ARROWS] = "Bitmaps/System/arrows.png";
texturePaths[TEXTURENAMES_BUTTONS] = "Bitmaps/System/buttons.png";
texturePaths[TEXTURENAMES_FADE] = "Bitmaps/System/fade.png";
texturePaths[TEXTURENAMES_FONT] = "Bitmaps/System/game_font.png";
texturePaths[TEXTURENAMES_ICON] = "Bitmaps/System/icon.png";
texturePaths[TEXTURENAMES_LANGUAGES] = "Bitmaps/System/languages.png";
texturePaths[TEXTURENAMES_SHINE] = "Bitmaps/System/shine.png";
texturePaths[TEXTURENAMES_LOGO] = "Bitmaps/System/system_logo.png";
texturePaths[TEXTURENAMES_WHITEBRUSH] = "Bitmaps/System/white_brush.png";
texturePaths[TEXTURENAMES_CHARBODY] = "Bitmaps/Character/Base/tileset_character_body.png";
texturePaths[TEXTURENAMES_CHARDRESS] = "Bitmaps/Character/Armor/tileset_character_dress.png";
texturePaths[TEXTURENAMES_CHARTOKA] = "Bitmaps/Character/Accessory/tileset_character_toka.png";
texturePaths[TEXTURENAMES_CHARHAIR] = "Bitmaps/Character/Helmet/tileset_character_hair.png";
texturePaths[TEXTURENAMES_WEAPONKIZILCIKSOPASI] = "Bitmaps/Character/Weapon/weapon_kizilcik_sopasi.png";
texturePaths[TEXTURENAMES_TILES_INTERIOR] = "Bitmaps/Environment/tiles_interior.png";
texturePaths[TEXTURENAMES_TILES_FOREST] = "Bitmaps/Environment/tiles_forest.png";
texturePaths[TEXTURENAMES_EMPTY] = "Bitmaps/System/empty.png";
}
bool TextureManager::Initialize() {
if (!SetTextures()) {
return false;
} else {
return true;
}
}
bool TextureManager::SetTextures() {
bool textureLoadedCorrectly = true;
for (int i = 0; i < TEXTURENAMES_TEXTURECOUNT; i++) {
if (!textures[i].loadFromFile(texturePaths[i])) {
textureLoadedCorrectly = false;
break;
}
}
return textureLoadedCorrectly;
}
sf::Texture* TextureManager::GetTexture(const int textureName) {
return &textures[textureName];
}
Thank you so much. I don't know what to present more, so please ask more if you didn't understand a thing. (I didn't understand too actually )