티스토리 뷰

API/DF.project

scenetower.h & scenetower.cpp

猫猫 2014. 10. 9. 17:29
반응형


/////////////////scenetower.h//////////////////
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#pragma once
#include "Scene.h"
#include "ObjectBGA.h"
#include "ObjectHero.h"
#include "ObjectBullet.h"
 
class Scene_Tower : public Scene
{
protected:
    ObjectBGA*      m_pBGA;
    ObjectHero*      m_pHero;
    ObjectBullet*   m_pBullet;
 
    HBITMAP         m_hBGA;
    HBITMAP         m_hHero;
    HBITMAP         m_hBullet;
 
public:
    virtual bool init();
    virtual void dealloc();
};


////////////////////scenetower.cpp/////////////////
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include "Scene_Tower.h"
#include "resource.h"
#include "ST.h"
#include "BulletManager.h"
 
bool Scene_Tower::init()
{
    Scene::init();
    BulletManager::sharedManager()->setScene(this); //총알이그려질 씬 선택
 
    HDC m= ST::call()->m_hMemDC;
    HDC b = ST::call()->m_hBackDC;
 
    //배경 로드
    m_hBGA      = ST::call()->GetBmp(IDB_BITMAP2);
    m_pBGA      = new ObjectBGA;
    m_pBGA->init(m_hBGA);
    this->addObject(m_pBGA);
 
    //주인공 로드
    m_hHero      = ST::call()->GetBmp(IDB_BITMAP1);
    m_pHero      = new ObjectHero;
    m_pHero->init(m_hHero);
    //m_pHero->setSpeed( rand()%1000 +100 );
    m_pHero->setPosition(ccp( 50, 20 ));
    this->addObject(m_pHero);
 
    //총알 로드
    m_hBullet      = ST::call()->GetBmp(IDB_BITMAP3);
    return true;
}
 
void Scene_Tower::dealloc()
{
    DeleteObject(m_hBGA);
    DeleteObject(m_hHero);
    DeleteObject(m_hBullet);
    for(int i =0 ; i<MAX_OBJECT; i++)
    {
        if(m_pObjectList[i] != NULL)delete[] m_pObjectList[i];
    }
}
 


반응형

'API > DF.project' 카테고리의 다른 글

objectBGA.h & objectbga.cpp  (0) 2014.10.09
header.h & header.cpp  (0) 2014.10.09
bulletmanager.h & bulletmanager.cpp  (0) 2014.10.09
objecthero.h & objecthero.cpp  (0) 2014.10.09
Scene.h & Scene.cpp  (0) 2014.10.09