The following fix my problem.
Code: Select all
void EditorGLCanvas::addRegion( const wxString& name, const wxRect& dim )
{
ElasticBox* toolbox = static_cast<ElasticBox*>(
WindowManager::getSingleton().createWindow( "CEImagesetEditor/ImageRegion", CEGUIHelper::ToCEGUIString( name ) ) );
#if 0
float posx = 0, posy = 0, width = 0, height = 0;
if ( ( m_realWidth != 0 ) && ( m_realHeight != 0) )
{
posx = static_cast<float>( dim.GetX() ) / m_realWidth;
posy = static_cast<float>( dim.GetY() ) / m_realHeight;
width = static_cast<float>( dim.GetWidth() ) / m_realWidth;
height = static_cast<float>( dim.GetHeight() ) / m_realHeight;
}
// set size and position (all relative co-ords)
toolbox->setPosition( UVector2( UDim( posx, 0.0f ), UDim( posy, 0.0f ) ) );
toolbox->setSize( UVector2( UDim( width, 0.0f ), UDim( height, 0.0f ) ) );
#endif
toolbox->setPosition( UVector2( UDim( 0, dim.GetX() ), UDim( 0, dim.GetY() ) ) );
toolbox->setSize( UVector2( UDim( 0, dim.GetWidth() ), UDim( 0, dim.GetHeight() ) ) );
.
.
.
Imho, in the imageset editor, it doesn't make sense to use scalling. It should always be an offset since we are dealing with an image in pixels. I prefer to use an offset.
I also don't understand why the offset portion of a UVec2 is not an integer value.
Anyone can shed some light on these issues?
Thanks,
ppl