comparison engine/core/gui/base/gui_font.cpp @ 654:5d6b1820b953

* Added the ability to change screen modes on the fly. This works both in OpenGL and SDL modes. * Added IEngineChangeListener so the client can update the cameras viewport if the screen mode has been changed. I chose to do it this way because the engine has no way to know which camera it should update. It will be up to the client to do it. * The cursor surface is now correctly freed when exiting. * Added DeviceCaps::getNearestScreenMode() for the client to request a supported screen mode. closes[t:315]
author prock@33b003aa-7bff-0310-803a-e67f0ece8222
date Thu, 21 Oct 2010 18:50:50 +0000
parents 47b49b9b0c0a
children
comparison
equal deleted inserted replaced
653:01acc9fc35ea 654:5d6b1820b953
36 36
37 namespace FIFE { 37 namespace FIFE {
38 GuiFont::GuiFont(AbstractFont* font): m_font(font) { 38 GuiFont::GuiFont(AbstractFont* font): m_font(font) {
39 assert(font); 39 assert(font);
40 } 40 }
41 41
42 GuiFont::~GuiFont() { 42 GuiFont::~GuiFont() {
43 delete m_font; 43 delete m_font;
44 } 44 }
45 45
46 int GuiFont::getStringIndexAt(const std::string& text, int x) const { 46 int GuiFont::getStringIndexAt(const std::string& text, int x) const {
47 return m_font->getStringIndexAt(text, x); 47 return m_font->getStringIndexAt(text, x);
48 } 48 }
49 49
50 void GuiFont::drawString(gcn::Graphics* graphics, const std::string& text, int x, int y) { 50 void GuiFont::drawString(gcn::Graphics* graphics, const std::string& text, int x, int y) {
51 if (text == "") { 51 if (text == "") {
52 return; 52 return;
53 } 53 }
54 54
88 if (!rect.intersects(Rect(clip.x,clip.y,clip.width,clip.height)) ) { 88 if (!rect.intersects(Rect(clip.x,clip.y,clip.width,clip.height)) ) {
89 return; 89 return;
90 } 90 }
91 image->render(rect); 91 image->render(rect);
92 } 92 }
93 93
94 void GuiFont::setRowSpacing (int spacing) { 94 void GuiFont::setRowSpacing (int spacing) {
95 m_font->setRowSpacing(spacing); 95 m_font->setRowSpacing(spacing);
96 } 96 }
97 97
98 int GuiFont::getRowSpacing() const { 98 int GuiFont::getRowSpacing() const {
99 return m_font->getRowSpacing(); 99 return m_font->getRowSpacing();
100 } 100 }
101 101
102 void GuiFont::setGlyphSpacing(int spacing) { 102 void GuiFont::setGlyphSpacing(int spacing) {
103 m_font->setGlyphSpacing(spacing); 103 m_font->setGlyphSpacing(spacing);
104 } 104 }
105 105
106 int GuiFont::getGlyphSpacing() const { 106 int GuiFont::getGlyphSpacing() const {
107 return m_font->getGlyphSpacing(); 107 return m_font->getGlyphSpacing();
108 } 108 }
109 109
110 void GuiFont::setAntiAlias(bool antiAlias) { 110 void GuiFont::setAntiAlias(bool antiAlias) {
111 m_font->setAntiAlias(antiAlias); 111 m_font->setAntiAlias(antiAlias);
112 } 112 }
113 113
114 bool GuiFont::isAntiAlias() { 114 bool GuiFont::isAntiAlias() {
115 return m_font->isAntiAlias(); 115 return m_font->isAntiAlias();
116 } 116 }
117 117
118 Image* GuiFont::getAsImage(const std::string& text) { 118 Image* GuiFont::getAsImage(const std::string& text) {
119 return m_font->getAsImage(text); 119 return m_font->getAsImage(text);
120 } 120 }
121 121
122 Image* GuiFont::getAsImageMultiline(const std::string& text) { 122 Image* GuiFont::getAsImageMultiline(const std::string& text) {
123 return m_font->getAsImageMultiline(text); 123 return m_font->getAsImageMultiline(text);
124 } 124 }
125 125
126 std::string GuiFont::splitTextToWidth (const std::string& text, int render_width) { 126 std::string GuiFont::splitTextToWidth (const std::string& text, int render_width) {
128 } 128 }
129 129
130 void GuiFont::setColor(uint8_t r,uint8_t g,uint8_t b, uint8_t a) { 130 void GuiFont::setColor(uint8_t r,uint8_t g,uint8_t b, uint8_t a) {
131 m_font->setColor(r, g, b, a); 131 m_font->setColor(r, g, b, a);
132 } 132 }
133 133
134 SDL_Color GuiFont::getColor() const { 134 SDL_Color GuiFont::getColor() const {
135 return m_font->getColor(); 135 return m_font->getColor();
136 } 136 }
137 137
138 int GuiFont::getWidth(const std::string& text) const { 138 int GuiFont::getWidth(const std::string& text) const {
139 return m_font->getWidth(text); 139 return m_font->getWidth(text);
140 } 140 }
141 141
142 int GuiFont::getHeight() const { 142 int GuiFont::getHeight() const {
143 return m_font->getHeight(); 143 return m_font->getHeight();
144 } 144 }
145
146 void GuiFont::invalidate() {
147 m_font->invalidate();
148 }
145 } 149 }