Root/src/dialog.cpp

1#include <string>
2
3#include "dialog.h"
4#include "gmenu2x.h"
5#include "asfont.h"
6
7Dialog::Dialog(GMenu2X *gmenu2x) : gmenu2x(gmenu2x)
8{
9}
10
11void Dialog::drawTitleIcon(const std::string &icon, bool skinRes, Surface *s)
12{
13    if (s==NULL)
14        s = gmenu2x->s;
15
16    Surface *i = NULL;
17    if (!icon.empty()) {
18        if (skinRes)
19            i = gmenu2x->sc.skinRes(icon);
20        else
21            i = gmenu2x->sc[icon];
22    }
23
24    if (i==NULL)
25        i = gmenu2x->sc.skinRes("icons/generic.png");
26
27    i->blit(s,4,(gmenu2x->skinConfInt["topBarHeight"]-32)/2);
28}
29
30void Dialog::writeTitle(const std::string &title, Surface *s)
31{
32    if (s==NULL)
33        s = gmenu2x->s;
34    s->write(gmenu2x->font, title, 40, gmenu2x->skinConfInt["topBarHeight"]/4, ASFont::HAlignLeft, ASFont::VAlignMiddle);
35}
36
37void Dialog::writeSubTitle(const std::string &subtitle, Surface *s)
38{
39    if (s==NULL)
40        s = gmenu2x->s;
41    s->write(gmenu2x->font, subtitle, 40, gmenu2x->skinConfInt["topBarHeight"]/4*3, ASFont::HAlignLeft, ASFont::VAlignMiddle);
42}
43
44
45

Archive Download this file



interactive