fork download
  1. // Copyright (C) 2002-2012 Nikolaus Gebhardt
  2. // This file is part of the "Irrlicht Engine".
  3. // For conditions of distribution and use, see copyright notice in irrlicht.h
  4. // Sep 11, 2014; Jonathan Frisch
  5.  
  6. #ifndef __C_GUI_FONT_BITMAP_RESIZABLE_H_INCLUDED__
  7. #define __C_GUI_FONT_BITMAP_RESIZABLE_H_INCLUDED__
  8.  
  9. #include "irrlicht.h"
  10. #ifdef _IRR_COMPILE_WITH_GUI_
  11.  
  12. namespace irr
  13. {
  14.  
  15. namespace video
  16. {
  17. class IVideoDriver;
  18. class IImage;
  19. }
  20.  
  21. namespace gui
  22. {
  23.  
  24. class IGUIEnvironment;
  25.  
  26. class CGUIFontBitmapScalable : public IGUIFontBitmap
  27. {
  28. public:
  29.  
  30. //! constructor
  31. CGUIFontBitmapScalable(IGUIEnvironment* env, const io::path& filename, ILogger* logger = NULL);
  32.  
  33. //! destructor
  34. virtual ~CGUIFontBitmapScalable();
  35.  
  36. //! loads a font from a texture file
  37. bool load(const io::path& filename);
  38.  
  39. //! loads a font from a texture file
  40. bool load(io::IReadFile* file);
  41.  
  42. //! loads a font from an XML file
  43. //\param directory Directory in which the bitmaps can be found
  44. bool load(io::IXMLReader* xml, const io::path& directory);
  45.  
  46. //! draws an text and clips it to the specified rectangle if wanted
  47. virtual void draw(const core::stringw& text, const core::rect<s32>& position,
  48. video::SColor color, bool hcenter=false,
  49. bool vcenter=false, const core::rect<s32>* clip=0) _IRR_OVERRIDE_;
  50.  
  51. //! returns the dimension of a text
  52. virtual core::dimension2d<u32> getDimension(const wchar_t* text) const _IRR_OVERRIDE_;
  53.  
  54. //! Calculates the index of the character in the text which is on a specific position.
  55. virtual s32 getCharacterFromPos(const wchar_t* text, s32 pixel_x) const _IRR_OVERRIDE_;
  56.  
  57. //! Returns the type of this font
  58. virtual EGUI_FONT_TYPE getType() const _IRR_OVERRIDE_ { return EGFT_BITMAP; }
  59.  
  60. //! set an Pixel Offset on Drawing ( scale position on width )
  61. virtual void setKerningWidth (s32 kerning) _IRR_OVERRIDE_;
  62. virtual void setKerningHeight (s32 kerning) _IRR_OVERRIDE_;
  63.  
  64. //! set an Pixel Offset on Drawing ( scale position on width )
  65. virtual s32 getKerningWidth(const wchar_t* thisLetter=0, const wchar_t* previousLetter=0) const _IRR_OVERRIDE_;
  66. virtual s32 getKerningHeight() const _IRR_OVERRIDE_;
  67.  
  68. //! gets the sprite bank
  69. virtual IGUISpriteBank* getSpriteBank() const _IRR_OVERRIDE_;
  70.  
  71. //! returns the sprite number from a given character
  72. virtual u32 getSpriteNoFromChar(const wchar_t *c) const _IRR_OVERRIDE_;
  73.  
  74. virtual void setInvisibleCharacters( const wchar_t *s ) _IRR_OVERRIDE_;
  75.  
  76. virtual f32 getFontScale() { return fontScale; }
  77.  
  78. virtual void setFontScale(f32 scale) { fontScale = scale; }
  79.  
  80. virtual void setBaseFontScale(f32 baseScale) { baseFontScale = baseScale; }
  81.  
  82. private:
  83.  
  84. struct SFontArea
  85. {
  86. SFontArea() : underhang(0), overhang(0), width(0), spriteno(0) {}
  87. s32 underhang;
  88. s32 overhang;
  89. s32 width;
  90. s32 height;
  91. u32 spriteno;
  92. };
  93.  
  94. //! load & prepare font from ITexture
  95. bool loadTexture(video::IImage * image, const io::path& name);
  96.  
  97. void readPositions(video::IImage* texture, s32& lowerRightPositions);
  98.  
  99. s32 getAreaFromCharacter (const wchar_t c) const;
  100. void setMaxHeight();
  101.  
  102. core::array<SFontArea> Areas;
  103. core::map<wchar_t, s32> CharacterMap;
  104. video::IVideoDriver* Driver;
  105. IGUISpriteBank* SpriteBank;
  106. IGUIEnvironment* Environment;
  107. ILogger* Logger;
  108. f32 fontScale, baseFontScale;
  109. u32 WrongCharacter;
  110. s32 MaxHeight;
  111. s32 GlobalKerningWidth, GlobalKerningHeight;
  112.  
  113. core::stringw Invisible;
  114. };
  115.  
  116. } // end namespace gui
  117. } // end namespace irr
  118.  
  119. #endif // _IRR_COMPILE_WITH_GUI_
  120.  
  121. #endif // __C_GUI_FONT_BITMAP_RESIZABLE_H_INCLUDED__
  122.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:9:22: fatal error: irrlicht.h: No such file or directory
 #include "irrlicht.h"
                      ^
compilation terminated.
stdout
Standard output is empty