//#################### PRIVATE METHODS #################### GUIComponent_Ptr GameState_LoadLevel::construct_display() { GUIContainer<ExplicitLayout> *display = new GUIContainer<ExplicitLayout>; bf::path imagesDir = DirectoryFinder::instance().determine_images_directory(); const Screen& screen = Screen::instance(); int width = screen.dimensions().width(); int height = screen.dimensions().height(); display->layout().add(new Picture((imagesDir / "loading.png").file_string()), Extents(width/4, 0, width*3/4, width/8)); // Determine the level name. std::string levelFilename = m_gameData->level_filename(); size_t i = levelFilename.find_last_of("/\\"); // find the last slash (slanting either way) in the filename std::string levelName = i == std::string::npos ? levelFilename.substr(0) : levelFilename.substr(i+1); levelName = levelName.substr(0, levelName.length()-4); // Load the appropriate loading image for the level. Picture *loadingPicture; try { loadingPicture = new Picture((imagesDir / ("load-" + levelName + ".png")).file_string()); } catch(FileNotFoundException&) { loadingPicture = new Picture((imagesDir / "load-missing.png").file_string()); } display->layout().add(loadingPicture, Extents(50, width/8, width - 50, height - 50)); return GUIComponent_Ptr(display); }
ON_BOOL32 ON_PlaneSurface::Split( int dir, double c, ON_Surface*& west_or_south_side, ON_Surface*& east_or_north_side ) const { ON_PlaneSurface* ws_side = 0; ON_PlaneSurface* en_side = 0; if ( dir < 0 || dir > 1 ) return false; if ( !Domain(dir).Includes(c,true) ) return false; double t; if ( Domain(dir) == Extents(dir) ) t = c; else { t = Extents(dir).ParameterAt( Domain(dir).NormalizedParameterAt(c) ); if ( !Extents(dir).Includes(t,true) ) return false; } if ( west_or_south_side ) { if ( west_or_south_side == east_or_north_side ) return false; ws_side = ON_PlaneSurface::Cast(west_or_south_side); if ( !ws_side ) return false; } if ( east_or_north_side ) { en_side = ON_PlaneSurface::Cast(east_or_north_side); if ( !en_side ) return false; } if ( !ws_side ) ws_side = new ON_PlaneSurface(); if ( !en_side ) en_side = new ON_PlaneSurface(); *ws_side = *this; *en_side = *this; ws_side->m_domain[dir].m_t[1] = c; en_side->m_domain[dir].m_t[0] = c; ws_side->m_extents[dir].m_t[1] = t; en_side->m_extents[dir].m_t[0] = t; west_or_south_side = ws_side; east_or_north_side = en_side; return true; }
ON_BOOL32 ON_PlaneSurface::GetSurfaceSize( double* width, double* height ) const { if ( width ) *width = Extents(0).Length(); if ( height ) *height = Extents(1).Length(); return true; }
void CHuiRasterizedTextMesh::DrawPictographLines(CHuiGc& aGc, const THuiRealPoint& aOffset, THuiAlignHorizontal aLineAlignment) const { if (!iPictographInterface || iUsingPreRasterizedMesh) { return; } TInt y = 0; // Draw the built lines using THuiImages. for(TInt i = 0; i < iPictographLines.Count(); ++i) { const SRasterizedLine& line = iPictographLines[i]; if(line.iTexture) { THuiImage textImage(*line.iTexture); THuiRealPoint linePos(0.f, TReal32(y)); THuiRealSize lineSize = line.iTexture->Size(); // Choose the line-specific alignment. switch(aLineAlignment) { case EHuiAlignHRight: linePos.iX = Extents().iWidth - lineSize.iWidth; break; case EHuiAlignHCenter: linePos.iX = (Extents().iWidth - lineSize.iWidth) / 2; break; default: break; } aGc.SetPenColor(KRgbWhite); aGc.DrawImage(textImage, linePos + aOffset, lineSize); // Move one line downwards. y += TInt(lineSize.iHeight) + line.iGap; } // Move extra gap downwards. y += line.iGap; // Add line spacing. y += iLineSpacing; } }
int main ( int argc, char **argv ) { glUtil *Window = new glUtil( &argc, argv, 640, 480 ); // Global Scene and World object Scene = new Physics(); MyWorld = Scene->GetWorld(); // Test code PhyBox *Object; b2Vec2 Extents(0.05, 0.05); for( int i = 0; i < 0; ++i ) { Object = new PhyBox( b2Vec2( sin( M_PI/180.0 * i*5 )*0.9, 10.0 + i*2 ), 0.0, Extents ); Object->Create(); Scene->AddPhyObj( Object ); } //PhyWheel *Wheel = new PhyWheel( b2Vec2(0.0, 1.0), 0.1 ); //Wheel->Create(); //Scene->AddPhyObj( Wheel ); PhyBox *Object1 = new PhyBox( b2Vec2(-0.1, 0.9), 0.0, Extents ); Object1->Create(); Scene->AddPhyObj( Object1 ); PhyBox *Object2 = new PhyBox( b2Vec2( 0.1, 0.9), 0.0, Extents ); Object2->Create(); Scene->AddPhyObj( Object2 ); Object1->CreateJoint( Object2 ); PhyGround *Ground = new PhyGround(); Ground->AddPoint( b2Vec2(-1.0, 1.0) ); Ground->AddPoint( b2Vec2(-1.0,-1.0) ); Ground->AddPoint( b2Vec2( 0.0, 0.0) ); Ground->AddPoint( b2Vec2( 1.0,-1.0) ); Ground->AddPoint( b2Vec2( 1.0, 1.0) ); Ground->Create(); Scene->AddPhyObj( Ground ); Window->SetDisplayFunc( DisplayFunction ); Window->SetMouseFunc( Setup::MouseFunc ); Window->SetKeyboardFunc( Setup::KeyboardFunc ); Window->SetReshapeFunc( Setup::ReshapeFunc ); Window->SetTimerFunc( Timer, 16 ); Window->MainLoop(); delete Scene; delete Window; return 0; }
void CHuiRasterizedTextMesh::DrawLines(CHuiGc& aGc, const THuiRealPoint& aOffset, THuiAlignHorizontal aLineAlignment, TReal32 aShadowOpacity) const { TInt y = 0; // Draw the built lines using THuiImages. for(TInt i = 0; i < iLines.Count(); ++i) { const SRasterizedLine& line = iLines[i]; if(line.iTexture) { THuiImage textImage(*line.iTexture); THuiRealPoint linePos(0.f, TReal32(y)); THuiRealSize lineSize = line.iTexture->Size(); // Do a downward scaling for line texture from TV resolution to LCD resolution. if(iTextMeshScale != 1) { lineSize.iHeight = lineSize.iHeight/iTextMeshScale; lineSize.iWidth = lineSize.iWidth/iTextMeshScale; } // Choose the line-specific alignment. switch(aLineAlignment) { case EHuiAlignHRight: linePos.iX = Extents().iWidth - lineSize.iWidth; break; case EHuiAlignHCenter: linePos.iX = (Extents().iWidth - lineSize.iWidth) / 2; break; default: break; } // Is there a shadow? if ( RasterizedShadow() ) { const TInt requestedBlurredSize = HUI_ROUND_FLOAT_TO_INT( 2*iVisual->DropShadowHandler()->iRadius.Now() ); THuiTextureHandle shadow; TBool haveShadowTexture = line.iTexture->GetShadowTexture(shadow,requestedBlurredSize ); if ( haveShadowTexture ) { THuiImage shadowImage(shadow); const THuiRealRect shadowDrawingRect = iVisual->DropShadowHandler()->ShadowDrawingRealRect( linePos, lineSize, shadow.Size(), *iVisual ); const TRgb oldColor = aGc.PenColorAlpha(); aGc.SetPenColor(iVisual->DropShadowHandler()->Color()); aGc.SetPenAlpha(HUI_ROUND_FLOAT_TO_INT(aShadowOpacity * 255.0f)); const THuiQuality oldQuality = aGc.Quality(); aGc.SetQuality(EHuiQualityFast); aGc.DrawImage(shadowImage, shadowDrawingRect.iTl + aOffset, shadowDrawingRect.Size()); aGc.SetPenColorAlpha(oldColor); aGc.SetQuality(oldQuality); } } aGc.DrawImage(textImage, linePos + aOffset, lineSize); // Move one line downwards. y += TInt(lineSize.iHeight) + line.iGap; } // Move extra gap downwards. y += line.iGap; // Add line spacing. y += iLineSpacing; } }
Extents Renderbuffer::getAttachmentSize(const gl::ImageIndex & /*imageIndex*/) const { return Extents(mState.mWidth, mState.mHeight, 1); }
void RenderBox( float _fWidth, float _fHeight, float _fDepth ) { TSRVector3 Extents( _fWidth, _fHeight, _fDepth ); RenderBox( Extents ); }
void addExtents(unsigned int maxLevel) { _extentsList.push_back(Extents(maxLevel, DBL_MAX, DBL_MAX, -DBL_MAX, -DBL_MAX)); }
void addExtents(unsigned int maxLevel, double minX, double minY, double maxX, double maxY) { _extentsList.push_back(Extents(maxLevel, minX, minY, maxX, maxY)); }