Leistungsstarkes Game Framework
The game framework based on game framework by Woei Kae Chen
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
game_framework::CMovingBitmap Class Reference

#include <gameutil.h>

Public Member Functions

 CMovingBitmap ()
 CMovingBitmap 建構子
 
void LoadBitmap (int, COLORREF=CLR_INVALID)
 讀取圖片資源。
 
void LoadBitmap (char *, COLORREF=CLR_INVALID)
 讀取圖片資源。
 
void LoadBitmap (vector< char * >, COLORREF=CLR_INVALID)
 讀取圖片資源。
 
void LoadBitmapByString (vector< string >, COLORREF=CLR_INVALID)
 讀取圖片資源。
 
void LoadEmptyBitmap (int height, int weight)
 讀取空白圖片資源。
 
void UnshowBitmap ()
 停止顯示圖片。
 
void SetAnimation (int delay, bool _once)
 設置圖片是否為動畫。
 
void SetFrameIndexOfBitmap (int frame)
 設置當前圖片顯示幀的索引值。
 
void SetTopLeft (int, int)
 設置圖片至畫布指定座標上。
 
void ShowBitmap ()
 顯示圖片。
 
void ShowBitmap (double factor)
 顯示圖片。
 
int GetFrameIndexOfBitmap ()
 取得當前圖片顯示幀的索引值。
 
int GetFrameSizeOfBitmap ()
 回傳物件的幀數。
 
int GetTop ()
 取得當前圖片左上角 y 軸的座標值。
 
int GetLeft ()
 取得 CMovingBitmap 物件的左上角的 x 軸座標值。
 
int GetHeight ()
 取得 CMovingBitmap 物件的圖片高度。
 
int GetWidth ()
 取得當前圖片寬度。
 
string GetImageFileName ()
 取得物件載入圖片名稱。
 
COLORREF GetFilterColor ()
 取得物件過濾顏色。
 
bool IsAnimation ()
 物件是否為動畫物件。
 
bool IsAnimationDone ()
 動畫物件是否已執行完動畫。
 
bool IsBitmapLoaded ()
 物件是否已讀取點陣圖。
 
bool IsOnceAnimation ()
 動畫物件是否為單次動畫物件。
 
void ToggleAnimation ()
 啟動單次動畫。
 

Static Public Member Functions

static bool IsOverlap (CMovingBitmap bmp1, CMovingBitmap bmp2)
 兩物件是否交疊。
 

Protected Attributes

int frameIndex = 0
 當前幀的索引值。
 
int delayCount = 10
 當前幀切換的延遲。
 
int animationCount = -1
 儲存當前動畫的次數。
 
bool isAnimation = false
 儲存物件是否為動畫。
 
bool isAnimationDone = true
 儲存物件動畫是否已結束
 
bool isBitmapLoaded = false
 儲存圖片是否已讀取
 
bool isOnce = false
 儲存物件動畫是否為單次動畫
 
CRect location
 
vector< unsigned > surfaceID
 
clock_t last_time = clock()
 
string imageFileName = ""
 儲存物件讀取的圖片路徑
 
COLORREF filterColor = CLR_INVALID
 儲存物件過濾的圖片顏色
 

Constructor & Destructor Documentation

◆ CMovingBitmap()

game_framework::CMovingBitmap::CMovingBitmap ( )

CMovingBitmap 建構子

用於創立一個尚未讀取圖片的物件。

Member Function Documentation

◆ GetFilterColor()

COLORREF game_framework::CMovingBitmap::GetFilterColor ( )

取得物件過濾顏色。

Returns
回傳過濾顏色,若物件未設定過濾顏色,回傳 CLR_INVALID

◆ GetFrameIndexOfBitmap()

int game_framework::CMovingBitmap::GetFrameIndexOfBitmap ( )

取得當前圖片顯示幀的索引值。

Returns
圖片顯示幀的索引值。

◆ GetFrameSizeOfBitmap()

int game_framework::CMovingBitmap::GetFrameSizeOfBitmap ( )

回傳物件的幀數。

Returns
回傳物件的幀數。

◆ GetHeight()

int game_framework::CMovingBitmap::GetHeight ( )

取得 CMovingBitmap 物件的圖片高度。

需要先載入圖片。

Returns
圖片高度,以像素為單位。

◆ GetImageFileName()

string game_framework::CMovingBitmap::GetImageFileName ( )

取得物件載入圖片名稱。

Returns
回傳圖片名稱,若圖片尚未載入,則回傳一空字串。

◆ GetLeft()

int game_framework::CMovingBitmap::GetLeft ( )

取得 CMovingBitmap 物件的左上角的 x 軸座標值。

需要先載入圖片。

Returns
圖片左上角的 x 軸座標值。

◆ GetTop()

int game_framework::CMovingBitmap::GetTop ( )

取得當前圖片左上角 y 軸的座標值。

Returns
圖片左上角 y 軸的座標值。

◆ GetWidth()

int game_framework::CMovingBitmap::GetWidth ( )

取得當前圖片寬度。

Returns
取得當前圖片寬度。

◆ IsAnimation()

bool game_framework::CMovingBitmap::IsAnimation ( )

物件是否為動畫物件。

Returns
布林值,表示物件是否為動畫物件。

◆ IsAnimationDone()

bool game_framework::CMovingBitmap::IsAnimationDone ( )

動畫物件是否已執行完動畫。

Returns
布林值,表示動畫物件是否已執行完動畫。

◆ IsBitmapLoaded()

bool game_framework::CMovingBitmap::IsBitmapLoaded ( )

物件是否已讀取點陣圖。

Returns
布林值,表示物件是否已讀取點陣圖。

◆ IsOnceAnimation()

bool game_framework::CMovingBitmap::IsOnceAnimation ( )

動畫物件是否為單次動畫物件。

Returns
布林值,表示動畫物件是否為單次動畫物件。

◆ IsOverlap()

bool game_framework::CMovingBitmap::IsOverlap ( CMovingBitmap  bmp1,
CMovingBitmap  bmp2 
)
static

兩物件是否交疊。

Parameters
bmp1第一個 CMovingBitmap 物件
bmp2第二個 CMovingBitmap 物件
Returns
回傳布林值,代表兩物件是否交疊。

◆ LoadBitmap() [1/3]

void game_framework::CMovingBitmap::LoadBitmap ( char *  filepath,
COLORREF  color = CLR_INVALID 
)

讀取圖片資源。

透過圖片相對路徑 filepath 來讀取對應的圖片,並且過濾特定顏色 color

Parameters
filepath圖片相對路徑
color欲過濾的顏色(預設為 CLR_INVALID,可利用 RGB(<R>, <G>, <B>) 來設置過濾顏色)

◆ LoadBitmap() [2/3]

void game_framework::CMovingBitmap::LoadBitmap ( int  IDB_BITMAP,
COLORREF  color = CLR_INVALID 
)

讀取圖片資源。

透過資源編號 IDB_BITMAP 來讀取對應的圖片,並且過濾特定顏色 color

Parameters
IDB_BITMAP圖片資源編號
color欲過濾的顏色(預設為 CLR_INVALID,可利用 RGB(<R>, <G>, <B>) 來設置顏色)

◆ LoadBitmap() [3/3]

void game_framework::CMovingBitmap::LoadBitmap ( vector< char * >  filepaths,
COLORREF  color = CLR_INVALID 
)

讀取圖片資源。

透過圖片相對路徑集 filepaths 來讀取多個圖片,並且過濾特定顏色 color

Parameters
filepaths圖片相對路徑集
color欲過濾的顏色(預設為 CLR_INVALID,可利用 RGB(<R>, <G>, <B>) 來設置過濾顏色)
See also
https://en.cppreference.com/w/cpp/container/vector

◆ LoadBitmapByString()

void game_framework::CMovingBitmap::LoadBitmapByString ( vector< string >  filepaths,
COLORREF  color = CLR_INVALID 
)

讀取圖片資源。

透過圖片相對路徑集 filepaths 來讀取多個圖片,並且過濾特定顏色 color

Parameters
filepaths圖片相對路徑集
color欲過濾的顏色(預設為 CLR_INVALID,可利用 RGB(<R>, <G>, <B>) 來設置過濾顏色)
See also
https://en.cppreference.com/w/cpp/container/vector

◆ LoadEmptyBitmap()

void game_framework::CMovingBitmap::LoadEmptyBitmap ( int  height,
int  width 
)

讀取空白圖片資源。

讀取一個特定大小的白色點陣圖。

Parameters
height圖片長度
width圖片寬度

◆ SetAnimation()

void game_framework::CMovingBitmap::SetAnimation ( int  delay,
bool  once 
)

設置圖片是否為動畫。

CMovingBitmap 讀入多個圖片,則可以使用此函數來設定物件為動畫。

Parameters
delay動畫切換延遲(以毫秒為單位)
once動畫是否為一次性動畫,若是則需要以 ToggleAnimation() 來呼叫動畫啟動。
See also
ToggleAnimation()

◆ SetFrameIndexOfBitmap()

void game_framework::CMovingBitmap::SetFrameIndexOfBitmap ( int  frameIndex)

設置當前圖片顯示幀的索引值。

圖片顯示幀的索引值以 0 開始。

Parameters
frameIndex圖片顯示幀的索引值。

◆ SetTopLeft()

void game_framework::CMovingBitmap::SetTopLeft ( int  x,
int  y 
)

設置圖片至畫布指定座標上。

將會把圖片左上角設置至指定座標上。

Parameters
x左上角 x 座標
y左上角 y 座標

◆ ShowBitmap() [1/2]

void game_framework::CMovingBitmap::ShowBitmap ( )

顯示圖片。

僅能在 onShow() 時呼叫,且圖片需要被讀取。

◆ ShowBitmap() [2/2]

void game_framework::CMovingBitmap::ShowBitmap ( double  factor)

顯示圖片。

僅能在 onShow() 時呼叫,且圖片需要被讀取。

Parameters
factor放大倍率,需要 VGA 顯卡的支援,否則會變得異常慢。

◆ ToggleAnimation()

void game_framework::CMovingBitmap::ToggleAnimation ( )

啟動單次動畫。

將動畫設為初始幀,並且初始化單次動畫的參數值。

◆ UnshowBitmap()

void game_framework::CMovingBitmap::UnshowBitmap ( )

停止顯示圖片。

Deprecated:
從 v1.0.0 版本後棄用,停止顯示圖片請在 OnShow() 時不呼叫 ShowBitmap() 即可
See also
ShowBitmap()

Member Data Documentation

◆ animationCount

int game_framework::CMovingBitmap::animationCount = -1
protected

儲存當前動畫的次數。

◆ delayCount

int game_framework::CMovingBitmap::delayCount = 10
protected

當前幀切換的延遲。

◆ filterColor

COLORREF game_framework::CMovingBitmap::filterColor = CLR_INVALID
protected

儲存物件過濾的圖片顏色

◆ frameIndex

int game_framework::CMovingBitmap::frameIndex = 0
protected

當前幀的索引值。

◆ imageFileName

string game_framework::CMovingBitmap::imageFileName = ""
protected

儲存物件讀取的圖片路徑

◆ isAnimation

bool game_framework::CMovingBitmap::isAnimation = false
protected

儲存物件是否為動畫。

◆ isAnimationDone

bool game_framework::CMovingBitmap::isAnimationDone = true
protected

儲存物件動畫是否已結束

◆ isBitmapLoaded

bool game_framework::CMovingBitmap::isBitmapLoaded = false
protected

儲存圖片是否已讀取

◆ isOnce

bool game_framework::CMovingBitmap::isOnce = false
protected

儲存物件動畫是否為單次動畫

◆ last_time

clock_t game_framework::CMovingBitmap::last_time = clock()
protected

◆ location

CRect game_framework::CMovingBitmap::location
protected

◆ surfaceID

vector<unsigned> game_framework::CMovingBitmap::surfaceID
protected

The documentation for this class was generated from the following files: