本文整理汇总了C++中WorldMap::GetMapMOS方法的典型用法代码示例。如果您正苦于以下问题:C++ WorldMap::GetMapMOS方法的具体用法?C++ WorldMap::GetMapMOS怎么用?C++ WorldMap::GetMapMOS使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WorldMap
的用法示例。
在下文中一共展示了WorldMap::GetMapMOS方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AdjustScrolling
void WorldMapControl::AdjustScrolling(short x, short y)
{
WorldMap* worldmap = core->GetWorldMap();
if (x || y) {
ScrollX += x;
ScrollY += y;
} else {
//center worldmap on current area
unsigned entry;
WMPAreaEntry *m = worldmap->GetArea(currentArea,entry);
if (m) {
ScrollX = m->X - Width/2;
ScrollY = m->Y - Height/2;
}
}
Sprite2D *MapMOS = worldmap->GetMapMOS();
if (ScrollX > MapMOS->Width - Width)
ScrollX = MapMOS->Width - Width;
if (ScrollY > MapMOS->Height - Height)
ScrollY = MapMOS->Height - Height;
if (ScrollX < 0)
ScrollX = 0;
if (ScrollY < 0)
ScrollY = 0;
Changed = true;
Area = NULL;
}
示例2: OnMouseWheelScroll
/** Mouse wheel scroll */
void WorldMapControl::OnMouseWheelScroll(short x, short y)
{
ScrollX += x;
ScrollY += y;
WorldMap* worldmap = core->GetWorldMap();
Sprite2D *MapMOS = worldmap->GetMapMOS();
if (ScrollX > MapMOS->Width - Width)
ScrollX = MapMOS->Width - Width;
if (ScrollY > MapMOS->Height - Height)
ScrollY = MapMOS->Height - Height;
if (ScrollX < 0)
ScrollX = 0;
if (ScrollY < 0)
ScrollY = 0;
}
示例3: Draw
/** Draws the Control on the Output Display */
void WorldMapControl::Draw(unsigned short XWin, unsigned short YWin)
{
WorldMap* worldmap = core->GetWorldMap();
if (!Width || !Height) {
return;
}
if(!Changed)
return;
Changed = false;
Video* video = core->GetVideoDriver();
Region r( XWin+XPos, YWin+YPos, Width, Height );
Region clipbackup;
video->GetClipRect(clipbackup);
video->SetClipRect(&r);
video->BlitSprite( worldmap->GetMapMOS(), MAP_TO_SCREENX(0), MAP_TO_SCREENY(0), true, &r );
unsigned int i;
unsigned int ec = worldmap->GetEntryCount();
for(i=0;i<ec;i++) {
WMPAreaEntry *m = worldmap->GetEntry(i);
if (! (m->GetAreaStatus() & WMP_ENTRY_VISIBLE)) continue;
int xOffs = MAP_TO_SCREENX(m->X);
int yOffs = MAP_TO_SCREENY(m->Y);
Sprite2D* icon = m->GetMapIcon(worldmap->bam);
if( icon ) {
if (m == Area) {
Palette *pal = icon->GetPalette();
icon->SetPalette(pal_selected);
video->BlitSprite( icon, xOffs, yOffs, true, &r );
icon->SetPalette(pal);
pal->Release();
} else {
video->BlitSprite( icon, xOffs, yOffs, true, &r );
}
video->FreeSprite( icon );
}
if (AnimPicture && !strnicmp(m->AreaResRef, currentArea, 8) ) {
video->BlitSprite( AnimPicture, xOffs, yOffs, true, &r );
}
}
// Draw WMP entry labels
if (ftext==NULL) {
video->SetClipRect(&clipbackup);
return;
}
for(i=0;i<ec;i++) {
WMPAreaEntry *m = worldmap->GetEntry(i);
if (! (m->GetAreaStatus() & WMP_ENTRY_VISIBLE)) continue;
Sprite2D *icon=m->GetMapIcon(worldmap->bam);
int h=0,w=0,xpos=0,ypos=0;
if (icon) {
h=icon->Height;
w=icon->Width;
xpos=icon->XPos;
ypos=icon->YPos;
video->FreeSprite( icon );
}
Region r2 = Region( MAP_TO_SCREENX(m->X-xpos), MAP_TO_SCREENY(m->Y-ypos), w, h );
if (!m->GetCaption())
continue;
int tw = ftext->CalcStringWidth( (unsigned char*)m->GetCaption() ) + 5;
int th = ftext->maxHeight;
Palette* text_pal = pal_normal;
if (Area == m) {
text_pal = pal_selected;
} else {
if (! (m->GetAreaStatus() & WMP_ENTRY_VISITED)) {
text_pal = pal_notvisited;
}
}
ftext->Print( Region( r2.x + (r2.w - tw)/2, r2.y + r2.h, tw, th ),
( const unsigned char * ) m->GetCaption(), text_pal, 0, true );
}
video->SetClipRect(&clipbackup);
}