本文整理汇总了C++中CButtonUI::SetCurrentState方法的典型用法代码示例。如果您正苦于以下问题:C++ CButtonUI::SetCurrentState方法的具体用法?C++ CButtonUI::SetCurrentState怎么用?C++ CButtonUI::SetCurrentState使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CButtonUI
的用法示例。
在下文中一共展示了CButtonUI::SetCurrentState方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main() {
Screen::Instance().Open(800, 600, false);
//Entity
Image * alienImg = ResourceManager::Instance().LoadImage("data/alien.png");
alienImg->SetMidHandle();
CEntity entity(alienImg);
entity.GetSprite()->SetPosition(350, 340);
CEntity entity2(alienImg);
entity2.GetSprite()->SetPosition(700, 300);
//Windows
Image * backgroundImg = ResourceManager::Instance().LoadImage("data/background.jpg");
Image * windowImg = ResourceManager::Instance().LoadImage("data/window4.png");
//button Imgs
Image * buttonImgDefault = ResourceManager::Instance().LoadImage("data/button_default.png");
buttonImgDefault->SetMidHandle();
Image * buttonImgOnClick = ResourceManager::Instance().LoadImage("data/button_onclick.png");
buttonImgOnClick->SetMidHandle();
Image * buttonImgInactive = ResourceManager::Instance().LoadImage("data/button_inactive.png");
buttonImgInactive->SetMidHandle();
//checkbox Imgs
Image * checkboxImgDefault = ResourceManager::Instance().LoadImage(
"data/checkbox_disabled.png");
checkboxImgDefault->SetMidHandle();
Image * checkboxImgOnClick = ResourceManager::Instance().LoadImage(
"data/checkbox_enabled.png");
checkboxImgOnClick->SetMidHandle();
//slider Imgs
Image * sliderBallImg = ResourceManager::Instance().LoadImage("data/slider_ball.png");
sliderBallImg->SetHandle(
static_cast<float>(sliderBallImg->GetWidth() * sliderBallImg->GetHFrames() / 2),
static_cast<float>(sliderBallImg->GetHeight() * sliderBallImg->GetVFrames()));
Image * sliderBarImg = ResourceManager::Instance().LoadImage("data/slider_bar.png");
sliderBarImg->SetHandle(0,
static_cast<float>(sliderBarImg->GetHeight() * sliderBarImg->GetVFrames()));
Image * sliderLeftDefaultImg = ResourceManager::Instance().LoadImage(
"data/slider_left_default.png");
sliderLeftDefaultImg->SetMidHandle();
Image * sliderRightDefaultImg = ResourceManager::Instance().LoadImage(
"data/slider_right_default.png");
sliderRightDefaultImg->SetMidHandle();
Image * sliderLeftOnClickImg = ResourceManager::Instance().LoadImage(
"data/slider_left_onclick.png");
sliderLeftOnClickImg->SetMidHandle();
Image * sliderRightOnClickImg = ResourceManager::Instance().LoadImage(
"data/slider_right_onclick.png");
sliderRightOnClickImg->SetMidHandle();
//Input & Control managers
CInputManager * inputManager = &CInputManager::Instance();
assert(inputManager != nullptr);
CControlManagerUI controlManager;
controlManager.Init();
String str;
//Controls
CWindowUI background;
background.Init(0, 0, backgroundImg);
background.SetId(0);
controlManager.AddControl(&background);
CWindowUI windowSlider;
windowSlider.Init(100, 0, windowImg);
windowSlider.SetId(1);
controlManager.AddControl(&windowSlider);
CButtonUI button;
button.Init(350, 80, buttonImgDefault, buttonImgOnClick, buttonImgInactive);
button.SetId(0);
str = "Inactive";
button.SetText(str);
controlManager.AddControl(&button);
button.SetCurrentState(EGUICS_INACTIVE);
CButtonUI button2;
button2.Init(350, 140, buttonImgDefault, buttonImgOnClick, buttonImgInactive);
button2.SetId(1);
str = "Click";
button2.SetText(str);
controlManager.AddControl(&button2);
CSliderUI slider;
slider.Init(200, 400, 0, 10, sliderBarImg, sliderBallImg, sliderLeftDefaultImg,
sliderLeftOnClickImg, sliderRightDefaultImg, sliderRightOnClickImg);
slider.SetId(0);
controlManager.AddControl(&slider);
//.........这里部分代码省略.........