Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 11560


Ignore:
Timestamp:
Nov 13, 2017, 4:20:31 PM (7 years ago)
Author:
fanconic
Message:

Das StoryModeHUD.cc wurde kompiliert und ist momentan bugfrei. Es funktioniert ein Text an einer gewuenschten Stelle im Spiel zu generieren,

Location:
code/branches/CampaignMap_HS17
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • code/branches/CampaignMap_HS17/data/levels/NC_StoryModeLevel.oxw

    r11544 r11560  
    1111  include("templates/lodInformation.oxt")
    1212  include("templates/StoryMode.oxt")
    13 
     13  include("HUDTemplates3.oxo")
    1414  include("templates/spaceshipAssff.oxt")
    1515  include("templates/spaceshipEscort.oxt")
     
    1717?>
    1818
    19 <Level>
     19<Level  gametype = StoryMode>
    2020
    2121  <templates>
     
    2929  >
    3030
    31   <SpawnPoint position="000.000, 000.000, 1000.000" orientation="0, 0, 0, -1" pawndesign= StoryMode />
     31  <SpawnPoint position="000.000, 000.000, 1000.000" spawnclass=SpaceShip orientation="0, 0, 0, -1" pawndesign= spaceshipescort />
    3232   
    3333
    3434  <StaticEntity position="0,0,0" direction="0,0,0" >
    35   <attached>
     35    <attached>
    3636
    3737    <Model position="600,370,0" mesh="planets/moon.mesh" scale=100 />
     
    6262    <Billboard colour="1,1,0.05" position="1500,-1300,-2080"  material="Flares/lensflare" scale=5 />
    6363
     64    <Model position="0,0,0" mesh="planets/moon.mesh" scale=100 />
     65   
     66
    6467  </attached>
    6568</StaticEntity>
    66 
    67 <MovableEntity>
    68    
    69 
    70     <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0"/>
    71     <SpawnPoint team=0 position="-200,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipescort />
    72 
    73 </MovableEntity>
    7469
    7570   
  • code/branches/CampaignMap_HS17/data/levels/emptyLevel.oxw

    r11545 r11560  
    1010  include("HUDTemplates3.oxo")
    1111  include("templates/lodInformation.oxt")
     12  include("StoryModeHUD2")
     13  include("StoryMode.oxt")
    1214?>
    1315
     
    6062  </attached>
    6163  </StoryModePlanet>
    62 
    63   <MovableEntity>
    64     <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0"/>
    65   </MovableEntity> 
     64  <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0"/>
    6665  <SpawnPoint team=0 position="-200,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipescort />
    6766  </Scene>
  • code/branches/CampaignMap_HS17/data/levels/templates/StoryMode.oxt

    r11359 r11560  
    11<Template name=StoryMode>
    22  <SpaceShip
    3    hudtemplate            = StoryModeMap
     3   hudtemplate            = StoryModeHUD2
    44   camerapositiontemplate = spaceshipghostcameras
    55   
  • code/branches/CampaignMap_HS17/data/overlays/HUDTemplates3.oxo

    r11451 r11560  
    4848  <OverlayGroup name = "spaceshiphud" scale = "1, 1">
    4949    <Map />
     50
     51
     52
     53    <StoryModeHUD
     54     name           = "StoryMode"
     55     correctaspect  = false
     56     font           = "Monofur"
     57     textSize       = 0.05
     58     align          = "center"
     59    />
     60
     61
    5062
    5163    <HUDHealthBar
  • code/branches/CampaignMap_HS17/data/overlays/StoryModeHUD2.oxo

    r11544 r11560  
    2222-->
    2323
    24 <Template name="spectatorhud">
    25   <OverlayGroup name = "spectatorhud" scale = "1, 1">
    26   </OverlayGroup>
    27 </Template>
    2824
    29 <Template name="spaceshiphud">
     25<Template name="StoryModeHUD2">
    3026  <OverlayGroup name = "spaceshiphud" scale = "1, 1">
    31     <Map />
    3227
    3328    <!--
     
    4641     name           = "StoryMode"
    4742     correctaspect  = true
    48      font           = "Verdana"
     43     font           = "Monofur"
    4944     textSize       = 0.05
    50     />
    51 
    52     <GUIOverlay
    53       name = "QuestGUI"
    54       guiname = "QuestGUI"
    55       visible = "false"
    56     />
    57    
    58     <GUIOverlay
    59       name = "PickupInventory"
    60       guiname = "PickupInventory"
    61       visible = "false"
    62     />
    63 
    64     <GUIOverlay
    65       name = "Dialogue"
    66       guiname = "Dialogue"
    67       visible = "false"
    6845    />
    6946
  • code/branches/CampaignMap_HS17/src/modules/overlays/hud/CMakeLists.txt

    r11353 r11560  
    2727  LastTeamStandingInfos.cc
    2828  CountDown.cc
     29  StoryModeHUD.cc
    2930)
  • code/branches/CampaignMap_HS17/src/modules/overlays/hud/StoryModeHUD.cc

    r11544 r11560  
    6868    {
    6969        RegisterObject(StoryModeHUD);
    70  
     70
    7171        // Set default values
    72         this->setFont("Monofur");
    73         this->setTextSize(0.5f);
     72        //this->setFont("Monofur");
     73        //this->setTextSize(0.5f);
     74
     75        // Scales used for dimensions and text size
     76        float xScale = this->getActualSize().x;
     77        float yScale = this->getActualSize().y;
     78
     79        // Create text
     80        text_ = static_cast<Ogre::TextAreaOverlayElement*>( Ogre::OverlayManager::getSingleton()
     81                .createOverlayElement("TextArea", "StoryModeHUD_navText_" + getUniqueNumberString()));
     82        //text->setFontName(this->fontName_);
     83        //text->setCharHeight(this->textSize_ * yScale);
     84        text_->setDimensions(xScale, yScale);
     85
     86        text_->hide();
     87       
     88        this->background_->addChild(text_);
    7489    }
    7590
     
    102117        }
    103118        this->fontName_ = font;
    104         for (const auto& mapEntry : this->activeObjectList_)
    105         {
    106             if (mapEntry.second.text_ != nullptr)
    107                 mapEntry.second.text_->setFontName(this->fontName_);
    108         }
     119        if(text_ != nullptr)
     120            text_->setFontName(this->fontName_);
    109121    }
    110122   
     
    124136        }
    125137        this->textSize_ = size;
    126         for (const auto& mapEntry : this->activeObjectList_)
    127         {
    128             if (mapEntry.second.text_)
    129                 mapEntry.second.text_->setCharHeight(size);
    130         }
     138       
    131139    }
    132140
     
    151159
    152160
    153                     //display name next to cursor
    154                     //TODO: Planet.getName()
    155                     text_->setCaption("Hello Muthafuckin' World!");
     161        //display name next to cursor
     162        //TODO: Planet.getName()
     163        text_->setCaption("Was geht ab?");
    156164
    157                     // Transform to screen coordinates
    158                     Vector3 pos = camTransform *  planet->getRVWorldPosition();
     165        // Transform to screen coordinates
     166        Vector3 pos = camTransform * Vector3(0,0,0); // planet->getRVWorldPosition();
     167
     168        // If you fly passed the description, it gets out of sight
     169        if (pos.z > 1.0)
     170            return;
    159171       
    160                     // Position text
    161                     text_->setLeft((pos.x + 1.0f + it->second.panel_->getWidth()) * 0.5f);
    162                     it->second.text_->setTop((-pos.y + 1.0f + it->second.panel_->getHeight()) * 0.5f);
     172        // Position text
     173        text_->setLeft((pos.x+1)/2); // The (0,0) Coordinate is in the upper left corner.
     174        text_->setTop((-pos.y+1)/2);  // With those two calculations we set the desired positions
    163175
    164                     // Make sure the overlays are shown
    165                     it->second.text_->show();
     176        // Make sure the overlays are shown
     177        text_->show();
    166178
    167179    }
    168180
    169     void StoryModeHUD::addObject()
    170     {
    171         // Scales used for dimensions and text size
    172         float xScale = this->getActualSize().x;
    173         float yScale = this->getActualSize().y;
     181    //void StoryModeHUD::addObject()
    174182
    175         // Create text
    176         Ogre::TextAreaOverlayElement* text = static_cast<Ogre::TextAreaOverlayElement*>( Ogre::OverlayManager::getSingleton()
    177                 .createOverlayElement("TextArea", "StoryModeHUD_navText_" + getUniqueNumberString()));
    178         text->setFontName(this->fontName_);
    179         text->setCharHeight(this->textSize_ * yScale);
    180         text->setColour(object->getRadarObjectColour());
    181 
    182         text->hide();
    183        
    184         this->background_->addChild(text);
    185     }
    186 
    187     void StoryModeHUD::removeObject(RadarViewable* viewable)
     183    /*void StoryModeHUD::removeObject(RadarViewable* viewable)
    188184    {
    189185        Ogre::OverlayManager::getSingleton().destroyOverlayElement(it->second.text_);
    190     }
     186    }*/
    191187}
Note: See TracChangeset for help on using the changeset viewer.