V-Gears 0
Free Final Fantasy VII engine.
UiFont.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2022 The V-Gears Team
3 *
4 * This file is part of V-Gears
5 *
6 * V-Gears is free software: you can redistribute it and/or modify it under
7 * terms of the GNU General Public License as published by the Free Software
8 * Foundation, version 3.0 (GPLv3) of the License.
9 *
10 * V-Gears is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
16#pragma once
17
18#include <OgreString.h>
19
24
29
33 int x;
34
38 int y;
39
43 int width;
44
48 int height;
49
53 int pre;
54
58 int post;
59};
60
64class UiFont{
65
66 public:
67
74 UiFont(const Ogre::String& name, const Ogre::String& language);
75
79 virtual ~UiFont();
80
86 const Ogre::String& GetName() const;
87
93 const Ogre::String& GetLanguage() const;
94
104 void SetImage(
105 const Ogre::String& image, const int width, const int height
106 );
107
113 const Ogre::String& GetImageName() const;
114
120 int GetImageWidth() const;
121
127 int GetImageHeight() const;
128
134 void SetHeight(const int height);
135
141 int GetHeight() const;
142
148 void AddCharData(const UiCharData& data);
149
159 UiCharData GetCharData(const int char_code) const;
160
161 private:
162
167
172
177
182
187
192
196 std::vector<UiCharData> char_data_;
197};
198
The UI widgets font.
Definition: UiFont.h:64
virtual ~UiFont()
Destructor.
Definition: UiFont.cpp:39
Ogre::String image_name_
The font image file name.
Definition: UiFont.h:176
void SetImage(const Ogre::String &image, const int width, const int height)
Sets an image for the font.
Definition: UiFont.cpp:45
int image_width_
The font image file width.
Definition: UiFont.h:181
std::vector< UiCharData > char_data_
List of character data for the font.
Definition: UiFont.h:196
const Ogre::String & GetImageName() const
Retrieves the font image file name.
Definition: UiFont.cpp:53
const Ogre::String & GetName() const
Retrieves the font name.
Definition: UiFont.cpp:41
Ogre::String name_
The font name.
Definition: UiFont.h:166
int GetHeight() const
Retrieves the character height of the font.
Definition: UiFont.cpp:62
const Ogre::String & GetLanguage() const
Retrieves the font language.
Definition: UiFont.cpp:43
int image_height_
The font image file height.
Definition: UiFont.h:186
void SetHeight(const int height)
Sets the character height for the font.
Definition: UiFont.cpp:60
UiFont(const Ogre::String &name, const Ogre::String &language)
Constructor.
Definition: UiFont.cpp:19
int GetImageHeight() const
Retrieves the font image height.
Definition: UiFont.cpp:58
int GetImageWidth() const
Retrieves the font image width.
Definition: UiFont.cpp:55
UiCharData GetCharData(const int char_code) const
Retrieves character data from a char code.
Definition: UiFont.cpp:66
Ogre::String language_
The font language.
Definition: UiFont.h:171
int height_
The height of the font characters.
Definition: UiFont.h:191
void AddCharData(const UiCharData &data)
Adds data for a character.
Definition: UiFont.cpp:64
Ogre::String String
Definition: TypeDefine.h:37
Character data for UI elements.
Definition: UiFont.h:23
int char_code
The character code.
Definition: UiFont.h:28
int width
The character width.
Definition: UiFont.h:43
int pre
Definition: UiFont.h:53
int y
The character Y position in the font image.
Definition: UiFont.h:38
int x
The character X position in the font image.
Definition: UiFont.h:33
int height
The character height.
Definition: UiFont.h:48
int post
Definition: UiFont.h:58