本文整理汇总了C++中Bounds::getY方法的典型用法代码示例。如果您正苦于以下问题:C++ Bounds::getY方法的具体用法?C++ Bounds::getY怎么用?C++ Bounds::getY使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bounds
的用法示例。
在下文中一共展示了Bounds::getY方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: hasColidedWith
bool Bounds::hasColidedWith(Bounds otherobj)
{
//al_draw_filled_rectangle(getX(),getY(),getX() + getW(),getY() + getH(),al_map_rgb(255,255,255));
//al_draw_filled_rectangle(otherobj.getX(),otherobj.getY(),otherobj.getX() + otherobj.getW(),otherobj.getY() + otherobj.getH(),al_map_rgb(255,255,255));
if( getX() < otherobj.getX() + otherobj.getW() &&
getX() + getW() > otherobj.getX() &&
getY() < otherobj.getY() + otherobj.getH() &&
getY() + getH() > otherobj.getY())
{
//cout << "HIT:{" << getX() << "|" << getY() << "|" << getW() << "|" << getH() << "},{" << otherobj.getX() << "|" << otherobj.getY() << "|" << otherobj.getW() << "|" << otherobj.getH() << endl;
return true;
}
return false;
}
示例2: initMenus
//.........这里部分代码省略.........
mainmenu->addImage(0,0,mainmenubg);
mainmenu->addImage(112,60,mainmenutitle);
mainmenu->addButton(266,350,mainmenusingle_UP,mainmenusingle_DOWN,"Single",mainmenusingleclick);
mainmenu->addImage(266,414,mainmenumulti);//TODO:multiplayer button
mainmenu->addButton(266,480,mainmenuoptions_UP,mainmenuoptions_DOWN,"Options",mainmenuoptionclick);
mainmenu->addButton(266,545,mainmenuexit_UP,mainmenuexit_DOWN,"Exit",mainmenuexitclick);
mainmenu->addImage(0,606,mainmenucopyright);
mainmenu->addImage(575,606,mainmenuversion);
mainmenu->setBgs(mainmenubgs);
getGameRefrence()->registerGameObject(mainmenu);//register menu
//optionsmenu
menuoptions = new Menu(); // options menu
logHelperMessage(INFO,1,"Creating optionmenu");
//images
ALLEGRO_BITMAP* optionmenubg = load_image("Images\\Menus\\option\\bg.png");
ALLEGRO_BITMAP* optionmenutitle = load_image("Images\\Menus\\option\\options_title.png");
ALLEGRO_BITMAP* optionmenuresolution_UP = load_image("Images\\Menus\\option\\resolution_up.png");
ALLEGRO_BITMAP* optionmenuresolution_DOWN = load_image("Images\\Menus\\option\\resolution_down.png");
ALLEGRO_BITMAP* optionmenubrightness_UP = load_image("Images\\Menus\\option\\brightness_up.png");
ALLEGRO_BITMAP* optionmenubrightness_DOWN = load_image("Images\\Menus\\option\\brightness_down.png");
ALLEGRO_BITMAP* optionmenuconfig_UP = load_image("Images\\Menus\\option\\configuration_up.png");
ALLEGRO_BITMAP* optionmenuconfig_DOWN = load_image("Images\\Menus\\option\\configuration_down.png");
ALLEGRO_BITMAP* optionmenudifficulty_UP = load_image("Images\\Menus\\option\\dificulty_up.png");
ALLEGRO_BITMAP* optionmenudifficulty_DOWN = load_image("Images\\Menus\\option\\dificulty_down.png");
ALLEGRO_BITMAP* optionmenuback_UP = load_image("Images\\Menus\\option\\back_up.png");
ALLEGRO_BITMAP* optionmenuback_DOWN = load_image("Images\\Menus\\option\\back_down.png");
//function pointers
void(*optionmenuresolutionclick)() = &optionsMenuClickResolution;
void(*optionmenubrightnessclick)() = &optionsMenuClickBrightness;
void(*optionmenuconfigclick)() = &optionsMenuClickConfig;
void(*optionmenudificultyclick)() = &optionsMenuClickDificulty;
void(*optionmenubackclick)() = &optionsMenuClickBack;
//add information to menu
menuoptions->addImage(0,0,optionmenubg);
menuoptions->addImage(241,21,optionmenutitle);
menuoptions->addButton(125,156,optionmenuresolution_UP,optionmenuresolution_DOWN,"resolution",optionmenuresolutionclick);
menuoptions->addButton(125,254,optionmenubrightness_UP,optionmenubrightness_DOWN,"brightness",optionmenubrightnessclick);
menuoptions->addButton(125,351,optionmenuconfig_UP,optionmenuconfig_DOWN,"config",optionmenuconfigclick);
menuoptions->addButton(125,446,optionmenudifficulty_UP,optionmenudifficulty_DOWN,"difficulty",optionmenudificultyclick);
menuoptions->addButton(125,546,optionmenuback_UP,optionmenuback_DOWN,"back",optionmenubackclick);
getGameRefrence()->registerGameObject(menuoptions);//register menu
//menuoverworld
menuoverworld = new Menu();
logHelperMessage(INFO,1,"Creating overworldmenu");
//load images
ALLEGRO_BITMAP* overworldmenubg = load_image("Images\\Menus\\overworld\\bg.jpg");
ALLEGRO_BITMAP* overworlddung_UP = load_image("Images\\Menus\\overworld\\dng.png");
ALLEGRO_BITMAP* overworlddung1_DOWN = load_image("Images\\Menus\\overworld\\dng1.png");
ALLEGRO_BITMAP* overworlddung2_DOWN = load_image("Images\\Menus\\overworld\\dng2.png");
ALLEGRO_BITMAP* overworlddung3_DOWN = load_image("Images\\Menus\\overworld\\dng3.png");
//asign function pointers
void(*overworldmenuclickdung1)() = &overworldMenuClickDung1;
void(*overworldmenuclickdung2)() = &overworldMenuClickDung2;
void(*overworldmenuclickdung3)() = &overworldMenuClickDung3;
//add buttons
menuoverworld->addImage(0,0,overworldmenubg);
menuoverworld->addButton(107,465,overworlddung_UP,overworlddung1_DOWN,"dung1",overworldMenuClickDung1);
menuoverworld->addButton(714,416,overworlddung_UP,overworlddung2_DOWN,"dung2",overworldMenuClickDung2);
menuoverworld->addButton(574,323,overworlddung_UP,overworlddung3_DOWN,"dung3",overworldMenuClickDung3);
getGameRefrence()->registerGameObject(menuoverworld);//register menu
//menumulti
menumulti = new Menu();
//TODO: Load multiplayer gui elements
getGameRefrence()->registerGameObject(menumulti);//register menu
//menuingame
menuingame = new Menu();
logHelperMessage(INFO,1,"Creating menuingame ");
ALLEGRO_BITMAP* menuingamephpimg = load_image("Images\\Menus\\ingame\\health.png");
ALLEGRO_BITMAP* menuingamepmpimg = load_image("Images\\Menus\\ingame\\mana.png");
ALLEGRO_BITMAP* menuingameplvimg = load_image("Images\\Menus\\ingame\\life.png");
Bounds menuingamephpbounds = Bounds(608,0,192,32);
Bounds menuingamepmpbounds = Bounds(416,0,192,32);
Bounds menuingameplvbounds = Bounds(0,0,192,32);
menuingame->addGauge(menuingamephpimg,menuingamephpbounds,GAUGE_LAYER,10,"PHP");
menuingame->addGauge(menuingamepmpimg,menuingamepmpbounds,GAUGE_LAYER,10,"PMP");
menuingame->addGauge(menuingameplvimg,menuingameplvbounds,GAUGE_LAYER,10,"PLV");
//TODO: load ingamemenu gui elements
getGameRefrence()->registerGameObject(menuingame);//register menu
//menucutscene
menucutscene = new Menu();
//TODO: load cutscene gui elements
getGameRefrence()->registerGameObject(menucutscene);//register menu
//menu shop
menushop = new Menu();
//TODO: load menushot gui elements
getGameRefrence()->registerGameObject(menushop);//register menu
//menu invintory
menuinvintory = new Menu();
ALLEGRO_BITMAP* menuinvintoybg = load_image("Images\\Menus\\invintory\\bg.png");
Bounds menuinvintorybgbounds = Bounds(64,122,672,418);
Bounds menuinvintorymoneybounds = Bounds(560,145,0,0);
menuinvintory->addImage(menuinvintorybgbounds.getX(),menuinvintorybgbounds.getY(),menuinvintoybg);
menuinvintory->addNumber(menuinvintorymoneybounds,"INVMONEY",0);
getGameRefrence()->registerGameObject(menuinvintory);//register menu
//TODO: load menuinvintory gui elements
//menusaveload
menusaveload = new Menu();
//TODO: load saveload gui elements
getGameRefrence()->registerGameObject(menusaveload);//register menu
}