当放入向量时,精灵对象不再渲染 创建一个小型的2D游戏,使用Direct3D 9和C++。我遇到了一个以前从未见过的问题。这个游戏是基于商店的,所以我有一个客户类。我已经在游戏中创建了这个对象,它呈现了我想要的效果。我决定将对象放在向量中,因为在某个时刻,我需要它们的集合。但是,我的问题是,当我将对象放入向量时,它在屏幕上不再可见

当放入向量时,精灵对象不再渲染 创建一个小型的2D游戏,使用Direct3D 9和C++。我遇到了一个以前从未见过的问题。这个游戏是基于商店的,所以我有一个客户类。我已经在游戏中创建了这个对象,它呈现了我想要的效果。我决定将对象放在向量中,因为在某个时刻,我需要它们的集合。但是,我的问题是,当我将对象放入向量时,它在屏幕上不再可见,c++,direct3d,direct3d9,C++,Direct3d,Direct3d9,我没有错误。我已经将DirectX函数的所有返回代码输出到一个测试文件中,没有失败。它运行正常,只是在屏幕上看不到而已!除了把它放进一个向量,没有什么变化 我将向量更改为指针向量,因为有人告诉我,向量只是创建对象,复制对象并删除原始对象。然而,使用这种方法,我的Direct3D指针很快就会失效。我想我知道出了什么问题,但不确定最佳的行动方案 以下是客户类别: #include "Headers.h" #include "Playercard.h" class Customer{ privat

我没有错误。我已经将DirectX函数的所有返回代码输出到一个测试文件中,没有失败。它运行正常,只是在屏幕上看不到而已!除了把它放进一个向量,没有什么变化

我将向量更改为指针向量,因为有人告诉我,向量只是创建对象,复制对象并删除原始对象。然而,使用这种方法,我的Direct3D指针很快就会失效。我想我知道出了什么问题,但不确定最佳的行动方案

以下是客户类别:

#include "Headers.h"
#include "Playercard.h"

class Customer{

private:

LPDIRECT3DTEXTURE9 texture, playerInfoCard;
D3DXVECTOR3 position, direction, playerCardPosition;
D3DXVECTOR3 center;
LPD3DXFONT font;
POINT curPos;

HRESULT rc;

//Playercard playerCard;
int depthBuffer;
int walkingAlternator;

// Some information about the customer

char name[10];
int age;
double cash;

int itemWanted;
char productWanted[20];

bool happy;
bool male;
bool female;
bool displayPlayerCard;

RECT textBox;

Playercard playercard;

void assignNameAndGender()
{
    srand((unsigned int)time(0));
    int name_decider = rand() % 16 + 1;

    switch(name_decider)
    {
    case 1:
        strcpy_s(name, "John");
        male = true; female = false;
        break;
    case 2:
        strcpy_s(name, "Chris");
        male = true; female = false;
        break;
    case 3:
        strcpy_s(name, "Ben");
        male = true; female = false;
        break;
    case 4:
        strcpy_s(name, "Jack");
        male = true; female = false;
        break;
    case 5:
        strcpy_s(name, "Jamie");
        male = true; female = false;
        break;
    case 6:
        strcpy_s(name, "Bill");
        male = true; female = false;
        break;
    case 7:
        strcpy_s(name, "Liam");
        male = true; female = false;
        break;
    case 8:
        strcpy_s(name, "Alex");
        male = true; female = false;
        break;
    case 9:
        strcpy_s(name, "Nikki");
        male = false; female = true;
        break;
    case 10:
        strcpy_s(name, "Alice");
        male = false; female = true;
        break;
    case 11:
        strcpy_s(name, "Lucy");
        male = false; female = true;
        break;
    case 12:
        strcpy_s(name, "Emily");
        male = false; female = true;
        break;
    case 13:
        strcpy_s(name, "Laura");
        male = false; female = true;
        break;
    case 14:
        strcpy_s(name, "Mary");
        male = false; female = true;
        break;
    case 15:
        strcpy_s(name, "Katie");
        male = false; female = true;
        break;
    case 16:
        strcpy_s(name, "Emma");
        male = false; female = true;
        break;
    }
}

void assignAge()
{
    srand((unsigned int)time(0));
    age = rand() % 53 + 12;          // An age between 12 and 65
}

void assignCash()
{
    if(age < 16)
        cash = 5.00;
    if(age >= 16 && age <= 18)
        cash = 15.00;
    if(age >= 19 && age <= 21)
        cash = 20.00;
    if(age >= 22 && age <= 25)
        cash = 25.00;
    if(age >= 26 && age <= 30)
        cash = 30.00;
    if(age > 31)
    {
        int randNum = rand() % 9 + 1;

        switch(randNum)
        {
        case 1:
            cash = 20.00;
            break;
        case 2:
            cash = 25.00;
            break;
        case 3:
            cash = 30.00;
            break;
        case 4:
            cash = 35.00;
            break;
        case 5:
            cash = 40.00;
            break;
        case 6:
            cash = 45.00;
            break;
        case 7:
            cash = 50.00;
            break;
        case 8:
            cash = 55.00;
            break;
        case 9:
            cash = 60.00;
            break;
        }
    }
}

public:

Customer()
{
    direction.x = (float)cos(0.558)*4;    // 30 degree movement
    direction.y = (float)sin(0.558)*4;    // 30 degree movement
    position.x = 500;
    position.y = 500;
    displayPlayerCard = false;  // Only true when mouse clicked
    happy = true;               // A new customer is always happy at first!
    walkingAlternator = 1;      // Help control sprite movement

    strcpy_s(productWanted, "Xbox");
    assignNameAndGender();      // Assign customer a name
    assignAge();                // Assign customer an age
    assignCash();               // Assign customer an amount of cash
    playercard.load(name, male, age, cash, productWanted);
}

~Customer()
{
}


void move()
{
    if(KEY_DOWN(0x57) || KEY_DOWN(VK_UP))
    {
        position.y -= direction.y;
        position.x += direction.x;
        walkingUp();
    }
    else if(KEY_DOWN(0x41) || KEY_DOWN(VK_LEFT))
    {
        position.y -= direction.y;
        position.x -= direction.x;
        walkingLeft();
    }
    else if(KEY_DOWN(0x53) || KEY_DOWN(VK_DOWN))
    {
        position.y += direction.y;
        position.x -= direction.x;
        walkingDown();
    }
    else if(KEY_DOWN(0x44) || KEY_DOWN(VK_RIGHT))
    {
        position.y += direction.y;
        position.x += direction.x;
        walkingRight();
    }
    else
    {
        // Reset the sprite here so that the feet are together in resting position AND so that sprite is facing the way it was going when it stopped
    }
}

void loadGraphics()
{
    D3DXCreateTextureFromFileEx(d3dDevice, "player_information_card.png", D3DX_DEFAULT_NONPOW2, D3DX_DEFAULT_NONPOW2, 0, 0, 
        D3DFMT_UNKNOWN, D3DPOOL_DEFAULT, D3DX_DEFAULT, D3DX_DEFAULT, D3DCOLOR_XRGB(255, 255, 255), NULL, NULL, &playerInfoCard);

    D3DXCreateTextureFromFileEx(d3dDevice, "Characters/female_shopper1.png", D3DX_DEFAULT_NONPOW2, D3DX_DEFAULT_NONPOW2, 0, 0,
        D3DFMT_UNKNOWN, D3DPOOL_DEFAULT, D3DX_DEFAULT, D3DX_DEFAULT, D3DCOLOR_XRGB(255, 255, 255), NULL, NULL, &texture);

    D3DXVECTOR3 position(100.0f, 100.0f, 0.0f);
    D3DXVECTOR3 center(0.0f, 0.0f, 0.0f);

    D3DXCreateFont(d3dDevice,                   // the D3D Device
               20,                              // font height of 30
               0,                               // default font width
               FW_NORMAL,                       // font weight
               1,                               // not using MipLevels
               false,                           // italic font
               DEFAULT_CHARSET,                 // default character set
               OUT_DEFAULT_PRECIS,              // default OutputPrecision,
               DEFAULT_QUALITY,                 // default Quality
               DEFAULT_PITCH | FF_DONTCARE,     // default pitch and family
               "Georgia",                       // use Facename Arial
               &font);                          // the font object    
}

void draw()
{
    d3dSprite->Draw(texture, NULL, &center, &position, D3DCOLOR_ARGB(255, 255, 255, 255));

    if(displayPlayerCard) 
    {
        playerCardPosition = position;
        playerCardPosition.y -= 128;
        playerCardPosition.x += 32;

        SetRect(&textBox, (int)playerCardPosition.x+5, (int)playerCardPosition.y+5, (int)playerCardPosition.x+256-5, (int)playerCardPosition.y+128-5);

        d3dSprite->Draw(playerInfoCard, NULL, &center, &playerCardPosition, D3DCOLOR_ARGB(255, 255, 255, 255));
        font->DrawTextA(d3dSprite, playercard.plCard().c_str(), -1, &textBox, DT_LEFT, D3DCOLOR_ARGB(255, 255, 255, 255));
    }
}

void walkingDown()
{
    if(walkingAlternator == 1 || walkingAlternator == 2 || walkingAlternator == 3 || walkingAlternator == 4 || walkingAlternator == 5 
        || walkingAlternator == 6 || walkingAlternator == 7 || walkingAlternator == 8 || walkingAlternator == 9 || walkingAlternator == 10)
    {
        D3DXCreateTextureFromFileEx(d3dDevice, "Characters/female_shopper2.png", D3DX_DEFAULT_NONPOW2, D3DX_DEFAULT_NONPOW2, 0, 0, D3DFMT_UNKNOWN, D3DPOOL_DEFAULT,
        D3DX_DEFAULT, D3DX_DEFAULT, D3DCOLOR_XRGB(255, 255, 255), NULL, NULL, &texture);
        walkingAlternator++;
    }
    else if(walkingAlternator == 11 || walkingAlternator == 12 || walkingAlternator == 13 || walkingAlternator == 14 || walkingAlternator == 15
        || walkingAlternator == 16 || walkingAlternator == 17 || walkingAlternator == 18 || walkingAlternator == 19 || walkingAlternator == 20)
    {
        D3DXCreateTextureFromFileEx(d3dDevice, "Characters/female_shopper3.png", D3DX_DEFAULT_NONPOW2, D3DX_DEFAULT_NONPOW2, 0, 0, D3DFMT_UNKNOWN, D3DPOOL_DEFAULT,
        D3DX_DEFAULT, D3DX_DEFAULT, D3DCOLOR_XRGB(255, 255, 255), NULL, NULL, &texture);
        walkingAlternator++;
    }

    if(walkingAlternator >= 20)
    {
        walkingAlternator = 1;
    }
}

void walkingUp()
{
    if(walkingAlternator == 1 || walkingAlternator == 2 || walkingAlternator == 3 || walkingAlternator == 4 || walkingAlternator == 5 
        || walkingAlternator == 6 || walkingAlternator == 7 || walkingAlternator == 8 || walkingAlternator == 9 || walkingAlternator == 10)
    {
        D3DXCreateTextureFromFileEx(d3dDevice, "Characters/female_shopper1_back2.png", D3DX_DEFAULT_NONPOW2, D3DX_DEFAULT_NONPOW2, 0, 0, D3DFMT_UNKNOWN, D3DPOOL_DEFAULT,
        D3DX_DEFAULT, D3DX_DEFAULT, D3DCOLOR_XRGB(255, 255, 255), NULL, NULL, &texture);
        walkingAlternator++;
    }
    else if(walkingAlternator == 11 || walkingAlternator == 12 || walkingAlternator == 13 || walkingAlternator == 14 || walkingAlternator == 15
        || walkingAlternator == 16 || walkingAlternator == 17 || walkingAlternator == 18 || walkingAlternator == 19 || walkingAlternator == 20)
    {
        D3DXCreateTextureFromFileEx(d3dDevice, "Characters/female_shopper1_back1.png", D3DX_DEFAULT_NONPOW2, D3DX_DEFAULT_NONPOW2, 0, 0, D3DFMT_UNKNOWN, D3DPOOL_DEFAULT,
        D3DX_DEFAULT, D3DX_DEFAULT, D3DCOLOR_XRGB(255, 255, 255), NULL, NULL, &texture);
        walkingAlternator++;
    }

    if(walkingAlternator >= 20)
    {
        walkingAlternator = 1;
    }
}

void walkingLeft()
{
    if(walkingAlternator == 1 || walkingAlternator == 2 || walkingAlternator == 3 || walkingAlternator == 4 || walkingAlternator == 5 
        || walkingAlternator == 6 || walkingAlternator == 7 || walkingAlternator == 8 || walkingAlternator == 9 || walkingAlternator == 10)
    {
        D3DXCreateTextureFromFileEx(d3dDevice, "Characters/female_shopper1_back3.png", D3DX_DEFAULT_NONPOW2, D3DX_DEFAULT_NONPOW2, 0, 0, D3DFMT_UNKNOWN, D3DPOOL_DEFAULT,
        D3DX_DEFAULT, D3DX_DEFAULT, D3DCOLOR_XRGB(255, 255, 255), NULL, NULL, &texture);
        walkingAlternator++;
    }
    else if(walkingAlternator == 11 || walkingAlternator == 12 || walkingAlternator == 13 || walkingAlternator == 14 || walkingAlternator == 15
        || walkingAlternator == 16 || walkingAlternator == 17 || walkingAlternator == 18 || walkingAlternator == 19 || walkingAlternator == 20)
    {
        D3DXCreateTextureFromFileEx(d3dDevice, "Characters/female_shopper1_back4.png", D3DX_DEFAULT_NONPOW2, D3DX_DEFAULT_NONPOW2, 0, 0, D3DFMT_UNKNOWN, D3DPOOL_DEFAULT,
        D3DX_DEFAULT, D3DX_DEFAULT, D3DCOLOR_XRGB(255, 255, 255), NULL, NULL, &texture);
        walkingAlternator++;
    }

    if(walkingAlternator >= 20)
    {
        walkingAlternator = 1;
    }
}

void walkingRight()
{
    if(walkingAlternator == 1 || walkingAlternator == 2 || walkingAlternator == 3 || walkingAlternator == 4 || walkingAlternator == 5 
        || walkingAlternator == 6 || walkingAlternator == 7 || walkingAlternator == 8 || walkingAlternator == 9 || walkingAlternator == 10)
    {
        D3DXCreateTextureFromFileEx(d3dDevice, "Characters/female_shopper4.png", D3DX_DEFAULT_NONPOW2, D3DX_DEFAULT_NONPOW2, 0, 0, D3DFMT_UNKNOWN, D3DPOOL_DEFAULT,
        D3DX_DEFAULT, D3DX_DEFAULT, D3DCOLOR_XRGB(255, 255, 255), NULL, NULL, &texture);
        walkingAlternator++;
    }
    else if(walkingAlternator == 11 || walkingAlternator == 12 || walkingAlternator == 13 || walkingAlternator == 14 || walkingAlternator == 15
        || walkingAlternator == 16 || walkingAlternator == 17 || walkingAlternator == 18 || walkingAlternator == 19 || walkingAlternator == 20)
    {
        D3DXCreateTextureFromFileEx(d3dDevice, "Characters/female_shopper5.png", D3DX_DEFAULT_NONPOW2, D3DX_DEFAULT_NONPOW2, 0, 0, D3DFMT_UNKNOWN, D3DPOOL_DEFAULT,
        D3DX_DEFAULT, D3DX_DEFAULT, D3DCOLOR_XRGB(255, 255, 255), NULL, NULL, &texture);
        walkingAlternator++;
    }

    if(walkingAlternator >= 20)
    {
        walkingAlternator = 1;
    }
}

void checkInteractivity()
{
    GetCursorPos(&curPos);
    if (GetKeyState(VK_LBUTTON) & 0x80 &&                        
        curPos.x >= position.x && curPos.x <= position.x+64 &&   
        curPos.y >= position.y && curPos.y <= position.y+128)    
    {
        displayPlayerCard = true;
    }
    else
    {
        displayPlayerCard = false;
    }
}

D3DXVECTOR3 returnPosition()
{
    return position;
}

D3DXVECTOR3 returnPosition(bool returnCentreOfSprite)
{
    return position;
}

};
#包括“Headers.h”
#包括“Playercard.h”
类客户{
私人:
LPDIRECT3DTEXTURE9纹理,PlayerFoCard;
D3DXVECTOR3位置、方向、播放卡位置;
D3DXVECTOR3中心;
LPD3DXFONT字体;
curPos点;
HRESULT rc;
//玩家卡玩家卡;
int深度缓冲区;
int-walkingAlternator;
//关于客户的一些信息
字符名[10];
智力年龄;
双倍现金;
通缉非法入境者;
需要的字符[20];
布尔快乐;
布尔男性;
布尔女性;
bool-displayercard;
矩形文本框;
玩家卡玩家卡;
void assignNameAndGender()
{
srand((无符号整数)时间(0));
int name_decider=rand()%16+1;
开关(名称\决策器)
{
案例1:
strcpy_s(姓名,“John”);
男性=正确;女性=错误;
打破
案例2:
strcpy_s(姓名,“克里斯”);
男性=正确;女性=错误;
打破
案例3:
strcpy_s(名称,“Ben”);
男性=正确;女性=错误;
打破
案例4:
strcpy_s(姓名,“杰克”);
男性=正确;女性=错误;
打破
案例5:
strcpy_s(姓名,“Jamie”);
男性=正确;女性=错误;
打破
案例6:
strcpy_s(名称,“账单”);
男性=正确;女性=错误;
打破
案例7:
strcpy_s(名称,“Liam”);
男性=正确;女性=错误;
打破
案例8:
strcpy_s(姓名,“Alex”);
男性=正确;女性=错误;
打破
案例9:
strcpy_s(名称,“Nikki”);
男=假;女=真;
打破
案例10:
strcpy_s(姓名,“Alice”);
男=假;女=真;
打破
案例11:
strcpy_s(姓名,Lucy);
男=假;女=真;
打破
案例12:
strcpy_s(姓名,“Emily”);
男=假;女=真;
打破
案例13:
strcpy_s(姓名,“劳拉”);
男=假;女=真;
打破
案例14:
strcpy_s(姓名,“玛丽”);
男=假;女=真;
打破
案例15:
strcpy_s(姓名“Katie”);
男=假;女=真;
打破
案例16:
strcpy_s(姓名,“Emma”);
男=假;女=真;
打破
}
}
无效转让()
{
srand((无符号整数)时间(0));
年龄=兰德()%53+12;//12到65岁之间的年龄
}
无效现金()
{
if(年龄<16岁)
现金=5.00;
如果(年龄>=16岁&&age=19岁&&age=22岁&&age=26岁&&age=31岁)
{
int randNum=rand()%9+1;
开关(随机数)
{
案例1:
现金=20.00;
打破
案例2:
现金=25.00;
打破
案例3:
现金=30.00;
打破
案例4:
现金=35.00;
打破
案例5:
现金=40.00;
打破
案例6:
现金=45.00;
打破
案例7:
现金=50.00;
打破
案例8:
现金=55.00;
打破
案例9:
现金=60.00;
打破
}
}
}
公众:
客户()
{
方向x=(浮动)cos(0.558)*4;//30度移动
方向y=(浮动)sin(0.558)*4;//30度移动
位置x=500;
位置y=500;
displayPlayerCard=false;//仅当鼠标单击时为true
happy=true;//新客户一开始总是很高兴的!
walkingAlternator=1;//帮助控制精灵移动
strcpy_s(产品通缉令,“Xbox”);
assignNameAndGender();//为客户指定一个名称
assignAge();//为客户分配年龄
assignCash();//为客户分配一定数量的现金
playercard.load(姓名、男性、年龄、现金、所需产品);
}
~Customer()
{
}
无效移动()
{
if(向下键(0x57)|向下键(向上键))
{
位置.y-=方向.y;
位置x+=方向x;
walkingUp();
}
else if(向下键(0x41)|向下键(VK_左))
{
位置.y-=方向.y;
位置.x-=方向.x;
左行走();
}
else if(向下键(0x53)|向下键(向下键(VK))
{
位置y+=方向y;
位置.x-=方向.x;
向下行走();
}
else if(向下键(0x44)|向下键(右键))
{
位置y+=方向y;
位置x+=方向x;
右行走();
}
其他的
{
//在此处重置精灵,使双脚在静止位置并拢,使精灵朝向停止时的行进方向
}
}
void loadGraphics()
{
D3DXCreateTextureFromFileEx(d3dDevice,“播放器信息卡.png”、D3DX默认值非POW2、D3DX默认值非POW2、0、0、,
D3DFMT_未知、D3DPOOL_默认、D3DX_默认、D3DX_默认、D3DCOLOR_XRGB(255、255、255)、NULL、NULL和playerIn
#include "Headers.h."
#include "Customer.h"
#include "Background.h"
#include "Counter.h"
#include "GameStations.h"
#include "ConsoleCab.h"
#include "ClothesStand.h"
#include "GamePanel.h"

    std::vector<Customer*> customers;

Background background;
Counter counter;
GameStations gameStations;
ConsoleCab consoleCab;
ClothesStand clothesStand;
GamePanel gamePanel;

void initDirectX(HWND hWnd);       // Initializes Direct3D Graphics
void render();                     // Render graphics
void cleanUp();                    // Cleans everything up and releases memory

LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
    HWND hWnd;                                          // The handle to the window function
    WNDCLASSEX window;                                  // Pointer to window struct
    ZeroMemory(&window, sizeof(WNDCLASSEX));            // Clears window class so we can use it
    window.cbSize = sizeof(WNDCLASSEX);                 // Size of window
    window.style = CS_HREDRAW | CS_VREDRAW;             // Redraws the entire window if a movement or size adjustment changes the height of the client area. 
    window.lpfnWndProc = WindowProc;                    // Pointer to the window procedure
    window.hInstance = hInstance;                       // Handle to current instance
    window.hCursor = LoadCursor(NULL, IDC_ARROW);       // We'll stick with the normal cursor here
    window.lpszClassName = "Window";                    // Gives the class a name
    RegisterClassEx(&window);                           // Registers the window class 

    hWnd = CreateWindowEx(NULL,
        "Window",                     // Name of the class
        "Space Game",                 // Title of the window
        WS_EX_TOPMOST | WS_POPUP,     // Fullscreen
        0, 0,                         // Position of window (0,0 for fullscreen)
        SCREEN_WIDTH, SCREEN_HEIGHT,  // Screen resolution (Uses global declaration)
        NULL,                         // Parent window (None)
        NULL,                         // Menus (None)
        hInstance,                    // Application handle
        NULL);                        // Set to NULL as we aren't using more than 1 window

    ShowWindow(hWnd, nCmdShow);                         // Display window
    initDirectX(hWnd);                                  // Initialises the directX graphics
    MSG msg = {0};                                      // msg holds the Windows events message queue

    customers.push_back(new Customer());

    for (std::vector<Customer*>::iterator customerIT = customers.begin(); customerIT != customers.end(); customerIT++)
    {
         (*customerIT)->loadGraphics();
    } // Object properties become invalid here.

    background.loadGraphics();
    counter.loadGraphics();
    gameStations.loadGraphics();
    consoleCab.loadGraphics();
    clothesStand.loadGraphics();
    gamePanel.loadGraphics();

    /************************************** Main game loop *************************************************/

    while(TRUE)                                         // Main game loop
    {
        if(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))     // If messages are waiting
        {
            TranslateMessage(&msg);                      // Translates the keystroke messages into the correct format
            DispatchMessage(&msg);                       // Sends message to the windowsProc function
            if(msg.message == WM_QUIT)                   // If the message was a quit message
                break;                                   // Breaks out of main game loop
        }
        else                  
        {

        for (std::vector<Customer*>::iterator customerIT = customers.begin(); customerIT != customers.end(); customerIT++)
        {
            (*customerIT)->checkInteractivity();
            (*customerIT)->move();
        }

            gamePanel.hoverDetection();
            render();
        }
    }

    /*******************************************************************************************************/

    // We are out of the main game loop (Due to a WM_QUIT signal)
    cleanUp();                                          // Do some housekeeping before quitting
    return msg.wParam;                                  // Return the WM_QUIT message to Windows. End of program
}

LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    switch(message)                                     // Sorts through messages
    {
    case WM_DESTROY:                                // When window has been closed
        {
            PostQuitMessage(0);                     // Closes the application
            return 0;  
        } 
        break;
    }
    return DefWindowProc (hWnd,                         // Returns any messages the switch statement didn't pick up
        message,
        wParam,
        lParam);
}

void initDirectX(HWND hWnd)
{
    d3d = Direct3DCreate9(D3D_SDK_VERSION);              // Create DirectX9 interface
    D3DPRESENT_PARAMETERS d3dParameters;                 // Pointer to DirectX9 parameters

    ZeroMemory(&d3dParameters, sizeof(d3dParameters));   // Clears the structure so we can use it
    d3dParameters.Windowed = FALSE;                      // Fullscreen
    d3dParameters.SwapEffect = D3DSWAPEFFECT_DISCARD;    // Get rid of old framess
    d3dParameters.hDeviceWindow = hWnd;                  // Sets the window to be used by Direct3D
    d3dParameters.BackBufferFormat = D3DFMT_X8R8G8B8;    // Sets the back buffer format to 32-bit
    d3dParameters.BackBufferWidth = SCREEN_WIDTH;        // Sets the width of the buffer
    d3dParameters.BackBufferHeight = SCREEN_HEIGHT;      // Sets the height of the buffer

    d3d->CreateDevice(D3DADAPTER_DEFAULT,                // Creates a device class
        D3DDEVTYPE_HAL,
        hWnd,
        D3DCREATE_SOFTWARE_VERTEXPROCESSING,
        &d3dParameters,
        &d3dDevice);

    D3DXCreateSprite(d3dDevice, &d3dSprite);
}

void render()
{
    d3dDevice->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(10, 0, 32), 1.0f, 0);   // Clears the screen to a dark blue
    d3dDevice->BeginScene();                                                         // Begins Direct3D scene
    d3dSprite->Begin(D3DXSPRITE_ALPHABLEND);                                         // Begin sprite drawing

    background.draw();

    counter.draw();
    gameStations.draw();
    consoleCab.draw();
    clothesStand.draw();
    gamePanel.updateInformation(564.55, 800.56, 1034.54, "July");


    for (std::vector<Customer*>::iterator customerIT = customers.begin(); customerIT != customers.end(); customerIT++)
    {
        (*customerIT)->draw();
    }

    gamePanel.draw();

    d3dSprite->End();                                                                // End drawing
    d3dDevice->EndScene();                                                           // Ends the Direct3D scene
    d3dDevice->Present(NULL, NULL, NULL, NULL);                                      // Presents the Direct3D scene (Displays to screen)
}

void cleanUp()
{
    d3dDevice->Release();   // Closes the Direct3D device and releases memory
    d3d->Release();         // Closes Direct3D and releases memory
}
std::vector<Customer*> customers;
customers.push_back(new Customer());
D3DXVECTOR3 position(100.0f, 100.0f, 0.0f);
D3DXVECTOR3 center(0.0f, 0.0f, 0.0f);