本文整理汇总了C++中Axis::getImage方法的典型用法代码示例。如果您正苦于以下问题:C++ Axis::getImage方法的具体用法?C++ Axis::getImage怎么用?C++ Axis::getImage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Axis
的用法示例。
在下文中一共展示了Axis::getImage方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateRegions
void RegionLoad::UpdateRegions()
{
//Define all regions actors
//Reset axis (Solve the bug "Game behavior differ based on editor grid position when uses regions", ALPHA_1_1_4.ged)
int xAxisAnt, yAxisAnt;
double scaleAnt;
Axis *pAxis = GameControl::Get()->GetAxis();
scaleAnt = pAxis->getScale();
xAxisAnt = pAxis->getImage()->X();
yAxisAnt = pAxis->getImage()->Y();
pAxis->SetScale(1.0);
pAxis->SetPos(0, 0);
pAxis->getImage()->Invalidate();
//Define actors
MapRegionsIterator it(regions);
RegionLoad *pRegion;
for( it.Begin(); !it.Done(); it.Next() )
{
pRegion = *it.Key();
pRegion->DefineActors();
}
SetDefaultRegionView();
//Restore axis (Solve the bug "Game behavior differ based on editor grid position when uses regions", ALPHA_1_1_4.ged)
pAxis->SetScale(scaleAnt);
pAxis->SetPos(xAxisAnt, yAxisAnt);
pAxis->getImage()->Invalidate();
}
示例2: UpdateView
void RegionLoad::UpdateView()
{
/*
Tests the intersection of all regions with the view (if moved)
Call CreateActors of the areas that began to intercept and
DestroyActors of the areas that are not more intercepting.
*/
//The coordinates changes solve the bug in activation-problem_view_parent.ged
//(don't load left region)
//Make sure view don't will shake
KrImage *pImageView = GameControl::Get()->GetViewActor()->getImage();
Axis *pAxis = GameControl::Get()->GetAxis();
if(pImageView->IsInvalid(true))
{
//Solve the alpha14.ged bug
pImageView->CalcCompositeTransform();
engine->Tree()->Walk(pImageView, true, true);
}
else
{
pImageView->CalcTransform();
}
//Get view bounds
KrRect rectView = pImageView->Bounds(), viewPos;
//Get view in screen and axis coordinates
KrVector2T< GlFixed > screen, axis;
pImageView->ObjectToScreen(0, 0, &screen);
pAxis->getImage()->ScreenToObject( screen.x.ToInt(), screen.y.ToInt(), &axis );
//Make sure rect is (0, 0, ...)
rectView.Translate(-rectView.xmin, -rectView.ymin);
//Translate to correct position
rectView.Translate(axis.x.ToInt(), axis.y.ToInt());
//Solve the bug: "PocketPC don't load checkers.ged"
viewPos.Set(rectView.xmin, rectView.ymin,
//zeroViewPos.x.ToInt(), zeroViewPos.y.ToInt(),
0, 0);
if(viewPos != viewPosAnt)
{
MapRegions createdRegions, destroyedRegions;
/*#ifdef DEBUG
GLOUTPUT( " View pos: (%ld, %ld)\n", rectView.xmin, rectView.ymin);
#endif*/
MapRegionsIterator it(regions);
RegionLoad *pRegion;
for( it.Begin(); !it.Done(); it.Next() )
{
pRegion = *it.Key();
pRegion->getImage()->CalcTransform();
KrRect rectRegion = pRegion->getImage()->Bounds();
rectRegion.Translate(-rectRegion.xmin, -rectRegion.ymin);
//To axis coordinate
pRegion->getImage()->ObjectToScreen(0, 0, &screen);
pAxis->getImage()->ScreenToObject( screen.x.ToInt(), screen.y.ToInt(), &axis );
rectRegion.Translate(axis.x.ToInt(), axis.y.ToInt());
//View and region in axis coordinates
if(rectView.Intersect(rectRegion))
{
if(!pRegion->bRegionInView)
{
createdRegions.Add(pRegion, 1);
}
}
else
{
if(pRegion->bRegionInView)
{
destroyedRegions.Add(pRegion, 1);
}
}
}
//Destroy actors from regions outside the view
//Solve the Move to Region.ged when add the 'sad' actor to two default regions
//(some times)
MapRegionsIterator it1(destroyedRegions);
for(it1.Begin(); !it1.Done(); it1.Next())
{
pRegion = *it1.Key();
pRegion->DestroyActors();
if(defaultRegion == pRegion)
//.........这里部分代码省略.........
示例3: DefineActors
void RegionLoad::DefineActors()
{
//Creates a list with actors that intercept the region
regionActors.Clear();
KrVector2T< GlFixed > screen, axis;
Axis *pAxis = GameControl::Get()->GetAxis();
//Get region bounds (Solve the bug "Game behavior differ based on editor grid position when uses regions", ALPHA_1_1_4.ged)
getImage()->CalcTransform();
KrRect rectRegion = getImage()->Bounds();
rectRegion.Translate(-rectRegion.xmin, -rectRegion.ymin);
//To axis coordinate (Solve the bug "Game behavior differ based on editor grid position when uses regions", ALPHA_1_1_4.ged)
getImage()->ObjectToScreen(0, 0, &screen);
pAxis->getImage()->ScreenToObject( screen.x.ToInt(), screen.y.ToInt(), &axis );
rectRegion.Translate(axis.x.ToInt(), axis.y.ToInt());
MapActorIterator it(mapActors);
for(it.Begin(); !it.Done(); it.Next())
{
ListActor *listActor = it.Value();
for(int il = 0; il < listActor->Count(); il++)
{
Actor *actor = (*listActor)[il];
if( actor->EditMode() &&
!actor->isRegion() &&
!actor->isView() &&
actor != pAxis
)
{
//Get actor bounds (Solve the bug "Game behavior differ based on editor grid position when uses regions", ALPHA_1_1_4.ged, abuse2.ged)
actor->getImage()->CalcCompositeTransform();
KrRect rectActor = actor->Bounds();
if(actor->getTextActor() && !rectActor.IsValid())
{
//Solve the bug "Text actors aren't load after use the LoadGame function without Activation Regions"
engine->Tree()->Walk(actor->getImage(), true, true);
rectActor = actor->Bounds();
}
if(actor->getTile() && !rectActor.IsValid())
{
//Solve the bug "Text actors aren't load after use the LoadGame function without Activation Regions"
engine->Tree()->Walk(actor->getImage(), true, true);
rectActor = actor->Bounds();
}
rectActor.Translate(-rectActor.xmin, -rectActor.ymin);
//To axis coordinate (Solve the bug "Game behavior differ based on editor grid position when uses regions", ALPHA_1_1_4.ged, abuse2.ged)
actor->getImage()->ObjectToScreen(0, 0, &screen);
pAxis->getImage()->ScreenToObject( screen.x.ToInt(), screen.y.ToInt(), &axis );
rectActor.Translate(axis.x.ToInt(), axis.y.ToInt());
if(rectActor.IsValid() && rectRegion.Intersect(rectActor))
{
regionActors.Add(actor->getCloneName(), 1);
}
}
}
}
viewPosAnt.Set(-123, 456, 0, 0);
bRegionInView = false;
}