Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7355 in orxonox.OLD for trunk/src/lib/graphics


Ignore:
Timestamp:
Apr 19, 2006, 6:08:21 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: works on windows too

Location:
trunk/src/lib/graphics/text_engine
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/graphics/text_engine/text.cc

    r7221 r7355  
    1919#include "font.h"
    2020
    21 #include "graphics_engine.h"
    2221#include "util/loading/resource_manager.h"
    23 #include "class_list.h"
    2422#include "debug.h"
    25 #include "p_node.h"
    2623
    2724using namespace std;
    2825
    2926/**
    30  * creates a new Text Element
     27 * @brief creates a new Text Element
    3128 * @param fontFile the Font to render this text in
    3229 * @param type The renderType to display this font in
    3330 */
    3431Text::Text(const std::string& fontFile, unsigned int textSize)
    35 {
    36   this->init();
    37 
    38   if (!fontFile.empty())
    39     this->setFont(fontFile, FONT_DEFAULT_RENDER_SIZE);
    40   this->setSizeY2D(textSize);
    41 }
    42 
    43 /**
    44  *  deletes a Text out of memory
    45  *
    46  * This also ereases the text from the textList of the TextEngine
    47  */
    48 Text::~Text()
    49 {
    50   if (this->font != NULL && this->font != Font::getDefaultFont())
    51     ResourceManager::getInstance()->unload(this->font);
    52 }
    53 
    54 /**
    55  * initializes Text
    56  */
    57 void Text::init()
    5832{
    5933  this->setClassID(CL_TEXT, "Text");
     
    6741  this->setSize(TEXT_DEFAULT_SIZE);
    6842  this->setText("");
    69 }
    70 
    71 /**
    72  * sets the Font of this Text to font from fontFile
     43
     44
     45  if (!fontFile.empty())
     46    this->setFont(fontFile, FONT_DEFAULT_RENDER_SIZE);
     47  this->setSizeY2D(textSize);
     48}
     49
     50/**
     51 * @brief deletes a Text out of memory
     52 */
     53Text::~Text()
     54{
     55  if (this->font != NULL && this->font != Font::getDefaultFont())
     56    ResourceManager::getInstance()->unload(this->font);
     57}
     58
     59
     60/**
     61 * @brief sets the Font of this Text to font from fontFile
    7362 * @param fontFile the File to load the Font from.
    7463 * @param fontSize the Size of the Font
     
    9786
    9887/**
    99  * Sets a new Text to the font
     88 * @brief Sets a new Text to the font
    10089 * @param text the new text to set
    10190 */
     
    127116
    128117/**
    129  * draws the Text
     118 * @brief draws the Text
    130119 */
    131120void Text::draw() const
     
    194183
    195184/**
    196  * prints out some nice debug information about this text
     185 * @brief prints out some nice debug information about this text
    197186 */
    198187void Text::debug() const
    199188{
    200189  PRINT(0)("=== TEXT: %s ===\n", this->text.c_str());
    201 
    202   if (this->getBindNode())
    203     PRINT(0)("is bind to %s; ref=%p\n", this->getBindNode()->getName(), this->getBindNode());
    204190  PRINT(0)("Color: %0.2f %0.2f %0.2f\n", this->color.x, this->color.y, this->color.z);
    205191}
     
    210196////////////
    211197/**
    212  * Loads a Font from an SDL_surface into a texture.
     198 * @brief Loads a Font from an SDL_surface into a texture.
    213199 * @param surface The surface to make the texture of
    214200 * @param texCoord The texture coordinates of the 4 corners of the texture
     
    291277
    292278/**
    293  * Quick utility function for texture creation
     279 * @brief Quick utility function for texture creation
    294280 * @param input an integer
    295281 * @returns the next bigger 2^n-integer than input
  • trunk/src/lib/graphics/text_engine/text.h

    r7221 r7355  
    22 * @file text.h
    33 * @brief Definition of a text Class, that is able to render text.
    4 */
     4 */
    55
    66#ifndef _TEXT_H
     
    4141    Text(const std::string& fontFile = "", unsigned int fontSize = TEXT_DEFAULT_SIZE);
    4242    virtual ~Text();
    43     void init();
    4443
    4544    void setFont(const std::string& fontFile, unsigned int renderSize);
Note: See TracChangeset for help on using the changeset viewer.