本文整理汇总了C++中CSprite::GetImage方法的典型用法代码示例。如果您正苦于以下问题:C++ CSprite::GetImage方法的具体用法?C++ CSprite::GetImage怎么用?C++ CSprite::GetImage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSprite
的用法示例。
在下文中一共展示了CSprite::GetImage方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Init
void MainMenu::Init()
{
Scene::Init();
// Create menu background
int w = IwGxGetScreenWidth();
int h = IwGxGetScreenHeight();
if (w > h)
{
int temp = w;
w = h;
h = temp;
}
CSprite* background = new CSprite();
background->m_X = (float)w / 2;
background->m_Y = (float)h / 2;
background->SetImage(g_pResources->getMenuBG());
background->m_W = background->GetImage()->GetWidth();
background->m_H = background->GetImage()->GetHeight();
background->m_AnchorX = 0.5;
background->m_AnchorY = 0.5;
// Fit background to screen size
background->m_ScaleX = (float)w / background->GetImage()->GetWidth();
background->m_ScaleY = (float)h / background->GetImage()->GetHeight();
AddChild(background);
playButton = new CSprite();
playButton->SetImage(g_pResources->getPlayButton());
playButton->m_X = w / 2.0f;
playButton->m_Y = h / 2.0f;
playButton->m_W = playButton->GetImage()->GetWidth();
playButton->m_H = playButton->GetImage()->GetHeight();
playButton->m_AnchorX = 0.5f;
playButton->m_AnchorY = 0.5f;
playButton->m_ScaleX = (float)(w * 0.4) / playButton->GetImage()->GetWidth();
playButton->m_ScaleY = playButton->m_ScaleX;
AddChild(playButton);
// Create pause menu sprite (docked to top of screen)
optionsSprite = new CSprite();
optionsSprite->SetImage(g_pResources->getSettingsButton());
optionsSprite->m_X = (int)IwGxGetDeviceWidth() * 0.9;
optionsSprite->m_Y = (int)IwGxGetDeviceHeight() * 0.9;
optionsSprite->m_W = optionsSprite->GetImage()->GetWidth();
optionsSprite->m_H = optionsSprite->GetImage()->GetHeight();
optionsSprite->m_AnchorX = 0.5;
optionsSprite->m_ScaleX = (float)(IwGxGetDeviceWidth() * 0.13) / optionsSprite->GetImage()->GetWidth();
optionsSprite->m_ScaleY = optionsSprite->m_ScaleX;
AddChild(optionsSprite);
// Start menu music
//Audio::PlayMusic("audio/frontend.mp3");
}
示例2: Init
void MainMenu::Init()
{
Scene::Init();
Game* game = (Game*)g_pSceneManager->Find("game");
// Create menu background
CSprite* background = new CSprite();
background->m_X = (float)IwGxGetScreenWidth() / 2;
background->m_Y = (float)IwGxGetScreenHeight() / 2;
background->SetImage(g_pResources->getMenuBG());
background->m_W = background->GetImage()->GetWidth();
background->m_H = background->GetImage()->GetHeight();
background->m_AnchorX = 0.5;
background->m_AnchorY = 0.5;
// Fit background to screen size
background->m_ScaleX = (float)IwGxGetScreenWidth() / background->GetImage()->GetWidth();
background->m_ScaleY = (float)IwGxGetScreenHeight() / background->GetImage()->GetHeight();
AddChild(background);
// Create Start Game button
float y_pos = (float)IwGxGetScreenHeight() * 0.66f;
playButton = new CSprite();
playButton->SetImage(g_pResources->getPlacard());
playButton->m_X = IwGxGetScreenWidth() / 2.0f;
playButton->m_Y = y_pos;
playButton->m_W = playButton->GetImage()->GetWidth();
playButton->m_H = playButton->GetImage()->GetHeight();
playButton->m_AnchorX = 0.5f;
playButton->m_AnchorY = 0.5f;
playButton->m_ScaleX = game->getGraphicsScale() * 1.5f;
playButton->m_ScaleY = game->getGraphicsScale() * 1.5f;
AddChild(playButton);
// Create Start Game button text
playText = new CSprite();
playText->SetImage(g_pResources->getPlayButton());
playText->m_X = (float)IwGxGetScreenWidth() / 2;
playText->m_Y = y_pos;
playText->m_W = playText->GetImage()->GetWidth();
playText->m_H = playText->GetImage()->GetHeight();
playText->m_AnchorX = 0.5f;
playText->m_AnchorY = 0.5f;
playText->m_ScaleX = game->getGraphicsScale();
playText->m_ScaleY = game->getGraphicsScale();
AddChild(playText);
// Start menu music
Audio::PlayMusic("audio/frontend.mp3");
}
示例3: Init
void PauseMenu::Init()
{
Game* game = (Game*)g_pSceneManager->Find("game");
add = false;
int width = IwGxGetScreenWidth();
int height = IwGxGetScreenHeight();
// Create menu background
CSprite* background = new CSprite();
background->m_X = (float) width / 2;
background->m_Y = (float) height / 2;
background->SetImage(g_pResources->getGameBGB());
background->m_AnchorX = 0.5;
background->m_AnchorY = 0.5;
// Fit background to screen size
background->m_ScaleX = (float)width / background->GetImage()->GetWidth();
background->m_ScaleY = (float)height / background->GetImage()->GetHeight();
AddChild(background);
shown = false;
// Create New Game button
infoButton = new CSprite();
infoButton->SetImage(g_pResources->getInfoButton());
infoButton->m_X = (float)(width * 0.15) + (width / (1.5 * 2));
infoButton->m_Y = (float)height / 50;
infoButton->m_W = infoButton->GetImage()->GetWidth();
infoButton->m_H = infoButton->GetImage()->GetHeight();
infoButton->m_AnchorX = 0.5f;
infoButton->m_AnchorY = 0;
infoButton->m_ScaleX = (float)width / infoButton->GetImage()->GetWidth() / 1.5;
infoButton->m_ScaleY = infoButton->m_ScaleX;
AddChild(infoButton);
// Create New Game button
infoText = new CSprite();
infoText->SetImage(g_pResources->getInfoText());
infoText->m_X = (float)(width * 0.15) + ((width / (1.4 * 2)));
infoText->m_W = infoText->GetImage()->GetWidth();
infoText->m_H = infoText->GetImage()->GetHeight();
infoText->m_AnchorX = 0.5f;
infoText->m_AnchorY = 0.5f;
infoText->m_ScaleX = (float)(width / infoText->GetImage()->GetWidth()) / 1.4;
infoText->m_ScaleY = infoText->m_ScaleX;
infoText->m_Y = (float)(infoText->GetImage()->GetHeight() * infoText->m_ScaleX)/ 2 + (height / 6);
AddChild(infoText);
}
示例4: Init
void EventsScene::Init()
{
Scene::Init();
// Create menu background
CSprite* background = new CSprite();
background->m_X = (float)IwGxGetScreenWidth() / 2;
background->m_Y = (float)IwGxGetScreenHeight() / 2;
background->SetImage(g_pResources->getbackground());
background->m_W = background->GetImage()->GetWidth();
background->m_H = background->GetImage()->GetHeight();
background->m_AnchorX = 0.5;
background->m_AnchorY = 0.5;
// Fit background to screen size
background->m_ScaleX = (float)IwGxGetScreenWidth() / background->GetImage()->GetWidth();
background->m_ScaleY = (float)IwGxGetScreenHeight() / background->GetImage()->GetHeight();
AddChild(background);
hasFeed = false;
}
示例5: initUI
// Initialise the games user interface
void Game::initUI()
{
CSprite* background = new CSprite();
background->m_X = (float)(ScreenWidth / 2);
background->m_Y = (float)(ScreenHeight / 2);
background->SetImage(g_pResources->getMenuBG());
background->m_AnchorX = 0.5f;
background->m_AnchorY = 0.5f;
// Fit background to Device size
background->m_ScaleX = (float)(ScreenWidth) / background->GetImage()->GetWidth();
background->m_ScaleY = (float)ScreenHeight / background->GetImage()->GetHeight();
AddChild(background);
CSprite* FloorSprite = new CSprite();
FloorSprite->m_X = (float)(background->m_X / 4);
FloorSprite->m_Y = (float)(ScreenHeight / 2);
FloorSprite->SetImage(g_pResources->getFloorImage());
FloorSprite->m_AnchorX = 0.5f;
FloorSprite->m_AnchorY = 0.5f;
// Fit FloorSprite to Device size
FloorSprite->m_ScaleX = (float)(ScreenWidth / 4) / FloorSprite->GetImage()->GetWidth();
FloorSprite->m_ScaleY = (float)ScreenHeight / FloorSprite->GetImage()->GetHeight();
AddChild(FloorSprite);
player = new Fighter*[2];
lifeBars = new CSprite*[2];
CreateFighter(PLAYER_ONE, (float)(ScreenHeight / 3));
CreateFighter(PLAYER_TWO, (float)(player[PLAYER_ONE]->m_Y * 2));
CreateLifeBar(PLAYER_ONE, 0);
CreateLifeBar(PLAYER_TWO, ScreenHeight);
//2 special buttons
buttons = new CSprite*[NUM_BUTTONS + 2];
int i;
for (i = 0; i < NUM_BUTTONS; i++)
{
CreateButton(i, FloorSprite->m_X, (float)(ScreenHeight / 5) * (i + 1));
}
CreateButton(i, FloorSprite->m_X + (ScreenWidth / 8), buttons[i - 2]->m_Y + (float)(ScreenHeight / 8));
i++;
CreateButton(i, buttons[i - 1]->m_X, buttons[i - 2]->m_Y + (float)(ScreenHeight / 8));
//flip the first button as it is the same as the second
buttons[0]->m_Angle += 180.0f;
float fontScale = (float)IwGxGetScreenWidth() / FONT_DESIGN_WIDTH;
float actualFontHeight = FONT_HEIGHT * fontScale;
MessageLabel = new CLabel();
MessageLabel->m_X = IwGxGetDisplayWidth() / 2;
MessageLabel->m_Y = ScreenHeight / 2;
MessageLabel->m_W = FONT_DESIGN_WIDTH;
MessageLabel->m_H = actualFontHeight;
MessageLabel->m_AlignHor = IW_2D_FONT_ALIGN_LEFT;
MessageLabel->m_AlignVer = IW_2D_FONT_ALIGN_TOP;
MessageLabel->m_Font = g_pResources->getFont();
MessageLabel->m_ScaleX = fontScale;
MessageLabel->m_ScaleY = fontScale;
MessageLabel->m_Angle = 270.0f;
AddChild(MessageLabel);
MessageLabel->m_Alpha = 0.0f;
}
示例6: Init
void PauseMenu::Init()
{
Game* game = (Game*)g_pSceneManager->Find("game");
// Create menu background
CSprite* background = new CSprite();
background->m_X = (float)IwGxGetScreenWidth() / 2;
background->m_Y = (float)IwGxGetScreenHeight() / 2;
background->SetImage(g_pResources->getMenuBG());
background->m_AnchorX = 0.5;
background->m_AnchorY = 0.5;
// Fit background to screen size
background->m_ScaleX = (float)IwGxGetScreenWidth() / background->GetImage()->GetWidth();
background->m_ScaleY = (float)IwGxGetScreenHeight() / background->GetImage()->GetHeight();
AddChild(background);
// Create Continue Game button
continueGameButton = new CSprite();
continueGameButton->SetImage(g_pResources->getMenuButton());
int button_height = (int)(continueGameButton->GetImage()->GetHeight() * game->getGraphicsScale());
int y_pos = button_height * 2;
continueGameButton->m_X = (float)IwGxGetScreenWidth() / 2;
continueGameButton->m_Y = (float)y_pos;
continueGameButton->m_AnchorX = 0.5f;
continueGameButton->m_AnchorY = 0;
continueGameButton->m_ScaleX = game->getGraphicsScale();
continueGameButton->m_ScaleY = game->getGraphicsScale();
AddChild(continueGameButton);
// Create Continue Game button text
CLabel* label = new CLabel();
label->m_X = continueGameButton->m_W / 2;
label->m_Y = continueGameButton->m_H / 2;
label->m_W = continueGameButton->m_W;
label->m_H = continueGameButton->m_H;
label->m_AnchorX = 0.5f;
label->m_AnchorY = 0.5f;
label->m_ScaleX = game->getFontScale() / game->getGraphicsScale(); // Compound scaling factors as label ie child of button
label->m_ScaleY = label->m_ScaleX;
label->m_AlignHor = IW_2D_FONT_ALIGN_CENTRE;
label->m_AlignVer = IW_2D_FONT_ALIGN_CENTRE;
label->m_Font = g_pResources->getFont();
label->m_Text = "Continue",
label->m_Color = CColor(0xff, 0xff, 0xff, 0xff);
continueGameButton->AddChild(label);
y_pos += button_height;
// Create New Game button
newGameButton = new CSprite();
newGameButton->SetImage(g_pResources->getMenuButton());
newGameButton->m_X = (float)IwGxGetScreenWidth() / 2;
newGameButton->m_Y = (float)y_pos;
newGameButton->m_W = newGameButton->GetImage()->GetWidth();
newGameButton->m_H = newGameButton->GetImage()->GetHeight();
newGameButton->m_AnchorX = 0.5f;
newGameButton->m_AnchorY = 0;
newGameButton->m_ScaleX = game->getGraphicsScale();
newGameButton->m_ScaleY = game->getGraphicsScale();
AddChild(newGameButton);
// Create Continue Game button text
label = new CLabel();
label->m_X = newGameButton->m_W / 2;
label->m_Y = newGameButton->m_H / 2;
label->m_W = newGameButton->m_W;
label->m_H = newGameButton->m_H;
label->m_AnchorX = 0.5f;
label->m_AnchorY = 0.5f;
label->m_ScaleX = game->getFontScale() / game->getGraphicsScale(); // Compound scaling factors as label ie child of button
label->m_ScaleY = label->m_ScaleX;
label->m_AlignHor = IW_2D_FONT_ALIGN_CENTRE;
label->m_AlignVer = IW_2D_FONT_ALIGN_CENTRE;
label->m_Font = g_pResources->getFont();
label->m_Text = "New Game",
label->m_Color = CColor(0xff, 0xff, 0xff, 0xff);
newGameButton->AddChild(label);
y_pos += button_height;
/*if (g_pAds->IsEnabled())
{
// Create NoAds button
noAdsButton = new CSprite();
noAdsButton->SetImage(g_pResources->getMenuButton());
noAdsButton->m_X = (float)IwGxGetScreenWidth() / 2;
noAdsButton->m_Y = (float)y_pos;
noAdsButton->m_W = noAdsButton->GetImage()->GetWidth();
noAdsButton->m_H = noAdsButton->GetImage()->GetHeight();
noAdsButton->m_AnchorX = 0.5f;
noAdsButton->m_AnchorY = 0;
noAdsButton->m_ScaleX = game->getGraphicsScale();
noAdsButton->m_ScaleY = game->getGraphicsScale();
AddChild(noAdsButton);
// Create Continue Game button text
label = new CLabel();
label->m_X = noAdsButton->m_W / 2;
label->m_Y = noAdsButton->m_H / 2;
label->m_W = noAdsButton->m_W;
label->m_H = noAdsButton->m_H;
label->m_AnchorX = 0.5f;
//.........这里部分代码省略.........
示例7: initUI
// Initialise the games user interface
void Game::initUI()
{
// Create background
CSprite* background = new CSprite();
background->m_X = (float)IwGxGetScreenWidth() / 2;
background->m_Y = (float)IwGxGetScreenHeight() / 2;
background->SetImage(g_pResources->getGameBG());
background->m_W = background->GetImage()->GetWidth();
background->m_H = background->GetImage()->GetHeight();
background->m_AnchorX = 0.5;
background->m_AnchorY = 0.5;
// Fit background to screen size
background->m_ScaleX = (float)IwGxGetScreenWidth() / background->GetImage()->GetWidth();
background->m_ScaleY = (float)IwGxGetScreenHeight() / background->GetImage()->GetHeight();
AddChild(background);
// Create grid background sprite
gridSprite = new CSprite();
gridSprite->m_X = 0;
gridSprite->m_Y = IwGxGetScreenHeight() - g_pResources->getGrid()->GetHeight() * graphicsScale;
gridSprite->m_ScaleX = graphicsScale;
gridSprite->m_ScaleY = graphicsScale;
gridSprite->SetImage(g_pResources->getGrid());
AddChild(gridSprite);
// Create left placard
leftPlacard = new CSprite();
leftPlacard->SetImage(g_pResources->getPlacard());
leftPlacard->m_X = 0;
leftPlacard->m_Y = (float)uiYPosition;
leftPlacard->m_ScaleX = graphicsScale;
leftPlacard->m_ScaleY = graphicsScale;
AddChild(leftPlacard);
// Create right placard
rightPlacard = new CSprite();
rightPlacard->SetImage(g_pResources->getPlacard());
rightPlacard->m_X = (float)IwGxGetScreenWidth() - rightPlacard->GetImage()->GetWidth() * graphicsScale;
rightPlacard->m_Y = (float)uiYPosition;
rightPlacard->m_ScaleX = graphicsScale;
rightPlacard->m_ScaleY = graphicsScale;
AddChild(rightPlacard);
// Create score label text
scoreLabelText = new CLabel();
scoreLabelText->m_X = 30 * fontScale;
scoreLabelText->m_Y = uiYPosition + 10 * fontScale;
scoreLabelText->m_W = FONT_DESIGN_WIDTH;
scoreLabelText->m_H = actualFontHeight;
scoreLabelText->m_Text = "Score:";
scoreLabelText->m_AlignHor = IW_2D_FONT_ALIGN_LEFT;
scoreLabelText->m_AlignVer = IW_2D_FONT_ALIGN_TOP;
scoreLabelText->m_Font = g_pResources->getFont();
scoreLabelText->m_ScaleX = fontScale;
scoreLabelText->m_ScaleY = fontScale;
scoreLabelText->m_Color = CColor(0xff, 0xff, 0x30, 0xff);
AddChild(scoreLabelText);
// Create score label (displays actual score)
scoreLabel = new CLabel();
scoreLabel->m_X = 80 * fontScale;
scoreLabel->m_Y = uiYPosition + 10 * fontScale;
scoreLabel->m_W = FONT_DESIGN_WIDTH;
scoreLabel->m_H = actualFontHeight;
scoreLabel->m_Text = "0";
scoreLabel->m_AlignHor = IW_2D_FONT_ALIGN_LEFT;
scoreLabel->m_AlignVer = IW_2D_FONT_ALIGN_TOP;
scoreLabel->m_Font = g_pResources->getFont();
scoreLabel->m_ScaleX = fontScale;
scoreLabel->m_ScaleY = fontScale;
AddChild(scoreLabel);
// Create target score label text
targetScoreLabelText = new CLabel();
targetScoreLabelText->m_X = 30 * fontScale;
targetScoreLabelText->m_Y = uiYPosition + 30 * fontScale;
targetScoreLabelText->m_W = FONT_DESIGN_WIDTH;
targetScoreLabelText->m_H = actualFontHeight;
targetScoreLabelText->m_Text = "Target:";
targetScoreLabelText->m_AlignHor = IW_2D_FONT_ALIGN_LEFT;
targetScoreLabelText->m_AlignVer = IW_2D_FONT_ALIGN_TOP;
targetScoreLabelText->m_Font = g_pResources->getFont();
targetScoreLabelText->m_ScaleX = fontScale;
targetScoreLabelText->m_ScaleY = fontScale;
targetScoreLabelText->m_Color = CColor(0xff, 0xff, 0x30, 0xff);
AddChild(targetScoreLabelText);
//- Create target score label (displays target score)
targetScoreLabel = new CLabel();
targetScoreLabel->m_X = 80 * fontScale;
targetScoreLabel->m_Y = uiYPosition + 30 * fontScale;
targetScoreLabel->m_W = FONT_DESIGN_WIDTH;
targetScoreLabel->m_H = actualFontHeight;
targetScoreLabel->m_Text = "0";
targetScoreLabel->m_AlignHor = IW_2D_FONT_ALIGN_LEFT;
targetScoreLabel->m_AlignVer = IW_2D_FONT_ALIGN_TOP;
targetScoreLabel->m_Font = g_pResources->getFont();
targetScoreLabel->m_ScaleX = fontScale;
targetScoreLabel->m_ScaleY = fontScale;
//.........这里部分代码省略.........
示例8: Init
void Streamer::Init()
{
//Game* game = (Game*)g_pSceneManager->Find("game");
initAudio("128.198.85.100", 8000);
s3eDeviceRegister(S3E_DEVICE_EXIT, &exitCB, 0);
facebook = new CSprite();
facebook->SetImage(g_pResources->getFacebook());
facebook->m_X = (float)IwGxGetScreenWidth() / 1.4;
facebook->m_Y = (float)IwGxGetScreenHeight() / 16;
facebook->m_W = facebook->GetImage()->GetWidth();
facebook->m_H = facebook->GetImage()->GetHeight();
facebook->m_AnchorX = 0.5;
facebook->m_AnchorY = 0.5;
facebook->m_ScaleX = (float)IwGxGetScreenWidth() / facebook->GetImage()->GetWidth() / 8;
facebook->m_ScaleY = (float)IwGxGetScreenHeight() / facebook->GetImage()->GetHeight() / 12;
twitter = new CSprite();
twitter->SetImage(g_pResources->getTwitter());
twitter->m_X = (float)IwGxGetScreenWidth() / 1.1;
twitter->m_Y = (float)IwGxGetScreenHeight() / 16;
twitter->m_W = twitter->GetImage()->GetWidth();
twitter->m_H = twitter->GetImage()->GetHeight();
twitter->m_AnchorX = 0.5;
twitter->m_AnchorY = 0.5;
twitter->m_ScaleX = (float)IwGxGetScreenWidth() / twitter->GetImage()->GetWidth() / 8;
twitter->m_ScaleY = (float)IwGxGetScreenHeight() / twitter->GetImage()->GetHeight() / 12;
// Create menu background
header = new CSprite();
header->SetImage(g_pResources->getHeader());
header->m_X = (float)IwGxGetScreenWidth() / 3;
header->m_Y = (float)IwGxGetScreenHeight() / 17;
header->m_W = header->GetImage()->GetWidth();
header->m_H = header->GetImage()->GetHeight();
header->m_AnchorX = 0.5;
header->m_AnchorY = 0.5;
// Fit background to screen size
header->m_ScaleX = (float)IwGxGetScreenWidth() / header->GetImage()->GetWidth() / 1.5;
header->m_ScaleY = (float)IwGxGetScreenHeight() / header->GetImage()->GetHeight() / 5;
// Create menu background
CSprite* whiteBanner = new CSprite();
whiteBanner->SetImage(g_pResources->getWhiteBanner());
whiteBanner->m_X = (float)IwGxGetScreenWidth() / 2;
whiteBanner->m_Y = (float)IwGxGetScreenHeight() / 17;
whiteBanner->m_W = whiteBanner->GetImage()->GetWidth();
whiteBanner->m_H = whiteBanner->GetImage()->GetHeight();
whiteBanner->m_AnchorX = 0.5;
whiteBanner->m_AnchorY = 0.5;
// Fit background to screen size
whiteBanner->m_ScaleX = (float)IwGxGetScreenWidth() / whiteBanner->GetImage()->GetWidth() / 1;
whiteBanner->m_ScaleY = (float)IwGxGetScreenHeight() / whiteBanner->GetImage()->GetHeight() / 5;
// Create menu background
playWrapper = new CSprite();
playWrapper->SetImage(g_pResources->getPlayWrapper());
playWrapper->m_X = (float)IwGxGetScreenWidth() / 2;
playWrapper->m_Y = (float)IwGxGetScreenHeight() / 1.09;
playWrapper->m_W = playWrapper->GetImage()->GetWidth();
playWrapper->m_H = playWrapper->GetImage()->GetHeight();
playWrapper->m_AnchorX = 0.5;
playWrapper->m_AnchorY = 0.5;
//playWrapper->m_Alpha = 0.9;
// Fit background to screen size
playWrapper->m_ScaleX = (float)IwGxGetScreenWidth() / playWrapper->GetImage()->GetWidth() / 1;
playWrapper->m_ScaleY = (float)IwGxGetScreenHeight() / playWrapper->GetImage()->GetHeight() / 6;
playButton = new CSprite();
playButton->SetImage(g_pResources->getPlayButton());
playButton->m_X = (float)IwGxGetScreenWidth() / 2;
playButton->m_Y = (float)IwGxGetScreenHeight() / 1.13;
//buttonTop = (float)IwGxGetScreenHeight() / 1.14 - (playButton->GetImage()->GetHeight() / 8);
playButton->m_W = playButton->GetImage()->GetWidth();
playButton->m_H = playButton->GetImage()->GetHeight();
playButton->m_AnchorX = 0.5;
playButton->m_AnchorY = 0.5;
// Fit background to screen size
playButton->m_ScaleX = (float)IwGxGetScreenWidth() / playButton->GetImage()->GetWidth() / 3.2;
playButton->m_ScaleY = (float)IwGxGetScreenHeight() / playButton->GetImage()->GetHeight() / 4.5;
//buttonTop = ((float)IwGxGetScreenHeight() / 1.14) - (playButton->GetImage()->GetHeight() / 3.7);
stopButton = new CSprite();
stopButton->SetImage(g_pResources->getStopButton());
stopButton->m_X = (float)IwGxGetScreenWidth() / 2;
stopButton->m_Y = (float)IwGxGetScreenHeight() / 1.13;
stopButton->m_W = stopButton->GetImage()->GetWidth();
stopButton->m_H = stopButton->GetImage()->GetHeight();
stopButton->m_AnchorX = 0.5;
stopButton->m_AnchorY = 0.5;
// Fit background to screen size
stopButton->m_ScaleX = (float)IwGxGetScreenWidth() / stopButton->GetImage()->GetWidth() / 3.2;
stopButton->m_ScaleY = (float)IwGxGetScreenHeight() / stopButton->GetImage()->GetHeight() / 4.5;
banner = new CSprite();
banner->SetImage(g_pResources->getGreyBanner());
banner->m_X = (float)IwGxGetScreenWidth() / 2;
//.........这里部分代码省略.........
示例9: id
Tenant::Tenant(int* roomx, int* roomy, aux::type t) : id(newID++)
{
room_x = *roomx;
room_y = *roomy;
CSprite* s = new CSprite;
CSprite* b = new CSprite;
CAtlas* a = new CAtlas;
stress = 100;
damage = 0;
type = t;
neighbors.upleft_x = room_x - 1;
neighbors.upleft_y = room_y + 1;
neighbors.up_x = room_x;
neighbors.up_y = room_y + 1;
neighbors.upright_x = room_x + 1;
neighbors.upright_y = room_y + 1;
neighbors.right_x = room_x + 1;
neighbors.right_y = room_y;
neighbors.downright_x = room_x + 1;
neighbors.downright_y = room_y - 1;
neighbors.down_x = room_x;
neighbors.down_y = room_y - 1;
neighbors.downleft_x = room_x - 1;
neighbors.downleft_y = room_y - 1;
neighbors.left_x = room_x - 1;
neighbors.left_y = room_y;
//criar barra de stress
stressBar = new CSprite;
stressBar->SetImage(g_pResources->getStressBar0());
stressBar->m_X = (room_x * g_pResources->getAp()->GetWidth()) + ((g_pResources->getAp()->GetWidth() / 2) - (stressBar->GetImage()->GetWidth() / 2));
stressBar->m_Y = Iw2DGetSurfaceHeight() - (room_y * g_pResources->getAp()->GetHeight()) - (4 + stressBar->GetImage()->GetHeight());
stressLabel = new CLabel();
stressLabel->m_W = stressBar->m_W;
stressLabel->m_H = stressBar->m_H;
stressLabel->m_X = (room_x * g_pResources->getAp()->GetWidth()) + ((g_pResources->getAp()->GetWidth() / 2) - (stressBar->GetImage()->GetWidth() / 2));;
stressLabel->m_Y = Iw2DGetSurfaceHeight() - (room_y * g_pResources->getAp()->GetHeight()) - (4 + stressBar->GetImage()->GetHeight());;
stressLabel->m_Text = "100/100";
stressLabel->m_AlignHor = IW_2D_FONT_ALIGN_CENTRE;
stressLabel->m_AlignVer = IW_2D_FONT_ALIGN_CENTRE;
stressLabel->m_Font = g_pResources->getFont();
stressLabel->m_Color = CColor(0, 0, 0, 255);
switch (t)
{
using namespace aux;
case MODEL: // se for o personagem model, carregue os sprites, e stats desse personagem
behavior.upleft = VOID; // VOID = 0, TRUE = +hp, FALSE = -hp
behavior.up = VOID;
behavior.upright = VOID;
behavior.right = TRUE;
behavior.downright = VOID;
behavior.down = FALSE;
behavior.downleft = VOID;
behavior.left = TRUE;
s->SetImage(g_pResources->getModel());
b->SetImage(g_pResources->getModelSet());
s->m_X = (room_x * g_pResources->getAp()->GetWidth()) + ((g_pResources->getAp()->GetWidth() / 2) - (s->GetImage()->GetWidth() / 2));
s->m_Y = Iw2DGetSurfaceHeight() - (room_y * g_pResources->getAp()->GetHeight()) - (24 + s->GetImage()->GetHeight());
b->m_X = (room_x * g_pResources->getAp()->GetWidth()) + ((g_pResources->getAp()->GetWidth() / 2) - (b->GetImage()->GetWidth() / 2));
b->m_Y = Iw2DGetSurfaceHeight() - (room_y * g_pResources->getAp()->GetHeight()) - (b->GetImage()->GetHeight());
sprite = s;
behavior_set = b;
break;
case SINGER:
behavior.upleft = VOID; // VOID = 0, TRUE = +hp, FALSE = -hp
behavior.up = TRUE;
behavior.upright = VOID;
behavior.right = TRUE;
behavior.downright = VOID;
behavior.down = TRUE;
behavior.downleft = VOID;
behavior.left = TRUE;
s->SetImage(g_pResources->getSinger());
b->SetImage(g_pResources->getSingerSet());
s->m_X = (room_x * g_pResources->getAp()->GetWidth()) + ((g_pResources->getAp()->GetWidth() / 2) - (s->GetImage()->GetWidth() / 2));
s->m_Y = Iw2DGetSurfaceHeight() - (room_y * g_pResources->getAp()->GetHeight()) - (24 + s->GetImage()->GetHeight());
b->m_X = (room_x * g_pResources->getAp()->GetWidth()) + ((g_pResources->getAp()->GetWidth() / 2) - (b->GetImage()->GetWidth() / 2));
b->m_Y = Iw2DGetSurfaceHeight() - (room_y * g_pResources->getAp()->GetHeight()) - (b->GetImage()->GetHeight());
sprite = s;
behavior_set = b;
break;
case MUCHALUCHA:
//.........这里部分代码省略.........