mirror of
git://projects.qi-hardware.com/gmenu2x.git
synced 2024-11-22 18:23:08 +02:00
Renamed ASFont class to just Font
Originally the font implementation was based on SFont, but it was recently replaced by an SDL_ttf based implementation, so the name no longer made sense.
This commit is contained in:
parent
0046fa9e19
commit
724aefe482
@ -1,6 +1,6 @@
|
||||
bin_PROGRAMS = gmenu2x
|
||||
|
||||
gmenu2x_SOURCES = asfont.cpp button.cpp cpu.cpp dirdialog.cpp filedialog.cpp \
|
||||
gmenu2x_SOURCES = font.cpp button.cpp cpu.cpp dirdialog.cpp filedialog.cpp \
|
||||
filelister.cpp gmenu2x.cpp iconbutton.cpp imagedialog.cpp inputdialog.cpp \
|
||||
inputmanager.cpp linkapp.cpp link.cpp \
|
||||
menu.cpp menusettingbool.cpp menusetting.cpp menusettingdir.cpp \
|
||||
@ -14,7 +14,7 @@ gmenu2x_SOURCES = asfont.cpp button.cpp cpu.cpp dirdialog.cpp filedialog.cpp \
|
||||
browsedialog.cpp buttonbox.cpp dialog.cpp \
|
||||
imageio.cpp powersaver.cpp monitor.cpp mediamonitor.cpp clock.cpp
|
||||
|
||||
noinst_HEADERS = asfont.h button.h cpu.h dirdialog.h \
|
||||
noinst_HEADERS = font.h button.h cpu.h dirdialog.h \
|
||||
filedialog.h filelister.h gmenu2x.h gp2x.h iconbutton.h imagedialog.h \
|
||||
inputdialog.h inputmanager.h linkapp.h link.h \
|
||||
menu.h menusettingbool.h menusettingdir.h \
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include "filelister.h"
|
||||
#include "gmenu2x.h"
|
||||
#include "iconbutton.h"
|
||||
#include "surface.h"
|
||||
#include "utilities.h"
|
||||
|
||||
using std::string;
|
||||
@ -269,7 +270,7 @@ void BrowseDialog::paint()
|
||||
}
|
||||
icon->blit(gmenu2x->s, 5, offsetY);
|
||||
gmenu2x->s->write(gmenu2x->font, (*fl)[i], 24, offsetY + 8,
|
||||
ASFont::HAlignLeft, ASFont::VAlignMiddle);
|
||||
Font::HAlignLeft, Font::VAlignMiddle);
|
||||
|
||||
if (ts.available() && ts.pressed()
|
||||
&& ts.inRect(touchRect.x, offsetY + 3, touchRect.w, rowHeight)) {
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
#include "dialog.h"
|
||||
#include "gmenu2x.h"
|
||||
#include "asfont.h"
|
||||
#include "font.h"
|
||||
|
||||
Dialog::Dialog(GMenu2X *gmenu2x) : gmenu2x(gmenu2x)
|
||||
{
|
||||
@ -31,14 +31,14 @@ void Dialog::writeTitle(const std::string &title, Surface *s)
|
||||
{
|
||||
if (s==NULL)
|
||||
s = gmenu2x->s;
|
||||
s->write(gmenu2x->font, title, 40, gmenu2x->skinConfInt["topBarHeight"]/4, ASFont::HAlignLeft, ASFont::VAlignMiddle);
|
||||
s->write(gmenu2x->font, title, 40, gmenu2x->skinConfInt["topBarHeight"] / 4, Font::HAlignLeft, Font::VAlignMiddle);
|
||||
}
|
||||
|
||||
void Dialog::writeSubTitle(const std::string &subtitle, Surface *s)
|
||||
{
|
||||
if (s==NULL)
|
||||
s = gmenu2x->s;
|
||||
s->write(gmenu2x->font, subtitle, 40, gmenu2x->skinConfInt["topBarHeight"]/4*3, ASFont::HAlignLeft, ASFont::VAlignMiddle);
|
||||
s->write(gmenu2x->font, subtitle, 40, gmenu2x->skinConfInt["topBarHeight"] / 4 * 3, Font::HAlignLeft, Font::VAlignMiddle);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include "asfont.h"
|
||||
#include "font.h"
|
||||
|
||||
#include "debug.h"
|
||||
#include "surface.h"
|
||||
#include "utilities.h"
|
||||
@ -13,7 +14,7 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
ASFont::ASFont(const string &path)
|
||||
Font::Font(const string &path)
|
||||
{
|
||||
if (!TTF_WasInit() && TTF_Init() < 0) {
|
||||
ERROR("Unable to init SDL_ttf library\n");
|
||||
@ -29,20 +30,20 @@ ASFont::ASFont(const string &path)
|
||||
fontheight = TTF_FontHeight(font);
|
||||
}
|
||||
|
||||
ASFont::~ASFont()
|
||||
Font::~Font()
|
||||
{
|
||||
TTF_CloseFont(font);
|
||||
TTF_Quit();
|
||||
}
|
||||
|
||||
int ASFont::getTextWidth(const char *text)
|
||||
int Font::getTextWidth(const char *text)
|
||||
{
|
||||
int w, h;
|
||||
TTF_SizeUTF8(font, text, &w, &h);
|
||||
return w;
|
||||
}
|
||||
|
||||
void ASFont::write(Surface *surface, const string &text,
|
||||
void Font::write(Surface *surface, const string &text,
|
||||
int x, int y, HAlign halign, VAlign valign)
|
||||
{
|
||||
if (text.find("\n", 0) == string::npos) {
|
||||
@ -59,7 +60,7 @@ void ASFont::write(Surface *surface, const string &text,
|
||||
}
|
||||
}
|
||||
|
||||
void ASFont::writeLine(Surface *surface, const char *text,
|
||||
void Font::writeLine(Surface *surface, const char *text,
|
||||
int x, int y, HAlign halign, VAlign valign)
|
||||
{
|
||||
switch (halign) {
|
@ -1,24 +1,21 @@
|
||||
// Based on SFont by Karl Bartel.
|
||||
// Adapted to C++ by Massimiliano Torromeo.
|
||||
// Refactored by Maarten ter Huurne and several others (see git log).
|
||||
// Original font class was replaced by an SDL_ttf based one by Paul Cercueil.
|
||||
// License: GPL version 2 or later.
|
||||
|
||||
#ifndef ASFONT_H
|
||||
#define ASFONT_H
|
||||
#ifndef FONT_H
|
||||
#define FONT_H
|
||||
|
||||
#include <SDL_ttf.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class Surface;
|
||||
|
||||
class ASFont {
|
||||
class Font {
|
||||
public:
|
||||
enum HAlign { HAlignLeft, HAlignRight, HAlignCenter };
|
||||
enum VAlign { VAlignTop, VAlignBottom, VAlignMiddle };
|
||||
|
||||
ASFont(const std::string &font);
|
||||
~ASFont();
|
||||
Font(const std::string &font);
|
||||
~Font();
|
||||
|
||||
int getTextWidth(const char *text);
|
||||
|
||||
@ -44,4 +41,4 @@ private:
|
||||
unsigned int fontheight;
|
||||
};
|
||||
|
||||
#endif /* ASFONT_H */
|
||||
#endif /* FONT_H */
|
@ -20,12 +20,12 @@
|
||||
|
||||
#include "gp2x.h"
|
||||
|
||||
#include "asfont.h"
|
||||
#include "clock.h"
|
||||
#include "cpu.h"
|
||||
#include "debug.h"
|
||||
#include "filedialog.h"
|
||||
#include "filelister.h"
|
||||
#include "font.h"
|
||||
#include "gmenu2x.h"
|
||||
#include "iconbutton.h"
|
||||
#include "inputdialog.h"
|
||||
@ -314,7 +314,7 @@ void GMenu2X::initBG() {
|
||||
#else
|
||||
string df = getDiskFree(CARD_ROOT);
|
||||
#endif
|
||||
bgmain->write(font, df, 22, bottomBarTextY, ASFont::HAlignLeft, ASFont::VAlignMiddle);
|
||||
bgmain->write(font, df, 22, bottomBarTextY, Font::HAlignLeft, Font::VAlignMiddle);
|
||||
delete sd;
|
||||
|
||||
cpuX = font->getTextWidth(df)+32;
|
||||
@ -367,7 +367,7 @@ void GMenu2X::initFont() {
|
||||
quit();
|
||||
exit(-1);
|
||||
}
|
||||
font = new ASFont(fontFile);
|
||||
font = new Font(fontFile);
|
||||
}
|
||||
|
||||
void GMenu2X::initMenu() {
|
||||
@ -655,7 +655,7 @@ void GMenu2X::main() {
|
||||
sc[sectionIcon]->blit(s,x-16,sectionLinkPadding,32,32);
|
||||
else
|
||||
sc.skinRes("icons/section.png")->blit(s,x-16,sectionLinkPadding);
|
||||
s->write( font, menu->getSections()[i], x, skinConfInt["topBarHeight"]-sectionLinkPadding, ASFont::HAlignCenter, ASFont::VAlignBottom );
|
||||
s->write( font, menu->getSections()[i], x, skinConfInt["topBarHeight"]-sectionLinkPadding, Font::HAlignCenter, Font::VAlignBottom );
|
||||
}
|
||||
|
||||
//Links
|
||||
@ -675,10 +675,10 @@ void GMenu2X::main() {
|
||||
drawScrollBar(linkRows,menu->sectionLinks()->size()/linkColumns + ((menu->sectionLinks()->size()%linkColumns==0) ? 0 : 1),menu->firstDispRow(),43,resY-81);
|
||||
|
||||
if (menu->selLink()!=NULL) {
|
||||
s->write ( font, menu->selLink()->getDescription(), halfX, resY-19, ASFont::HAlignCenter, ASFont::VAlignBottom );
|
||||
s->write ( font, menu->selLink()->getDescription(), halfX, resY-19, Font::HAlignCenter, Font::VAlignBottom );
|
||||
if (menu->selLinkApp()!=NULL) {
|
||||
#ifdef ENABLE_CPUFREQ
|
||||
s->write ( font, menu->selLinkApp()->clockStr(confInt["maxClock"]), cpuX, bottomBarTextY, ASFont::HAlignLeft, ASFont::VAlignMiddle );
|
||||
s->write ( font, menu->selLinkApp()->clockStr(confInt["maxClock"]), cpuX, bottomBarTextY, Font::HAlignLeft, Font::VAlignMiddle );
|
||||
#endif
|
||||
//Manual indicator
|
||||
if (!menu->selLinkApp()->getManual().empty())
|
||||
@ -708,7 +708,7 @@ void GMenu2X::main() {
|
||||
|
||||
s->write(font, Clock::getInstance()->getTime(),
|
||||
halfX, bottomBarTextY,
|
||||
ASFont::HAlignCenter, ASFont::VAlignMiddle);
|
||||
Font::HAlignCenter, Font::VAlignMiddle);
|
||||
|
||||
if (helpDisplayed) {
|
||||
s->box(10,50,300,helpBoxHeight+4, skinConfColors[COLOR_MESSAGE_BOX_BG]);
|
||||
@ -738,7 +738,7 @@ void GMenu2X::main() {
|
||||
tickFPS = tickNow;
|
||||
drawn_frames = 0;
|
||||
}
|
||||
s->write( font, fps+" FPS", resX-1,1 ,ASFont::HAlignRight );
|
||||
s->write(font, fps + " FPS", resX - 1, 1, Font::HAlignRight);
|
||||
#endif
|
||||
|
||||
s->flip();
|
||||
@ -1098,7 +1098,7 @@ void GMenu2X::contextMenu() {
|
||||
//draw selection rect
|
||||
s->box( selbox.x, selbox.y, selbox.w, selbox.h, skinConfColors[COLOR_MESSAGE_BOX_SELECTION] );
|
||||
for (i=0; i<voices.size(); i++)
|
||||
s->write( font, voices[i].text, box.x+12, box.y+5+(h+2)*i, ASFont::HAlignLeft, ASFont::VAlignTop );
|
||||
s->write( font, voices[i].text, box.x+12, box.y+5+(h+2)*i, Font::HAlignLeft, Font::VAlignTop );
|
||||
s->flip();
|
||||
|
||||
//touchscreen
|
||||
@ -1353,7 +1353,7 @@ void GMenu2X::scanner() {
|
||||
Surface scanbg(bg);
|
||||
drawButton(&scanbg, "cancel", tr["Exit"],
|
||||
drawButton(&scanbg, "accept", "", 5)-10);
|
||||
scanbg.write(font,tr["Link Scanner"],halfX,7,ASFont::HAlignCenter,ASFont::VAlignMiddle);
|
||||
scanbg.write(font,tr["Link Scanner"],halfX,7,Font::HAlignCenter,Font::VAlignMiddle);
|
||||
scanbg.convertToDisplayFormat();
|
||||
|
||||
uint lineY = 42;
|
||||
@ -1532,7 +1532,7 @@ int GMenu2X::drawButton(Surface *s, const string &btn, const string &text, int x
|
||||
if (sc.skinRes("imgs/buttons/"+btn+".png") != NULL) {
|
||||
sc["imgs/buttons/"+btn+".png"]->blit(s, x, y-7);
|
||||
re.w = sc["imgs/buttons/"+btn+".png"]->width() + 3;
|
||||
s->write(font, text, x+re.w, y, ASFont::HAlignLeft, ASFont::VAlignMiddle);
|
||||
s->write(font, text, x+re.w, y, Font::HAlignLeft, Font::VAlignMiddle);
|
||||
re.w += font->getTextWidth(text);
|
||||
}
|
||||
return x+re.w+6;
|
||||
@ -1544,7 +1544,7 @@ int GMenu2X::drawButtonRight(Surface *s, const string &btn, const string &text,
|
||||
x -= 16;
|
||||
sc["imgs/buttons/"+btn+".png"]->blit(s, x, y-7);
|
||||
x -= 3;
|
||||
s->write(font, text, x, y, ASFont::HAlignRight, ASFont::VAlignMiddle);
|
||||
s->write(font, text, x, y, Font::HAlignRight, Font::VAlignMiddle);
|
||||
return x-6-font->getTextWidth(text);
|
||||
}
|
||||
return x-6;
|
||||
|
@ -32,8 +32,8 @@
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
class ASFont;
|
||||
class Button;
|
||||
class Font;
|
||||
class MediaMonitor;
|
||||
class Menu;
|
||||
class Surface;
|
||||
@ -151,7 +151,7 @@ public:
|
||||
SurfaceCollection sc;
|
||||
Translator tr;
|
||||
Surface *s, *bg;
|
||||
ASFont *font;
|
||||
Font *font;
|
||||
|
||||
//Status functions
|
||||
void main();
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "iconbutton.h"
|
||||
|
||||
#include "asfont.h"
|
||||
#include "font.h"
|
||||
#include "gmenu2x.h"
|
||||
#include "surface.h"
|
||||
|
||||
@ -35,7 +35,7 @@ void IconButton::paint() {
|
||||
}
|
||||
if (label != "") {
|
||||
gmenu2x->s->write(gmenu2x->font, label, labelRect.x, labelRect.y,
|
||||
ASFont::HAlignLeft, ASFont::VAlignMiddle);
|
||||
Font::HAlignLeft, Font::VAlignMiddle);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "delegate.h"
|
||||
#include "gmenu2x.h"
|
||||
#include "iconbutton.h"
|
||||
#include "surface.h"
|
||||
#include "utilities.h"
|
||||
|
||||
#include <SDL_gfxPrimitives.h>
|
||||
@ -168,7 +169,7 @@ bool InputDialog::exec() {
|
||||
gmenu2x->skinConfColors[COLOR_SELECTION_BG]);
|
||||
|
||||
gmenu2x->s->write(gmenu2x->font, input, box.x + 5, box.y + box.h - 2,
|
||||
ASFont::HAlignLeft, ASFont::VAlignBottom);
|
||||
Font::HAlignLeft, Font::VAlignBottom);
|
||||
|
||||
curTick = SDL_GetTicks();
|
||||
if (curTick - caretTick >= 600) {
|
||||
@ -310,7 +311,7 @@ void InputDialog::drawVirtualKeyboard() {
|
||||
gmenu2x->s->write(gmenu2x->font, charX,
|
||||
kbLeft + xc * KEY_WIDTH + KEY_WIDTH / 2 - 1,
|
||||
KB_TOP + l * KEY_HEIGHT + KEY_HEIGHT / 2,
|
||||
ASFont::HAlignCenter, ASFont::VAlignMiddle);
|
||||
Font::HAlignCenter, Font::VAlignMiddle);
|
||||
xc++;
|
||||
}
|
||||
}
|
||||
@ -330,7 +331,7 @@ void InputDialog::drawVirtualKeyboard() {
|
||||
gmenu2x->s->write(gmenu2x->font, gmenu2x->tr["Cancel"],
|
||||
(int)(160 - kbLength * KEY_WIDTH / 4),
|
||||
KB_TOP + kb->size() * KEY_HEIGHT + KEY_HEIGHT / 2,
|
||||
ASFont::HAlignCenter, ASFont::VAlignMiddle);
|
||||
Font::HAlignCenter, Font::VAlignMiddle);
|
||||
|
||||
re.x = kbLeft + kbLength * KEY_WIDTH / 2 - 1;
|
||||
gmenu2x->s->rectangle(re, gmenu2x->skinConfColors[COLOR_SELECTION_BG]);
|
||||
@ -341,5 +342,5 @@ void InputDialog::drawVirtualKeyboard() {
|
||||
gmenu2x->s->write(gmenu2x->font, gmenu2x->tr["OK"],
|
||||
(int)(160 + kbLength * KEY_WIDTH / 4),
|
||||
KB_TOP + kb->size() * KEY_HEIGHT + KEY_HEIGHT / 2,
|
||||
ASFont::HAlignCenter, ASFont::VAlignMiddle);
|
||||
Font::HAlignCenter, Font::VAlignMiddle);
|
||||
}
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "gmenu2x.h"
|
||||
#include "menu.h"
|
||||
#include "selector.h"
|
||||
#include "surface.h"
|
||||
#include "utilities.h"
|
||||
|
||||
#include <fstream>
|
||||
@ -47,12 +48,12 @@ void Link::paint() {
|
||||
if (iconSurface) {
|
||||
iconSurface->blit(gmenu2x->s, iconX, rect.y+padding, 32,32);
|
||||
}
|
||||
gmenu2x->s->write( gmenu2x->font, getTitle(), iconX+16, rect.y+gmenu2x->skinConfInt["linkHeight"]-padding, ASFont::HAlignCenter, ASFont::VAlignBottom );
|
||||
gmenu2x->s->write(gmenu2x->font, getTitle(), iconX+16, rect.y + gmenu2x->skinConfInt["linkHeight"]-padding, Font::HAlignCenter, Font::VAlignBottom);
|
||||
}
|
||||
|
||||
bool Link::paintHover() {
|
||||
if (gmenu2x->useSelectionPng)
|
||||
gmenu2x->sc["imgs/selection.png"]->blit(gmenu2x->s,rect,ASFont::HAlignCenter,ASFont::VAlignMiddle);
|
||||
gmenu2x->sc["imgs/selection.png"]->blit(gmenu2x->s, rect, Font::HAlignCenter, Font::VAlignMiddle);
|
||||
else
|
||||
gmenu2x->s->box(rect.x, rect.y, rect.w, rect.h, gmenu2x->skinConfColors[COLOR_SELECTION_BG]);
|
||||
return true;
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "gmenu2x.h"
|
||||
#include "menu.h"
|
||||
#include "selector.h"
|
||||
#include "surface.h"
|
||||
#include "textmanualdialog.h"
|
||||
#include "utilities.h"
|
||||
|
||||
@ -379,7 +380,7 @@ void LinkApp::drawRun() {
|
||||
else
|
||||
gmenu2x->sc["icons/generic.png"]->blit(gmenu2x->s,x,104);*/
|
||||
iconSurface->blit(gmenu2x->s,x,gmenu2x->halfY-16);
|
||||
gmenu2x->s->write( gmenu2x->font, text, x+42, gmenu2x->halfY+1, ASFont::HAlignLeft, ASFont::VAlignMiddle );
|
||||
gmenu2x->s->write( gmenu2x->font, text, x+42, gmenu2x->halfY+1, Font::HAlignLeft, Font::VAlignMiddle );
|
||||
gmenu2x->s->flip();
|
||||
}
|
||||
|
||||
@ -491,7 +492,7 @@ void LinkApp::showManual() {
|
||||
ss << page+1;
|
||||
ss >> pageStatus;
|
||||
pageStatus = gmenu2x->tr["Page"]+": "+pageStatus+"/"+spagecount;
|
||||
gmenu2x->s->write(gmenu2x->font, pageStatus, 310, 230, ASFont::HAlignRight, ASFont::VAlignMiddle);
|
||||
gmenu2x->s->write(gmenu2x->font, pageStatus, 310, 230, Font::HAlignRight, Font::VAlignMiddle);
|
||||
|
||||
gmenu2x->s->flip();
|
||||
repaint = false;
|
||||
|
@ -20,8 +20,9 @@
|
||||
|
||||
#include "menusetting.h"
|
||||
|
||||
#include "asfont.h"
|
||||
#include "font.h"
|
||||
#include "gmenu2x.h"
|
||||
#include "surface.h"
|
||||
|
||||
using std::string;
|
||||
|
||||
@ -40,7 +41,7 @@ MenuSetting::~MenuSetting()
|
||||
|
||||
void MenuSetting::draw(int y)
|
||||
{
|
||||
gmenu2x->s->write( gmenu2x->font, name, 5, y, ASFont::HAlignLeft, ASFont::VAlignTop );
|
||||
gmenu2x->s->write( gmenu2x->font, name, 5, y, Font::HAlignLeft, Font::VAlignTop );
|
||||
}
|
||||
|
||||
void MenuSetting::handleTS()
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "delegate.h"
|
||||
#include "gmenu2x.h"
|
||||
#include "iconbutton.h"
|
||||
#include "surface.h"
|
||||
#include "utilities.h"
|
||||
|
||||
#include <sstream>
|
||||
@ -67,7 +68,7 @@ void MenuSettingBool::initButton()
|
||||
void MenuSettingBool::draw(int y)
|
||||
{
|
||||
MenuSetting::draw(y);
|
||||
gmenu2x->s->write( gmenu2x->font, strvalue, 155, y, ASFont::HAlignLeft, ASFont::VAlignTop );
|
||||
gmenu2x->s->write( gmenu2x->font, strvalue, 155, y, Font::HAlignLeft, Font::VAlignTop );
|
||||
}
|
||||
|
||||
bool MenuSettingBool::handleButtonPress(InputManager::Button button)
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "delegate.h"
|
||||
#include "gmenu2x.h"
|
||||
#include "iconbutton.h"
|
||||
#include "surface.h"
|
||||
#include "utilities.h"
|
||||
|
||||
#include <sstream>
|
||||
@ -69,7 +70,7 @@ MenuSettingInt::MenuSettingInt(
|
||||
void MenuSettingInt::draw(int y)
|
||||
{
|
||||
MenuSetting::draw(y);
|
||||
gmenu2x->s->write( gmenu2x->font, strvalue, 155, y, ASFont::HAlignLeft, ASFont::VAlignTop );
|
||||
gmenu2x->s->write(gmenu2x->font, strvalue, 155, y, Font::HAlignLeft, Font::VAlignTop);
|
||||
}
|
||||
|
||||
bool MenuSettingInt::handleButtonPress(InputManager::Button button)
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
#include "gmenu2x.h"
|
||||
#include "iconbutton.h"
|
||||
#include "surface.h"
|
||||
#include "utilities.h"
|
||||
|
||||
#include <sstream>
|
||||
@ -53,10 +54,10 @@ void MenuSettingRGBA::draw(int y) {
|
||||
MenuSetting::draw(y);
|
||||
gmenu2x->s->rectangle( 153, y+1, 11, 11, 0,0,0,255 );
|
||||
gmenu2x->s->box( 154, y+2, 9, 9, value() );
|
||||
gmenu2x->s->write( gmenu2x->font, "R: "+strR, 169, y, ASFont::HAlignLeft, ASFont::VAlignTop );
|
||||
gmenu2x->s->write( gmenu2x->font, "G: "+strG, 205, y, ASFont::HAlignLeft, ASFont::VAlignTop );
|
||||
gmenu2x->s->write( gmenu2x->font, "B: "+strB, 241, y, ASFont::HAlignLeft, ASFont::VAlignTop );
|
||||
gmenu2x->s->write( gmenu2x->font, "A: "+strA, 277, y, ASFont::HAlignLeft, ASFont::VAlignTop );
|
||||
gmenu2x->s->write( gmenu2x->font, "R: "+strR, 169, y, Font::HAlignLeft, Font::VAlignTop );
|
||||
gmenu2x->s->write( gmenu2x->font, "G: "+strG, 205, y, Font::HAlignLeft, Font::VAlignTop );
|
||||
gmenu2x->s->write( gmenu2x->font, "B: "+strB, 241, y, Font::HAlignLeft, Font::VAlignTop );
|
||||
gmenu2x->s->write( gmenu2x->font, "A: "+strA, 277, y, Font::HAlignLeft, Font::VAlignTop );
|
||||
}
|
||||
|
||||
void MenuSettingRGBA::handleTS() {
|
||||
|
@ -17,8 +17,10 @@
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
|
||||
#include "menusettingstringbase.h"
|
||||
#include "gmenu2x.h"
|
||||
#include "surface.h"
|
||||
|
||||
using std::string;
|
||||
|
||||
@ -39,7 +41,7 @@ void MenuSettingStringBase::draw(int y)
|
||||
{
|
||||
MenuSetting::draw(y);
|
||||
gmenu2x->s->write(gmenu2x->font, value(), 155, y,
|
||||
ASFont::HAlignLeft, ASFont::VAlignTop);
|
||||
Font::HAlignLeft, Font::VAlignTop);
|
||||
}
|
||||
|
||||
bool MenuSettingStringBase::handleButtonPress(InputManager::Button button)
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
#include "messagebox.h"
|
||||
#include "gmenu2x.h"
|
||||
#include "surface.h"
|
||||
|
||||
#include <SDL_gfxPrimitives.h>
|
||||
|
||||
@ -77,7 +78,7 @@ int MessageBox::exec() {
|
||||
//icon+text
|
||||
if (gmenu2x->sc[icon] != NULL)
|
||||
gmenu2x->sc[icon]->blitCenter( &bg, box.x+25, box.y+gmenu2x->font->getHeight()+3 );
|
||||
bg.write( gmenu2x->font, text, box.x+(gmenu2x->sc[icon] != NULL ? 47 : 10), box.y+gmenu2x->font->getHeight()+3, ASFont::HAlignLeft, ASFont::VAlignMiddle );
|
||||
bg.write( gmenu2x->font, text, box.x+(gmenu2x->sc[icon] != NULL ? 47 : 10), box.y+gmenu2x->font->getHeight()+3, Font::HAlignLeft, Font::VAlignMiddle );
|
||||
|
||||
int btnX = gmenu2x->halfX+box.w/2-6;
|
||||
for (uint i = 0; i < BUTTON_TYPE_SIZE; i++) {
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "gmenu2x.h"
|
||||
#include "linkapp.h"
|
||||
#include "menu.h"
|
||||
#include "surface.h"
|
||||
#include "utilities.h"
|
||||
|
||||
#include <SDL.h>
|
||||
@ -117,9 +118,9 @@ int Selector::exec(int startSelection) {
|
||||
iY = i-firstElement;
|
||||
if (fl.isDirectory(i)) {
|
||||
gmenu2x->sc["imgs/folder.png"]->blit(gmenu2x->s, 4, 42+(iY*16));
|
||||
gmenu2x->s->write(gmenu2x->font, fl[i], 21, 49+(iY*16), ASFont::HAlignLeft, ASFont::VAlignMiddle);
|
||||
gmenu2x->s->write(gmenu2x->font, fl[i], 21, 49+(iY*16), Font::HAlignLeft, Font::VAlignMiddle);
|
||||
} else
|
||||
gmenu2x->s->write(gmenu2x->font, titles[i-fl.dirCount()], 4, 49+(iY*16), ASFont::HAlignLeft, ASFont::VAlignMiddle);
|
||||
gmenu2x->s->write(gmenu2x->font, titles[i-fl.dirCount()], 4, 49+(iY*16), Font::HAlignLeft, Font::VAlignMiddle);
|
||||
}
|
||||
gmenu2x->s->clearClipRect();
|
||||
|
||||
|
@ -192,25 +192,25 @@ void Surface::setClipRect(SDL_Rect rect) {
|
||||
SDL_SetClipRect(raw,&rect);
|
||||
}
|
||||
|
||||
bool Surface::blit(Surface *destination, SDL_Rect container, ASFont::HAlign halign, ASFont::VAlign valign) {
|
||||
bool Surface::blit(Surface *destination, SDL_Rect container, Font::HAlign halign, Font::VAlign valign) {
|
||||
switch (halign) {
|
||||
case ASFont::HAlignLeft:
|
||||
case Font::HAlignLeft:
|
||||
break;
|
||||
case ASFont::HAlignCenter:
|
||||
case Font::HAlignCenter:
|
||||
container.x += container.w/2-halfW;
|
||||
break;
|
||||
case ASFont::HAlignRight:
|
||||
case Font::HAlignRight:
|
||||
container.x += container.w-raw->w;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (valign) {
|
||||
case ASFont::VAlignTop:
|
||||
case Font::VAlignTop:
|
||||
break;
|
||||
case ASFont::VAlignMiddle:
|
||||
case Font::VAlignMiddle:
|
||||
container.y += container.h/2-halfH;
|
||||
break;
|
||||
case ASFont::VAlignBottom:
|
||||
case Font::VAlignBottom:
|
||||
container.y += container.h-raw->h;
|
||||
break;
|
||||
}
|
||||
|
@ -21,7 +21,7 @@
|
||||
#ifndef SURFACE_H
|
||||
#define SURFACE_H
|
||||
|
||||
#include "asfont.h"
|
||||
#include "font.h"
|
||||
|
||||
#include <SDL.h>
|
||||
#include <string>
|
||||
@ -62,13 +62,13 @@ public:
|
||||
void setClipRect(SDL_Rect rect);
|
||||
|
||||
bool blit(Surface *destination, int x, int y, int w=0, int h=0, int a=-1);
|
||||
bool blit(Surface *destination, SDL_Rect container, ASFont::HAlign halign = ASFont::HAlignLeft, ASFont::VAlign valign = ASFont::VAlignTop);
|
||||
bool blit(Surface *destination, SDL_Rect container, Font::HAlign halign = Font::HAlignLeft, Font::VAlign valign = Font::VAlignTop);
|
||||
bool blitCenter(Surface *destination, int x, int y, int w=0, int h=0, int a=-1);
|
||||
bool blitRight(Surface *destination, int x, int y, int w=0, int h=0, int a=-1);
|
||||
|
||||
void write(ASFont *font, const std::string &text, int x, int y,
|
||||
ASFont::HAlign halign = ASFont::HAlignLeft,
|
||||
ASFont::VAlign valign = ASFont::VAlignTop) {
|
||||
void write(Font *font, const std::string &text, int x, int y,
|
||||
Font::HAlign halign = Font::HAlignLeft,
|
||||
Font::VAlign valign = Font::VAlignTop) {
|
||||
font->write(this, text, x, y, halign, valign);
|
||||
}
|
||||
|
||||
@ -92,7 +92,7 @@ private:
|
||||
int halfW, halfH;
|
||||
|
||||
// For direct access to "raw".
|
||||
friend class ASFont;
|
||||
friend class Font;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "textmanualdialog.h"
|
||||
|
||||
#include "gmenu2x.h"
|
||||
#include "surface.h"
|
||||
#include "utilities.h"
|
||||
|
||||
#include <algorithm>
|
||||
@ -104,7 +105,7 @@ void TextManualDialog::exec() {
|
||||
ss << page+1;
|
||||
ss >> pageStatus;
|
||||
pageStatus = gmenu2x->tr["Page"]+": "+pageStatus+"/"+spagecount;
|
||||
gmenu2x->s->write(gmenu2x->font, pageStatus, 310, 230, ASFont::HAlignRight, ASFont::VAlignMiddle);
|
||||
gmenu2x->s->write(gmenu2x->font, pageStatus, 310, 230, Font::HAlignRight, Font::VAlignMiddle);
|
||||
|
||||
gmenu2x->s->flip();
|
||||
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "filelister.h"
|
||||
#include "gmenu2x.h"
|
||||
#include "iconbutton.h"
|
||||
#include "surface.h"
|
||||
#include "utilities.h"
|
||||
|
||||
#include <iostream>
|
||||
@ -105,7 +106,7 @@ bool WallpaperDialog::exec()
|
||||
gmenu2x->s->setClipRect(0,41,311,179);
|
||||
for (i=firstElement; i<wallpapers.size() && i<firstElement+10; i++) {
|
||||
iY = i-firstElement;
|
||||
gmenu2x->s->write(gmenu2x->font, wallpapers[i], 5, 52+(iY*17), ASFont::HAlignLeft, ASFont::VAlignMiddle);
|
||||
gmenu2x->s->write(gmenu2x->font, wallpapers[i], 5, 52+(iY*17), Font::HAlignLeft, Font::VAlignMiddle);
|
||||
}
|
||||
gmenu2x->s->clearClipRect();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user