本文整理汇总了C++中Control::AssociateRoom方法的典型用法代码示例。如果您正苦于以下问题:C++ Control::AssociateRoom方法的具体用法?C++ Control::AssociateRoom怎么用?C++ Control::AssociateRoom使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Control
的用法示例。
在下文中一共展示了Control::AssociateRoom方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: iconRect
bool
RoomContainer::LoadWorldMap()
{
if (fWorldMap != NULL)
return true;
_Unload();
GUI* gui = GUI::Get();
gui->Clear();
if (!gui->Load("GUIWMAP")) {
return false;
}
gui->ShowWindow(0);
Window* window = gui->GetWindow(0);
if (window != NULL) {
// TODO: Move this into GUI ?
Control* control = window->GetControlByID(4);
if (control != NULL)
control->AssociateRoom(this);
}
fAreaOffset.x = fAreaOffset.y = 0;
Core::Get()->EnteredArea(this, NULL);
SetName("WORLDMAP");
GraphicsEngine::Get()->SetWindowCaption(Name());
fWorldMap = gResManager->GetWMAP(Name());
worldmap_entry entry = fWorldMap->WorldMapEntry();
fWorldMapBackground = gResManager->GetMOS(entry.background_mos);
fWorldMapBitmap = fWorldMapBackground->Image();
for (uint32 i = 0; i < fWorldMap->CountAreaEntries(); i++) {
AreaEntry& areaEntry = fWorldMap->AreaEntryAt(i);
const Bitmap* iconFrame = areaEntry.Icon();
IE::point position = areaEntry.Position();
GFX::rect iconRect(int16(position.x - iconFrame->Frame().w / 2),
int16(position.y - iconFrame->Frame().h / 2),
iconFrame->Frame().w, iconFrame->Frame().h);
GraphicsEngine::Get()->BlitBitmap(iconFrame, NULL,
fWorldMapBitmap, &iconRect);
}
return true;
}
示例2: catch
bool
RoomContainer::LoadArea(const res_ref& areaName, const char* longName,
const char* entranceName)
{
// Save the entrance name, it will be unloaded in UnloadArea
std::string savedEntranceName = entranceName ? entranceName : "";
_Unload();
SetName(areaName.CString());
GraphicsEngine::Get()->SetWindowCaption(Name());
std::cout << "Room::Load(" << areaName.CString() << ")" << std::endl;
fArea = gResManager->GetARA(Name());
if (fArea == NULL)
return false;
_InitWed(fArea->WedName().CString());
fBcs = gResManager->GetBCS(fArea->ScriptName());
Script* roomScript = NULL;
if (fBcs != NULL)
roomScript = fBcs->GetScript();
SetScript(roomScript);
GUI* gui = GUI::Get();
gui->Clear();
if (!gui->Load("GUIW")) {
// TODO: Delete other loaded stuff
gResManager->ReleaseResource(fArea);
fArea = NULL;
gResManager->ReleaseResource(fBcs);
fBcs = NULL;
SetScript(NULL);
delete roomScript;
return false;
}
gui->ShowWindow(uint16(-1));
Window* window = gui->GetWindow(uint16(-1));
gui->ShowWindow(0);
gui->ShowWindow(1);
/*gui->ShowWindow(2);
gui->ShowWindow(4);
if (Window* tmp = gui->GetWindow(4)) {
TextArea *textArea = dynamic_cast<TextArea*>(tmp->GetControlByID(3));
if (textArea != NULL)
textArea->SetText("This is a test");
}*/
//gui->GetWindow(15);
if (window != NULL) {
Control* control = window->GetControlByID(uint32(-1));
if (control != NULL)
control->AssociateRoom(this);
Label* label = dynamic_cast<Label*>(window->GetControlByID(268435459));
if (label != NULL)
label->SetText(longName);
}
_InitVariables();
_InitAnimations();
_InitRegions();
_LoadActors();
_InitDoors();
_InitContainers();
_InitBlitMask();
Core::Get()->EnteredArea(this, roomScript);
delete roomScript;
IE::point point = { 0, 0 };
if (!savedEntranceName.empty()) {
for (uint32 e = 0; e < fArea->CountEntrances(); e++) {
IE::entrance entrance = fArea->EntranceAt(e);
//std::cout << "current: " << entrance.name;
//std::cout << ", looking for " << entranceName << std::endl;
if (savedEntranceName == entrance.name) {
point.x = entrance.x;
point.y = entrance.y;
CenterArea(point);
break;
}
}
} else {
try {
IE::entrance entrance = fArea->EntranceAt(0);
point.x = entrance.x;
point.y = entrance.y;
} catch (std::out_of_range& ex) {
}
//.........这里部分代码省略.........