游戏开发论坛

 找回密码
 立即注册
搜索
查看: 22751|回复: 15

C++???? Design Pattern??(1) - Inheritance VS Delegation

[复制链接]

27

主题

179

帖子

259

积分

中级会员

Rank: 3Rank: 3

积分
259
发表于 2006-10-25 14:14:00 | 显示全部楼层 |阅读模式
======================================================
????????????????  ???? ????
<c++ programming language>???????????
????Aear?????, ???
======================================================

????C++??????Aear??????????????????C++??????????????????C++?OO?????????????Aear????????????????????????????? ISO, <<The C++ programming language>>???????????

??????Aear??????????? Aear??????DirectX??shader??game???????????????????????????????????aear????????????????????????????Aear??????????????????????DirectX?OpenGL??API??????????????????????????????????????
       1. ?? ???????????????????????????????
       2. ???????? ??????????
       3. C/C++????????? ?????????????1?3?????????
       4. ????????? ???????????
       ===========????????Aear??????????????=========
       5. ????????????
       6. ???????????????
       7. Windows ?????????????????
       8. ????
       9. API (DirectX OpenGL)?

5?7????????????????????????1?8????DirectX?OpenGL???1????????1???????

??Aear??????????50%???30%?????????????????????? 20%?????10%?????????????????????????DirectX?OpenGL????????Demo??????????????????????????????????????????????????Blizzard?????????

Requirements

    * Strong C/C++ and PC programming skills.
    * Minimum of 2 years experience programming at least one title that has already shipped.
    * A passion for games and game development.
    * Good communication skills.
    * Bachelor's degree in Computer Science or a related field.

Plusses

    * Graphics or sound programming experience.
    * Strong math background.
    * Experience in game design.
    * Knowledge of Win32 and DirectX API's.
    * Prior work experience on an MMORPG.

????DirectX????2???plus??????????????????blizzard??????????????DirectX????

=====================???=====================
???????????????????const ? reference????????????C?????????C++?????????

C++????object?????????object????? ??????object class?

class CBitmap{
public:
    CBitmap();
    ~CBitmap();
private:
    const static UINT32 MAX_BUFFER_SIZE = 65536;
    UINT32 m_Height;
    UINT32 m_Width;
    BYTE    m_Buffer[MAX_BUFFER_SIZE];
};

??????????DrawBitmap???????????????
========?????========
void DrawBitmap(CBitmap Bitmap);
========?????========
void DrawBitmap(CBitmap & Bitmap);
?????????????????????????CBitmap object????Bitmap????????DrawBitmap????????????????????CBitmap???????????m_Buffer?????????reference??? "&"?????????????DrawBitmap??????Bitmap?????????????????????????const???????DrawBitmap???????
void DrawBitmap(const CBitmap & Bitmap);

??????DrawBitmap??????CBitmap????const????????????

class CBitmap{
public:
    CBitmap();
    ~CBitmap();
    UINT32 GetHeight(void) const;
    void SetHeight(void);
private:
    const static UINT32 MAX_BUFFER_SIZE = 65536;
    UINT32 m_Height;
    UINT32 m_Width;
    BYTE    m_Buffer[MAX_BUFFER_SIZE];
};

UINT32 CBitmap::GetHeight(void) const
{
   return m_Height;
}

void CBitmap::SetHeight(UINT32 Height)
{
  m_Height = Height;
}

??????? UINT32 GetHeight(void) const; ??const??????????????CBitmap????????SetHeight()???m_Height,???????const. ?DrawBitmap????????const?????????const????
void DrawBitmap(const CBitmap & Bitmap)
{
    Bitmap.GetHeight();        // ???????
    Bitmap.SetHeight(100);   // ???Bitmap?const??
}

??????????class????????????????? const ???????????????

??????CBitmap????????????CNormalMap?????????????CNormalMap?code??

class CBitmap {
.....
// ??
Private:
    CNormalMap NormalMap;
public:
    CNormalMap GetNormalMap(void);
}

???????????????????????????CNormalMap?????????????????????????????????Class??????????????????CNormalMap?????????????????????????????2?????????

class CBitmap {
.....
// ??
Private:
    CNormalMap NormalMap;
public:
    CNormalMap GetNormalMap(void);
    const CNormalMap & GetStaticNormalMap(void);
}
????C++????????????
class CBitmap {
.....
// ??
Private:
    CNormalMap NormalMap;
public:
    CNormalMap GetNormalMap(void);
    const CNormalMap & GetNormalMap(void) const;
}

?????????NormalMap?????????GetStaticNormalMap() ?? GetNormalMap() ?const??????????????reference????

===============================================
C++?????????const?reference?????????? ????Design Pattern??????Design Pattern?????????????OO??????????Aear????Design Pattern???????????????????????????Design Pattern?????????Inheritance ? Delegation.

??Inheritance?????????C++???????????????CBitmap?????????????CTexture??????CBitmap??????GetBitmapHeight??????????

class CTexture : public CBitmap {
public:
    CTexture();
    ~CTexture();
};

?????????????????????CBitmap??CTexture?????????Delegation??????

class CTexture {
public:
    CTexture();
    ~CTexture();
private:
    CBitmap InternalBitmap;
public:
    UINT32 GetHeight(void) {   return InternalBitmap.GetBitmapHeight();  };   
};

??Inheritance?Delegation?????Aear?????????????????????????????Aear????????Delegation?????????Inheritance?????????class????????????????????

???????? ??CTexture?CBitmap???GetBitmapHeight ?????CTexture????Bitmap?????????mipmap?????????? GetTextureHeight()? ??GetTextureHeight??????texture size???? ??????????????????????GetBitmapHeight?????????????????????texture??????????????????

????????????Delegation???????????Design Pattern?Interface??????Inheritance ???????.

?????????????????????????????????????BLOG????????? http://blog.sina.com.cn/u/1261532101 ????

8

主题

716

帖子

716

积分

高级会员

Rank: 4

积分
716
发表于 2006-10-25 18:04:00 | 显示全部楼层

Re:C++???? Design Pattern??(1) - Inheritance VS Delegation

Aear???
???????More/Effective C++???More/Exception C++??

121

主题

2029

帖子

2034

积分

金牌会员

Rank: 6Rank: 6

积分
2034
QQ
发表于 2006-10-25 20:01:00 | 显示全部楼层

Re:C++???? Design Pattern??(1) - Inheritance VS Delegation

????concept????????????????????

2

主题

18

帖子

18

积分

新手上路

Rank: 1

积分
18
发表于 2006-10-27 10:38:00 | 显示全部楼层

Re:C++???? Design Pattern??(1) - Inheritance VS Delegation

????????????????????????

29

主题

405

帖子

405

积分

中级会员

Rank: 3Rank: 3

积分
405
发表于 2006-10-27 15:04:00 | 显示全部楼层

Re:C++???? Design Pattern??(1) - Inheritance VS Delegation

?????????????,?????DX???????????,???????.
????IQ???????

187

主题

6490

帖子

6491

积分

论坛元老

??

Rank: 8Rank: 8

积分
6491
发表于 2006-10-27 17:25:00 | 显示全部楼层

Re:C++???? Design Pattern??(1) - Inheritance VS Delegation

??IQ???????

???????C???C++???????

34

主题

443

帖子

478

积分

中级会员

Rank: 3Rank: 3

积分
478
发表于 2006-10-28 12:26:00 | 显示全部楼层

Re:C++???? Design Pattern??(1) - Inheritance VS Delegation

aear???????
????????????
??(2)??

35

主题

370

帖子

376

积分

中级会员

Rank: 3Rank: 3

积分
376
发表于 2006-11-4 20:45:00 | 显示全部楼层

Re:C++???? Design Pattern??(1) - Inheritance VS Delegation

??????DX????
DX???API??????????
??????????????????????DX?????????

0

主题

1

帖子

7

积分

新手上路

Rank: 1

积分
7
发表于 2007-1-4 02:21:00 | 显示全部楼层

Re:C++???? Design Pattern??(1) - Inheritance VS Delegation

????!

6

主题

99

帖子

99

积分

注册会员

Rank: 2

积分
99
发表于 2007-3-29 23:24:00 | 显示全部楼层

Re:C++???? Design Pattern??(1) - Inheritance VS Delegation

????????????
???????????????????????
???
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

作品发布|文章投稿|广告合作|关于本站|游戏开发论坛 ( 闽ICP备17032699号-3 )

GMT+8, 2025-8-7 22:28

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表