   Structs and Textures
  I've recently been working on a platformer, and ran into a wierd bug.  I'm not sure if its due to my data losing scope or what, but I created a class that holds the information about the world.  Well I also included an array to hold information about each cell, and of course one of these would be the texture being used for that cell.  Now when I try to use that texture to draw my sprites to the screen they never show up.  So after a bit of working, I transfered the texture information out of the struct and made it its own array, and it works fine.  Anyone know a reason behind this?  The rest of the data from the struct works fine and can update at the same location where I need to draw, but for some reason I can't retrieve any texture information.  Thanks for your time.Slyprid   
  Without more details its near impossible to tell for sure.Was the field a IDirect3DTexture9* pointer? (if so, were you AddRef'ing copies, or re-loading per-tile?), if not, then what information are you storing?What are the debug runtimes saying?Using an invalid texture sometimes generates a debug message, if not you'll get a solid white (iirc) colour instead.hthJack   ;  Was wondering if I should throw the code in or not.  Well let me try to give it a shot.Main loopAll this is is where the rendering is happeningsprite->Draw(world->cells[y][x],0,0);World class#pragma once#include <d3d9.h>#include <d3dx9.h>#include <d3dx9math.h>#include <assert.h>#include <string>#include "DX.h"using namespace std;class clsWorld{private:    struct cellData{LPDIRECT3DTEXTURE9 texture;LPDIRECT3DTEXTURE9 overlay;bool overlay_visible;string event_type;int event_LocX;int event_LocY;bool textured;};public:clsWorld();int world;int stage;int cellTotal;int worldLength;int worldHeight;int FocusX;int FocusY;int back1X;int back2X;LPD3DXSPRITE handler;    cellData cells[4][50];LPDIRECT3DTEXTURE9 LoadTexture(char *filename, D3DCOLOR transcolor);};extern clsWorld *world;In the main I declare clsWorld *world like I do with all my other externs, but like I said the texture info within the struct doesn't seem to show up.  Will try to get what debug is saying and post also.  Thanks for your time.Slyprid   ;  You are passing the entire struct into the draw call.  Try this:sprite->Draw(world->cells[y][x].texture,0,0);Also, you don't seem to be giving the call all the parms it needs.  I am not really familiar with sprites, but what about:CONST RECT * pSrcRect,CONST D3DXVECTOR3 * pCenter,CONST D3DXVECTOR3 * pPosition,D3DCOLOR ColorMaybe you are using an older SDK version?;  The draw command I use is just a function. Thats why its only 3 parameters.  I forgot to type in the .texture for the struct on the command also.  Thats what i'm actually using.   