Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Jatentaki

Pages: [1]
1
Graphics / [Solved] Problem with sf::sprite.SetImage problem
« on: May 08, 2009, 07:23:42 pm »
Ah, I forgot sprite is just a pointer to image :/ Sorry for your waste of time

2
Graphics / [Solved] Problem with sf::sprite.SetImage problem
« on: May 08, 2009, 07:13:50 pm »
Code: [Select]

    sf::Image Image;
    // Create the sprite
    sf::Sprite Sprite[20][20];

Here is Sprite declaration and I will have a look at resource manager in a moment ;)

3
Graphics / [Solved] Problem with sf::sprite.SetImage problem
« on: May 08, 2009, 06:42:15 pm »
Code: [Select]

int temp;
fin >> temp;
if (temp == 1)
{
   if (!Image.LoadFromFile("s596.bmp"))
   {
      fout << "Error s596.bmp" << std::endl;
   }
   else
   {
      fout << "s596.bmp loaded" << std::endl;
   }
   Sprite[i][j].SetImage(Image);
}
   if (temp == 2)
  {
     if (!Image.LoadFromFile("s543.bmp"))
     {
        fout << "Error s543.bmp" << std::endl;
     }
     else
     {
        fout << "s543.bmp loaded" << std::endl;
     }
     Sprite[i][j].SetImage(Image);
}
Sprite[i][j].SetPosition(0.f+(32*j), 0.f+(32*i));


I am using this inside a loop whichs aim is to write a array of 32x32px pictures in a nice square using data from file :) As you see it reads to temp variable a number from this map file and then in one case shows first picture and in second case second picture. I am new to programming graphic things so correct me if im wrong but i think creating huge amounts of sf::image files would be a waste of RAM so i try to reuse this variable. The problem is that whole square consists of sprites of only one kind (s596.bmp). As you can see I made a nice log but it shows that both types are being loaded and there are no errors in it. Whats the problem?

1) I used search and didnt find solution
2) I changed the error/no error messages to log from polish to english but if its the cause of problems im not gonna use c++ anymore  :P

Pages: [1]
anything