Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 11, 2010, 11:34:20 AM (14 years ago)
Author:
rgrieder
Message:

Removed a ton of msvc warnings revealed with OGRE v1.7 (they removed the warning suppressors in OgrePrerequisites.h).
All of them are conversions from one type to another that might be lossy (mostly double to float, please always use "3.7f" instead of "3.7" as constants when using floats).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/modules/overlays/hud/HUDNavigation.cc

    r6417 r6502  
    153153        int dist = static_cast<int>(getDist2Focus());
    154154        navText_->setCaption(multi_cast<std::string>(dist));
    155         float textLength = multi_cast<std::string>(dist).size() * navText_->getCharHeight() * 0.3;
     155        float textLength = multi_cast<std::string>(dist).size() * navText_->getCharHeight() * 0.3f;
    156156
    157157        orxonox::Camera* cam = CameraManager::getInstance().getActiveCamera();
     
    191191                {
    192192                    // up
    193                     float position = pos.x / pos.y + 1.0;
    194                     navMarker_->setPosition((position - navMarker_->getWidth()) * 0.5, 0.0);
    195                     navMarker_->setUV(0.5, 0.0, 1.0, 0.5);
    196                     navText_->setLeft((position - textLength) * 0.5);
     193                    float position = pos.x / pos.y + 1.0f;
     194                    navMarker_->setPosition((position - navMarker_->getWidth()) * 0.5f, 0.0f);
     195                    navMarker_->setUV(0.5f, 0.0f, 1.0f, 0.5f);
     196                    navText_->setLeft((position - textLength) * 0.5f);
    197197                    navText_->setTop(navMarker_->getHeight());
    198198                }
     
    200200                {
    201201                    // left
    202                     float position = pos.y / pos.x + 1.0;
    203                     navMarker_->setPosition(0.0, (position - navMarker_->getWidth()) * 0.5);
    204                     navMarker_->setUV(0.0, 0.0, 0.5, 0.5);
    205                     navText_->setLeft(navMarker_->getWidth() + 0.01);
    206                     navText_->setTop((position - navText_->getCharHeight()) * 0.5);
     202                    float position = pos.y / pos.x + 1.0f;
     203                    navMarker_->setPosition(0.0f, (position - navMarker_->getWidth()) * 0.5f);
     204                    navMarker_->setUV(0.0f, 0.0f, 0.5f, 0.5f);
     205                    navText_->setLeft(navMarker_->getWidth() + 0.01f);
     206                    navText_->setTop((position - navText_->getCharHeight()) * 0.5f);
    207207                }
    208208            }
     
    212212                {
    213213                    // down
    214                     float position = -pos.x / pos.y + 1.0;
    215                     navMarker_->setPosition((position - navMarker_->getWidth()) * 0.5, 1.0 - navMarker_->getHeight());
    216                     navMarker_->setUV(0.0, 0.5, 0.5, 1.0);
    217                     navText_->setLeft((position - textLength) * 0.5);
    218                     navText_->setTop(1.0 - navMarker_->getHeight() - navText_->getCharHeight());
     214                    float position = -pos.x / pos.y + 1.0f;
     215                    navMarker_->setPosition((position - navMarker_->getWidth()) * 0.5f, 1.0f - navMarker_->getHeight());
     216                    navMarker_->setUV(0.0f, 0.5f, 0.5f, 1.0f);
     217                    navText_->setLeft((position - textLength) * 0.5f);
     218                    navText_->setTop(1.0f - navMarker_->getHeight() - navText_->getCharHeight());
    219219                }
    220220                else
    221221                {
    222222                    // right
    223                     float position = -pos.y / pos.x + 1.0;
    224                     navMarker_->setPosition(1.0 - navMarker_->getWidth(), (position - navMarker_->getHeight()) * 0.5);
    225                     navMarker_->setUV(0.5, 0.5, 1.0, 1.0);
    226                     navText_->setLeft(1.0 - navMarker_->getWidth() - textLength - 0.01);
    227                     navText_->setTop((position - navText_->getCharHeight()) * 0.5);
     223                    float position = -pos.y / pos.x + 1.0f;
     224                    navMarker_->setPosition(1.0f - navMarker_->getWidth(), (position - navMarker_->getHeight()) * 0.5f);
     225                    navMarker_->setUV(0.5f, 0.5f, 1.0f, 1.0f);
     226                    navText_->setLeft(1.0f - navMarker_->getWidth() - textLength - 0.01f);
     227                    navText_->setTop((position - navText_->getCharHeight()) * 0.5f);
    228228                }
    229229            }
     
    243243
    244244            // object is in view
    245             navMarker_->setUV(0.0, 0.0, 1.0, 1.0);
    246             navMarker_->setLeft((pos.x + 1.0 - navMarker_->getWidth()) * 0.5);
    247             navMarker_->setTop((-pos.y + 1.0 - navMarker_->getHeight()) * 0.5);
     245            navMarker_->setUV(0.0f, 0.0f, 1.0f, 1.0f);
     246            navMarker_->setLeft((pos.x + 1.0f - navMarker_->getWidth()) * 0.5f);
     247            navMarker_->setTop((-pos.y + 1.0f - navMarker_->getHeight()) * 0.5f);
    248248
    249249/*
    250250            aimMarker_->show();
    251             aimMarker_->setLeft((aimpos.x + 1.0 - aimMarker_->getWidth()) * 0.5);
    252             aimMarker_->setTop((-aimpos.y + 1.0 - aimMarker_->getHeight()) * 0.5);
    253 */
    254             navText_->setLeft((pos.x + 1.0 + navMarker_->getWidth()) * 0.5);
    255             navText_->setTop((-pos.y + 1.0 + navMarker_->getHeight()) * 0.5);
     251            aimMarker_->setLeft((aimpos.x + 1.0f - aimMarker_->getWidth()) * 0.5f);
     252            aimMarker_->setTop((-aimpos.y + 1.0f - aimMarker_->getHeight()) * 0.5f);
     253*/
     254            navText_->setLeft((pos.x + 1.0f + navMarker_->getWidth()) * 0.5f);
     255            navText_->setTop((-pos.y + 1.0f + navMarker_->getHeight()) * 0.5f);
    256256        }
    257257    }
Note: See TracChangeset for help on using the changeset viewer.