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 - JohnnyMccrum

Pages: [1]
1
General / Re: All sprites showing as white boxes.
« on: May 05, 2016, 05:56:53 pm »
Thanks for being of absolutely no help.

Fixed it myself, there's absolutely no need to patronize me.

last time I post here.

2
General / Re: All sprites showing as white boxes.
« on: May 05, 2016, 05:32:12 pm »
that doesn't really solve my issue though. How do I fix the pointer issue?

I'm rather new to pointers.

Surely sheetIMG should still store those textures as it's declared in my header?

3
General / All sprites showing as white boxes.
« on: May 05, 2016, 05:23:42 pm »
Not sure what I'm doing wrong here.

when I display my textures with

Quote
window.draw(Spritesheet.at(1));

they all appear as white squares.

I have these variables in my main.h


Quote
//the main spritesheet.

Image sheetIMG;

//array to hold circles.
vector<CircleShape> Circles;

//array to hold sprites.
vector<Sprite> Spritesheet;

below is the offending code.




Quote
int LoadSpritesheet()
{
   //make sure spritesheet exists, then loads it into an image.

   Texture sheet;
   if (!sheet.loadFromFile("Sprites/A.png"))
   {
      return 0;
   }
   else
   {
      sheetIMG = sheet.copyToImage();
      MakeSprites();
      return 1;
   }
      

}

void MakeSprites()
{
   //turns the entire spritesheet into 8x8 modular sprites.

   Texture tex;

   int c = 0, r = 0;

   for (int i = 0; i <= (sheetIMG.getSize().x * sheetIMG.getSize().y) / 64; i++)
   {

      if (i == 125)
      {

         Sprite sprsdsds;
      }

      if (!tex.loadFromImage(sheetIMG, IntRect(0, 0, 8, 8)))
         break;
      else
      {
              Sprite spr;
              spr.setTexture(tex);
         Spritesheet.push_back(spr);
         c += 8;
         if (c == 16) { r++; };

      }
   }
   
   

         
}

Pages: [1]
anything