Make Radar with FalagardStaticImage

For help with anything that CEGUI doesn't offer straight out-of-the-box, e.g.:
- Implementation of new features, such as new Core classes, widgets, WindowRenderers, etc. ...
- Modification of any existing features for specific purposes
- Integration of CEGUI in new engines or frameworks and writing of new plugins (Renderer, Parser, ...) or modules

Moderators: CEGUI MVP, CEGUI Team

oanh201079
Just popping in
Just popping in
Posts: 6
Joined: Wed Jan 26, 2011 02:45

Make Radar with FalagardStaticImage

Postby oanh201079 » Wed Jan 26, 2011 03:12

I want to make one round window with FalagardStaticImage for radar but It is not active with this code.

Code: Select all

   void   FalagardSceneMap::createBackground( const String& strFileName, const int nUserSharp )
   {
      int i,j;
      char szWindowName[ 128 ], szImagesetName[ 128 ];

      sprintf( szWindowName, "%s_auto_background", getName().c_str() );
      if( WindowManager::getSingleton().isWindowPresent( szWindowName ) )
         WindowManager::getSingleton().destroyWindow( szWindowName );

      WindowManager::getSingleton().createWindow("DefaultWindow", szWindowName );
      m_pBackground = WindowManager::getSingleton().getWindow( szWindowName );
      addChildWindow( m_pBackground );

   m_pBackground->setUserSharp(LookLikeRound);

      m_pBackground->setMouseHollow( true );
      m_pBackground->setMouseMoveHollow( true );
      m_pBackground->setMouseLButtonHollow( true );
      m_pBackground->setMouseRButtonHollow( true );
      m_pBackground->setMaximumSize( Size( 100, 100 ) );
      
      float fOffsetX, fOffsetY;
      float fPicSizeX = 256, fPicSizeY = 256;

      fOffsetX = float( ( int( d_SceneSize.d_width ) % SCENE_MAP_PER_PIC ) / float( SCENE_MAP_PER_PIC ) ); 
      fOffsetY = float( ( int( d_SceneSize.d_height ) % SCENE_MAP_PER_PIC ) / float( SCENE_MAP_PER_PIC ) );
      m_nXCount =  int( d_SceneSize.d_width ) / SCENE_MAP_PER_PIC;
      m_nYCount =  int( d_SceneSize.d_height ) / SCENE_MAP_PER_PIC;
      if( fOffsetX )
         m_nXCount += 1;
      else
         fOffsetX = 1;
      if( fOffsetY )
         m_nYCount += 1;
      else
         fOffsetY = 1;
         

      float fWidthPerItem = 1 / d_SceneSize.d_width;
      float fHeightPerItem = 1 / d_SceneSize.d_height;

      for( i = 0; i < m_nXCount; i ++ )
      {
         for( j = 0; j < m_nYCount; j ++ )
         {
            sprintf( szImagesetName, "%s_%d_%d", strFileName.c_str(),i,j );

            Rect winRect( 0, 0, float( fPicSizeX ), float( fPicSizeY ) );
            if( i == m_nXCount - 1 && fOffsetX != 1 )
               winRect.d_right = float( fOffsetX * fPicSizeX );
            if( j == m_nYCount - 1 && fOffsetY != 1 )
               winRect.d_bottom = float( fOffsetY * fPicSizeY);

            sprintf( szWindowName, "%s_map_%d_%d", getName().c_str(),i, j );
            Window* pWindow = NULL;

            if (WindowManager::getSingleton().isWindowPresent( szWindowName ) )
               pWindow = WindowManager::getSingleton().getWindow( szWindowName );
            else
               pWindow = WindowManager::getSingleton().createWindow( "TLBB_StaticImageNULL", szWindowName );

            pWindow->setMouseHollow( true );
            pWindow->setMouseMoveHollow( true );
            pWindow->setMouseLButtonHollow( true );
            pWindow->setMouseRButtonHollow( true );
            pWindow->setMaximumSize( Size( 100, 100 ) );

            m_pBackground->addChildWindow( pWindow );
            ((StaticImage*)pWindow)->setImage(getImageByName(szImagesetName,winRect));


            winRect.d_left= i * SCENE_MAP_PER_PIC / d_SceneSize.d_width;
            winRect.d_top = j * SCENE_MAP_PER_PIC / d_SceneSize.d_height;
            winRect.d_right = winRect.d_left + ( fOffsetX * SCENE_MAP_PER_PIC) / d_SceneSize.d_width;
            winRect.d_bottom = winRect.d_top + ( fOffsetY * SCENE_MAP_PER_PIC) / d_SceneSize.d_height;
            pWindow->setRect( Relative, winRect );
         }
      }
   }
   void FalagardSceneMap::CreateSceneMap( const String& strFileName, const int nUserSharp )
   {
      int i;
      char szWindowName[ 128 ];
      createBackground( strFileName, nUserSharp );
      for( i = 0; i < 5; i ++ )
      {
         sprintf( szWindowName, "Scenemap_Player_%d", i );
         if( !WindowManager::getSingleton().isWindowPresent( szWindowName ) )
            WindowManager::getSingleton().createWindow( "TLBB_StaticImageNULL", szWindowName );

         m_pFriendWindow[ i ] = (StaticImage*)WindowManager::getSingleton().getWindow( szWindowName );
         ((StaticImage*)m_pFriendWindow[ i ])->setImage( d_PlayerImage );
         m_pBackground->addChildWindow( m_pFriendWindow[ i ] );

         m_pFriendWindow[ i ]->hide();
      }
      sprintf( szWindowName, "%s_Auto_MyselfWindow", getName().c_str() ); 
      if( !WindowManager::getSingleton().isWindowPresent( szWindowName ) )
         WindowManager::getSingleton().createWindow( "TLBB_StaticImageNULL", szWindowName );

      m_pMySelfWindow = (StaticImage*)WindowManager::getSingleton().getWindow( szWindowName );
      m_pMySelfWindow->setAlwaysOnTop( true );

      m_pBackground->addChildWindow( m_pMySelfWindow );

      UpdateAllWindow();
   }


I rewrite this code from TianLongBabu and use its resource but m_pBackground->setUserSharp(LookLikeRound); is not active

Image

So, SceneMap is over Radar :( Help me

User avatar
Kulik
CEGUI Team
Posts: 1382
Joined: Mon Jul 26, 2010 18:47
Location: Czech Republic
Contact:

Re: Make Radar with FalagardStaticImage

Postby Kulik » Wed Jan 26, 2011 13:18

Please don't cross post.


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 7 guests