mirror of
git://projects.qi-hardware.com/gmenu2x.git
synced 2024-11-22 23:30:37 +02:00
Explicitly convert 32-bit integers to 16-bit.
GCC 4.7.0 warns that C++11 considers doing this implicitly ill-formed.
This commit is contained in:
parent
46f2edbc76
commit
8f57afcf53
@ -46,7 +46,10 @@ ASFont::ASFont(const std::string &fontImagePath)
|
||||
// Scan height of "0" glyph.
|
||||
std::string::size_type pos = characters.find("0") * 2;
|
||||
SDL_Rect srcrect = {
|
||||
charpos[pos], 1, charpos[pos + 2] - charpos[pos], surface->h - 1
|
||||
static_cast<Sint16>(charpos[pos]),
|
||||
1,
|
||||
static_cast<Uint16>(charpos[pos + 2] - charpos[pos]),
|
||||
static_cast<Uint16>(surface->h - 1)
|
||||
};
|
||||
const unsigned alphaMask = surface->format->Amask;
|
||||
unsigned y = srcrect.h;
|
||||
|
@ -41,7 +41,7 @@ private:
|
||||
void writeLine(Surface *surface, const std::vector<std::string> &text, int x, int y, HAlign halign, VAlign valign);
|
||||
|
||||
SDL_Surface *surface;
|
||||
std::vector<unsigned> charpos;
|
||||
std::vector<Uint16> charpos;
|
||||
std::string characters;
|
||||
int lineHeight;
|
||||
};
|
||||
|
@ -61,8 +61,18 @@ bool BrowseDialog::exec()
|
||||
const int topBarHeight = gmenu2x->skinConfInt["topBarHeight"];
|
||||
rowHeight = gmenu2x->font->getHeight() + 1; // gp2x=15+1 / pandora=19+1
|
||||
numRows = (gmenu2x->resY - topBarHeight - 20) / rowHeight;
|
||||
clipRect = (SDL_Rect) { 0, topBarHeight + 1, gmenu2x->resX - 9, gmenu2x->resY - topBarHeight - 25 };
|
||||
touchRect = (SDL_Rect) { 2, topBarHeight + 4, gmenu2x->resX - 12, clipRect.h };
|
||||
clipRect = (SDL_Rect) {
|
||||
0,
|
||||
static_cast<Sint16>(topBarHeight + 1),
|
||||
static_cast<Uint16>(gmenu2x->resX - 9),
|
||||
static_cast<Uint16>(gmenu2x->resY - topBarHeight - 25)
|
||||
};
|
||||
touchRect = (SDL_Rect) {
|
||||
2,
|
||||
static_cast<Sint16>(topBarHeight + 4),
|
||||
static_cast<Uint16>(gmenu2x->resX - 12),
|
||||
clipRect.h
|
||||
};
|
||||
|
||||
selected = 0;
|
||||
close = false;
|
||||
|
@ -1556,7 +1556,12 @@ void GMenu2X::contextMenu() {
|
||||
box.x = halfX - box.w/2;
|
||||
box.y = halfY - box.h/2;
|
||||
|
||||
SDL_Rect selbox = {box.x+4, 0, box.w-8, h+2};
|
||||
SDL_Rect selbox = {
|
||||
static_cast<Sint16>(box.x + 4),
|
||||
0,
|
||||
static_cast<Uint16>(box.w - 8),
|
||||
static_cast<Uint16>(h + 2)
|
||||
};
|
||||
long tickNow, tickStart = SDL_GetTicks();
|
||||
|
||||
Surface bg(s);
|
||||
@ -2146,7 +2151,7 @@ int GMenu2X::drawButton(Button *btn, int x, int y) {
|
||||
|
||||
int GMenu2X::drawButton(Surface *s, const string &btn, const string &text, int x, int y) {
|
||||
if (y<0) y = resY+y;
|
||||
SDL_Rect re = {x, y-7, 0, 16};
|
||||
SDL_Rect re = { static_cast<Sint16>(x), static_cast<Sint16>(y - 7), 0, 16 };
|
||||
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;
|
||||
|
@ -45,7 +45,7 @@ bool IconButton::paintHover() {
|
||||
}
|
||||
|
||||
void IconButton::recalcSize() {
|
||||
uint h = 0, w = 0;
|
||||
Uint16 h = 0, w = 0;
|
||||
if (iconSurface) {
|
||||
w += iconSurface->width();
|
||||
h += iconSurface->height();
|
||||
@ -57,10 +57,10 @@ void IconButton::recalcSize() {
|
||||
if (label != "") {
|
||||
uint margin = iconSurface ? 2 : 0;
|
||||
labelRect = (SDL_Rect) {
|
||||
iconRect.x + iconRect.w + margin,
|
||||
rect.y + h / 2,
|
||||
gmenu2x->font->getTextWidth(label),
|
||||
gmenu2x->font->getHeight()
|
||||
static_cast<Sint16>(iconRect.x + iconRect.w + margin),
|
||||
static_cast<Sint16>(rect.y + h / 2),
|
||||
static_cast<Uint16>(gmenu2x->font->getTextWidth(label)),
|
||||
static_cast<Uint16>(gmenu2x->font->getHeight())
|
||||
};
|
||||
w += margin + labelRect.w;
|
||||
}
|
||||
|
@ -138,7 +138,9 @@ void InputDialog::setKeyboard(int kb) {
|
||||
}
|
||||
|
||||
bool InputDialog::exec() {
|
||||
SDL_Rect box = { 0, 60, 0, gmenu2x->font->getHeight() + 4 };
|
||||
SDL_Rect box = {
|
||||
0, 60, 0, static_cast<Uint16>(gmenu2x->font->getHeight() + 4)
|
||||
};
|
||||
|
||||
Uint32 caretTick = 0, curTick;
|
||||
bool caretOn = true;
|
||||
@ -286,8 +288,10 @@ void InputDialog::drawVirtualKeyboard() {
|
||||
charX = line[x];
|
||||
|
||||
SDL_Rect re = {
|
||||
kbLeft + xc * KEY_WIDTH - 1, KB_TOP + l * KEY_HEIGHT,
|
||||
KEY_WIDTH - 1, KEY_HEIGHT - 2
|
||||
static_cast<Sint16>(kbLeft + xc * KEY_WIDTH - 1),
|
||||
static_cast<Sint16>(KB_TOP + l * KEY_HEIGHT),
|
||||
KEY_WIDTH - 1,
|
||||
KEY_HEIGHT - 2
|
||||
};
|
||||
|
||||
//if ts on rect, change selection
|
||||
@ -307,7 +311,12 @@ void InputDialog::drawVirtualKeyboard() {
|
||||
}
|
||||
|
||||
//Ok/Cancel
|
||||
SDL_Rect re = {kbLeft-1, KB_TOP+kb->size()*KEY_HEIGHT, kbLength*KEY_WIDTH/2-1, KEY_HEIGHT-1};
|
||||
SDL_Rect re = {
|
||||
static_cast<Sint16>(kbLeft - 1),
|
||||
static_cast<Sint16>(KB_TOP + kb->size() * KEY_HEIGHT),
|
||||
static_cast<Uint16>(kbLength * KEY_WIDTH / 2 - 1),
|
||||
KEY_HEIGHT - 1
|
||||
};
|
||||
gmenu2x->s->rectangle(re, gmenu2x->skinConfColors[COLOR_SELECTION_BG]);
|
||||
if (ts.available() && ts.pressed() && ts.inRect(re)) {
|
||||
selCol = 0;
|
||||
|
@ -59,8 +59,18 @@ bool SettingsDialog::exec() {
|
||||
voices[sel]->adjustInput();
|
||||
|
||||
const int topBarHeight = gmenu2x->skinConfInt["topBarHeight"];
|
||||
SDL_Rect clipRect = { 0, topBarHeight + 1, gmenu2x->resX - 9, gmenu2x->resY - topBarHeight - 25 };
|
||||
SDL_Rect touchRect = { 2, topBarHeight + 4, gmenu2x->resX - 12, clipRect.h };
|
||||
SDL_Rect clipRect = {
|
||||
0,
|
||||
static_cast<Sint16>(topBarHeight + 1),
|
||||
static_cast<Uint16>(gmenu2x->resX - 9),
|
||||
static_cast<Uint16>(gmenu2x->resY - topBarHeight - 25)
|
||||
};
|
||||
SDL_Rect touchRect = {
|
||||
2,
|
||||
static_cast<Sint16>(topBarHeight + 4),
|
||||
static_cast<Uint16>(gmenu2x->resX - 12),
|
||||
static_cast<Uint16>(clipRect.h)
|
||||
};
|
||||
uint rowHeight = gmenu2x->font->getHeight() + 1; // gp2x=15+1 / pandora=19+1
|
||||
uint numRows = (gmenu2x->resY - topBarHeight - 20) / rowHeight;
|
||||
|
||||
|
@ -115,7 +115,7 @@ void Surface::flip() {
|
||||
bool Surface::blit(SDL_Surface *destination, int x, int y, int w, int h, int a) {
|
||||
if (destination == NULL || a==0) return false;
|
||||
|
||||
SDL_Rect src = {0,0,w,h};
|
||||
SDL_Rect src = { 0, 0, static_cast<Uint16>(w), static_cast<Uint16>(h) };
|
||||
SDL_Rect dest;
|
||||
dest.x = x;
|
||||
dest.y = y;
|
||||
@ -181,7 +181,10 @@ void Surface::clearClipRect() {
|
||||
}
|
||||
|
||||
void Surface::setClipRect(int x, int y, int w, int h) {
|
||||
SDL_Rect rect = {x,y,w,h};
|
||||
SDL_Rect rect = {
|
||||
static_cast<Sint16>(x), static_cast<Sint16>(y),
|
||||
static_cast<Uint16>(w), static_cast<Uint16>(h)
|
||||
};
|
||||
setClipRect(rect);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user