Skip to content
This repository has been archived by the owner on Nov 12, 2022. It is now read-only.

Begin of 640x480 support #3

Open
wants to merge 26 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@
# src/.deps/
# src/Makefile
# src/Makefile.in
/build/
19 changes: 17 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,29 @@ if (BIND_CONSOLE)
add_compile_definitions(BIND_CONSOLE)
endif (BIND_CONSOLE)

option(WINDOWED_MODE "Run windowed" OFF)
if (WINDOWED_MODE)
add_compile_definitions(G2X_BUILD_OPTION_WINDOWED_MODE)
endif ()

option(SCREEN_WIDTH "Screen / window width" OFF)
if (SCREEN_WIDTH)
add_compile_definitions(G2X_BUILD_OPTION_SCREEN_WIDTH=${SCREEN_WIDTH})
endif ()

option(SCREEN_HEIGHT "Screen / window height" OFF)
if (SCREEN_HEIGHT)
add_compile_definitions(G2X_BUILD_OPTION_SCREEN_HEIGHT=${SCREEN_HEIGHT})
endif ()

set(CARD_ROOT "/media" CACHE STRING "Top-level filesystem directory")

set(PLATFORMS "pc, a320, gcw0, nanonote, rs90")
set(PLATFORMS "pc, a320, gcw0, rg350m, nanonote, rs90")

set(PLATFORM "pc" CACHE STRING
"One of the available platforms: ${PLATFORMS}"
)
set_property(CACHE PLATFORM PROPERTY STRINGS pc a320 gcw0 nanonote rs90)
set_property(CACHE PLATFORM PROPERTY STRINGS pc a320 gcw0 rg350m nanonote rs90)

find_package(SDL REQUIRED)
find_package(SDL_ttf REQUIRED)
Expand Down
6 changes: 3 additions & 3 deletions data/platform/gcw0/gmenu2x.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ menuClock=192
maxClock=1020
backlightTimeout=60
opkPlatforms="gcw0"
brightnessSysfs="/sys/class/backlight/board:backlight"
powerSupplySysfs="/sys/class/power_supply/act8600-charger"
batterySysfs="/sys/class/power_supply/jz-battery"
brightnessSysfs="/sys/class/backlight/pwm-backlight"
powerSupplySysfs="/sys/class/power_supply/usb"
batterySysfs="/sys/class/power_supply/battery"
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion data/platform/gcw0/skins/Default/wallpapers/default.png
8 changes: 8 additions & 0 deletions data/platform/pc/gmenu2x.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
videoBpp=32
menuClock=192
maxClock=1020
backlightTimeout=60
opkPlatforms="gcw0"
brightnessSysfs="/sys/class/backlight/pwm-backlight"
powerSupplySysfs="/sys/class/power_supply/usb"
batterySysfs="/sys/class/power_supply/battery"
10 changes: 10 additions & 0 deletions data/platform/pc/input.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
accept=keyboard,306
cancel=keyboard,308
altleft=keyboard,9
altright=keyboard,8
menu=keyboard,27
settings=keyboard,13
up=keyboard,273
down=keyboard,274
left=keyboard,276
right=keyboard,275
6 changes: 6 additions & 0 deletions data/platform/pc/sections/applications/30_terminal
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
title=Terminal
description=Disable graphic mode
icon=skin:icons/utilities-terminal.png
exec=/bin/busybox
params=sh -c 'clear; echo "The graphic mode is now disabled."; echo ""; echo "This is only useful for developers who want to test their graphical apps from telnet."; echo ""; echo "(Press START to exit to the launcher)"; read'
consoleapp=true
6 changes: 6 additions & 0 deletions data/platform/pc/sections/settings/10_poweroff
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
title=Power Off
description=Shut down the system
launchmsg=Powering off
icon=skin:icons/poweroff.png
exec=/sbin/poweroff
editable=false
6 changes: 6 additions & 0 deletions data/platform/pc/sections/settings/20_reboot
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
title=Reboot
description=Reboot the system
launchmsg=Rebooting
icon=skin:icons/reboot.png
exec=/sbin/reboot
editable=false
6 changes: 6 additions & 0 deletions data/platform/pc/sections/settings/40_alsamixer
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
title=Sound Mixer
description=Configure sound settings
icon=skin:icons/alsamixer.png
exec=/usr/bin/alsamixer
consoleapp=true
editable=false
7 changes: 7 additions & 0 deletions data/platform/pc/sections/settings/50_system_info
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
title=System Info
description=Info about the system
icon=skin:icons/about.png
exec=/usr/bin/dialog
params=--ok-label "Press START to exit" --no-shadow --msgbox "`/usr/bin/system_info`" 240 320
consoleapp=true
editable=false
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions data/platform/pc/skins/Default/wallpapers/default.png
8 changes: 8 additions & 0 deletions data/platform/rg350m/gmenu2x.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
videoBpp=32
menuClock=192
maxClock=1020
backlightTimeout=60
opkPlatforms="gcw0"
brightnessSysfs="/sys/class/backlight/pwm-backlight"
powerSupplySysfs="/sys/class/power_supply/usb"
batterySysfs="/sys/class/power_supply/battery"
10 changes: 10 additions & 0 deletions data/platform/rg350m/input.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
accept=keyboard,306
cancel=keyboard,308
altleft=keyboard,9
altright=keyboard,8
menu=keyboard,27
settings=keyboard,13
up=keyboard,273
down=keyboard,274
left=keyboard,276
right=keyboard,275
6 changes: 6 additions & 0 deletions data/platform/rg350m/sections/applications/30_terminal
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
title=Terminal
description=Disable graphic mode
icon=skin:icons/utilities-terminal.png
exec=/bin/busybox
params=sh -c 'clear; echo "The graphic mode is now disabled."; echo ""; echo "This is only useful for developers who want to test their graphical apps from telnet."; echo ""; echo "(Press START to exit to the launcher)"; read'
consoleapp=true
6 changes: 6 additions & 0 deletions data/platform/rg350m/sections/settings/10_poweroff
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
title=Power Off
description=Shut down the system
launchmsg=Powering off
icon=skin:icons/poweroff.png
exec=/sbin/poweroff
editable=false
6 changes: 6 additions & 0 deletions data/platform/rg350m/sections/settings/20_reboot
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
title=Reboot
description=Reboot the system
launchmsg=Rebooting
icon=skin:icons/reboot.png
exec=/sbin/reboot
editable=false
6 changes: 6 additions & 0 deletions data/platform/rg350m/sections/settings/40_alsamixer
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
title=Sound Mixer
description=Configure sound settings
icon=skin:icons/alsamixer.png
exec=/usr/bin/alsamixer
consoleapp=true
editable=false
7 changes: 7 additions & 0 deletions data/platform/rg350m/sections/settings/50_system_info
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
title=System Info
description=Info about the system
icon=skin:icons/about.png
exec=/usr/bin/dialog
params=--ok-label "Press START to exit" --no-shadow --msgbox "`/usr/bin/system_info`" 480 640
consoleapp=true
editable=false
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file modified data/skins/320x240/Default/imgs/battery/0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified data/skins/320x240/Default/imgs/battery/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified data/skins/320x240/Default/imgs/battery/2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified data/skins/320x240/Default/imgs/battery/3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified data/skins/320x240/Default/imgs/battery/4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified data/skins/320x240/Default/imgs/battery/5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions data/skins/320x240/Default/skin.conf
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
font="skin:fonts/SourceHanSans-Regular-04.ttf"
messageBoxBorder=#505050ff
topBarBg=#ffffff80
selectionBg=#ffffff80
Expand Down
Binary file removed data/skins/320x240/GCW/imgs/battery/0.png
Diff not rendered.
Binary file removed data/skins/320x240/GCW/imgs/battery/1.png
Diff not rendered.
Binary file removed data/skins/320x240/GCW/imgs/battery/2.png
Diff not rendered.
Binary file removed data/skins/320x240/GCW/imgs/battery/3.png
Diff not rendered.
Binary file removed data/skins/320x240/GCW/imgs/battery/4.png
Diff not rendered.
Binary file removed data/skins/320x240/GCW/imgs/battery/5.png
Diff not rendered.
Binary file removed data/skins/320x240/GCW/imgs/battery/ac.png
Diff not rendered.
Binary file removed data/skins/320x240/GCW/imgs/buttons/accept.png
Diff not rendered.
Binary file removed data/skins/320x240/GCW/imgs/buttons/cancel.png
Diff not rendered.
Binary file removed data/skins/320x240/GCW/imgs/buttons/l.png
Diff not rendered.
Binary file removed data/skins/320x240/GCW/imgs/buttons/r.png
Diff not rendered.
Binary file removed data/skins/320x240/GCW/imgs/buttons/sectionl.png
Diff not rendered.
Binary file removed data/skins/320x240/GCW/imgs/buttons/sectionr.png
Diff not rendered.
Binary file removed data/skins/320x240/GCW/imgs/buttons/select.png
Diff not rendered.
Binary file removed data/skins/320x240/GCW/imgs/buttons/start.png
Diff not rendered.
Binary file removed data/skins/320x240/GCW/imgs/buttons/x.png
Diff not rendered.
Binary file removed data/skins/320x240/GCW/imgs/buttons/y.png
Diff not rendered.
Binary file removed data/skins/320x240/GCW/imgs/section-l.png
Diff not rendered.
Binary file removed data/skins/320x240/GCW/imgs/section-r.png
Diff not rendered.
13 changes: 0 additions & 13 deletions data/skins/320x240/GCW/skin.conf

This file was deleted.

Binary file not shown.
Binary file added data/skins/640x480/Default/icons/4th.png
Binary file added data/skins/640x480/Default/icons/Bard32.png
Binary file added data/skins/640x480/Default/icons/abook.png
Binary file added data/skins/640x480/Default/icons/about.png
Binary file added data/skins/640x480/Default/icons/aewan.png
Binary file added data/skins/640x480/Default/icons/allegro.png
Binary file added data/skins/640x480/Default/icons/alsamixer.png
Binary file added data/skins/640x480/Default/icons/ase.png
Binary file added data/skins/640x480/Default/icons/backgammon.png
Binary file added data/skins/640x480/Default/icons/bc.png
Binary file added data/skins/640x480/Default/icons/brainless.png
Binary file added data/skins/640x480/Default/icons/browser.png
Binary file added data/skins/640x480/Default/icons/calc.png
Binary file added data/skins/640x480/Default/icons/calcurse.png
Binary file added data/skins/640x480/Default/icons/chess.png
Binary file added data/skins/640x480/Default/icons/configure.png
Binary file added data/skins/640x480/Default/icons/ctronome.png
Binary file added data/skins/640x480/Default/icons/date.png
Binary file added data/skins/640x480/Default/icons/dgclock.png
Binary file added data/skins/640x480/Default/icons/dinguxcmdr.png
Binary file added data/skins/640x480/Default/icons/ebook.png
Binary file added data/skins/640x480/Default/icons/editor.png
Binary file added data/skins/640x480/Default/icons/emacs.png
Binary file added data/skins/640x480/Default/icons/empathy.png
Binary file added data/skins/640x480/Default/icons/exit.png
Binary file added data/skins/640x480/Default/icons/explorer.png
Binary file added data/skins/640x480/Default/icons/freedroid.png
Binary file added data/skins/640x480/Default/icons/generic.png
Binary file added data/skins/640x480/Default/icons/gforth.png
Binary file added data/skins/640x480/Default/icons/gjay.png
Binary file added data/skins/640x480/Default/icons/gmu.png
Binary file added data/skins/640x480/Default/icons/gnuplot.png
Binary file added data/skins/640x480/Default/icons/gottet.png
Binary file added data/skins/640x480/Default/icons/gtkguitune.png
Binary file added data/skins/640x480/Default/icons/guile.png
Binary file added data/skins/640x480/Default/icons/htop.png
Binary file added data/skins/640x480/Default/icons/imgv.png
Binary file added data/skins/640x480/Default/icons/irc.png
Binary file added data/skins/640x480/Default/icons/leaf_red.png
Binary file added data/skins/640x480/Default/icons/lingot.png
Binary file added data/skins/640x480/Default/icons/links.png
Binary file added data/skins/640x480/Default/icons/listener.png
Binary file added data/skins/640x480/Default/icons/lua.png
Binary file added data/skins/640x480/Default/icons/lynx.png
Binary file added data/skins/640x480/Default/icons/mathomatic.png
Binary file added data/skins/640x480/Default/icons/mc.png
Binary file added data/skins/640x480/Default/icons/mcabber.png
Binary file added data/skins/640x480/Default/icons/mediatomb.png
Binary file added data/skins/640x480/Default/icons/mplayer.png
Binary file added data/skins/640x480/Default/icons/music.png
Binary file added data/skins/640x480/Default/icons/mutt.png
Binary file added data/skins/640x480/Default/icons/nanomap.png
Binary file added data/skins/640x480/Default/icons/nightsky.png
Binary file added data/skins/640x480/Default/icons/octave.png
Binary file added data/skins/640x480/Default/icons/photo.png
Binary file added data/skins/640x480/Default/icons/poweroff.png
Binary file added data/skins/640x480/Default/icons/powertop.png
Binary file added data/skins/640x480/Default/icons/pyclock.png
Binary file added data/skins/640x480/Default/icons/python.png
Binary file added data/skins/640x480/Default/icons/qball.png
Binary file added data/skins/640x480/Default/icons/qstardict.png
Binary file added data/skins/640x480/Default/icons/reboot.png
Binary file added data/skins/640x480/Default/icons/rss.png
Binary file added data/skins/640x480/Default/icons/sc.png
Binary file added data/skins/640x480/Default/icons/section.png
Binary file added data/skins/640x480/Default/icons/skin.png
Binary file added data/skins/640x480/Default/icons/stardict.png
Binary file added data/skins/640x480/Default/icons/sticker.png
Binary file added data/skins/640x480/Default/icons/supertux.png
Binary file added data/skins/640x480/Default/icons/suspend.png
Binary file added data/skins/640x480/Default/icons/tclsh.png
Binary file added data/skins/640x480/Default/icons/tetris.png
Binary file added data/skins/640x480/Default/icons/tile.png
Binary file added data/skins/640x480/Default/icons/tv.png
Binary file added data/skins/640x480/Default/icons/usb.png
Binary file added data/skins/640x480/Default/icons/vim.png
Binary file added data/skins/640x480/Default/icons/vitetris.png
Binary file added data/skins/640x480/Default/icons/w3m.png
Binary file added data/skins/640x480/Default/icons/wallpaper.png
Binary file added data/skins/640x480/Default/icons/worm.png
Binary file added data/skins/640x480/Default/icons/zgv.png
Binary file added data/skins/640x480/Default/imgs/battery/0.png
Binary file added data/skins/640x480/Default/imgs/battery/1.png
Binary file added data/skins/640x480/Default/imgs/battery/2.png
Binary file added data/skins/640x480/Default/imgs/battery/3.png
Binary file added data/skins/640x480/Default/imgs/battery/4.png
Binary file added data/skins/640x480/Default/imgs/battery/5.png
Binary file added data/skins/640x480/Default/imgs/battery/ac.png
Binary file added data/skins/640x480/Default/imgs/bottombar.png
Binary file added data/skins/640x480/Default/imgs/buttons/accept.png
Binary file added data/skins/640x480/Default/imgs/buttons/cancel.png
Binary file added data/skins/640x480/Default/imgs/buttons/down.png
Binary file added data/skins/640x480/Default/imgs/buttons/l.png
Binary file added data/skins/640x480/Default/imgs/buttons/left.png
Binary file added data/skins/640x480/Default/imgs/buttons/r.png
Binary file added data/skins/640x480/Default/imgs/buttons/right.png
Binary file added data/skins/640x480/Default/imgs/buttons/sectionl.png
Binary file added data/skins/640x480/Default/imgs/buttons/sectionr.png
Binary file added data/skins/640x480/Default/imgs/buttons/select.png
Binary file added data/skins/640x480/Default/imgs/buttons/start.png
Binary file added data/skins/640x480/Default/imgs/buttons/stick.png
Binary file added data/skins/640x480/Default/imgs/buttons/up.png
Binary file added data/skins/640x480/Default/imgs/buttons/vol+.png
Binary file added data/skins/640x480/Default/imgs/buttons/vol-.png
Binary file added data/skins/640x480/Default/imgs/buttons/x.png
Binary file added data/skins/640x480/Default/imgs/buttons/y.png
Binary file added data/skins/640x480/Default/imgs/cpu.png
Binary file added data/skins/640x480/Default/imgs/file.png
Binary file added data/skins/640x480/Default/imgs/folder.png
Binary file added data/skins/640x480/Default/imgs/go-up.png
Binary file added data/skins/640x480/Default/imgs/inet.png
Binary file added data/skins/640x480/Default/imgs/manual.png
Binary file added data/skins/640x480/Default/imgs/menu.png
Binary file added data/skins/640x480/Default/imgs/mute.png
Binary file added data/skins/640x480/Default/imgs/phones.png
Binary file added data/skins/640x480/Default/imgs/samba.png
Binary file added data/skins/640x480/Default/imgs/sd.png
Binary file added data/skins/640x480/Default/imgs/section-l.png
Binary file added data/skins/640x480/Default/imgs/section-r.png
Binary file added data/skins/640x480/Default/imgs/selection.png
Binary file added data/skins/640x480/Default/imgs/topbar.png
Binary file added data/skins/640x480/Default/imgs/volume.png
Binary file added data/skins/640x480/Default/imgs/webserver.png
Binary file added data/skins/640x480/Default/sections/applications.png
Binary file added data/skins/640x480/Default/sections/emulators.png
Binary file added data/skins/640x480/Default/sections/games.png
Binary file added data/skins/640x480/Default/sections/settings.png
Binary file added data/skins/640x480/Default/sections/terminals.png
Binary file added data/skins/640x480/Default/sections/utilities.png
12 changes: 12 additions & 0 deletions data/skins/640x480/Default/skin.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
font="skin:fonts/SourceHanSans-Regular-04.ttf"
messageBoxBorder=#505050ff
topBarBg=#ffffff80
selectionBg=#ffffff80
messageBoxBg=#00000080
messageBoxSelection=#fffffff80
bottomBarBg=#ffffff80
topBarHeight=80
bottomBarHeight=40
linkHeight=100
linkWidth=150
fontsize=20
Binary file added data/skins/640x480/Default/wallpapers/default.png
Binary file added data/skins/640x480/Default/wallpapers/rg350.png
4 changes: 2 additions & 2 deletions src/background.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ void Background::paint(Surface& s) {

#ifdef ENABLE_CLOCK
font.write(s, clock.getTime(),
s.width() / 2, gmenu2x.bottomBarTextY,
s.width() / 2, s.height() - gmenu2x.skinConfInt["bottomBarHeight"] / 2,
Font::HAlignCenter, Font::VAlignMiddle);
#endif

auto icon = battery.getIcon();
if (icon) {
icon->blit(s, s.width() - 19, gmenu2x.bottomBarIconY);
icon->blit(s, s.width() - (icon->width() * 1.2 ), s.height() - (gmenu2x.skinConfInt["bottomBarHeight"] + icon->height()) / 2);
}
}

Expand Down
14 changes: 8 additions & 6 deletions src/browsedialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,15 @@ bool BrowseDialog::exec()
setPath(GMENU2X_CARD_ROOT);

const int topBarHeight = gmenu2x.skinConfInt["topBarHeight"];
const int bottomBarHeight = gmenu2x.skinConfInt["bottomBarHeight"];
rowHeight = gmenu2x.font->getLineSpacing() + 1; // gp2x=15+1 / pandora=19+1
rowHeight = std::clamp(rowHeight, 20u, 40u);
numRows = (gmenu2x.height() - topBarHeight - 20) / rowHeight;
rowHeight = stdx::clamp(rowHeight, 20u, 40u);
numRows = (gmenu2x.height() - topBarHeight - bottomBarHeight) / rowHeight;
clipRect = SDL_Rect{
0,
static_cast<Sint16>(topBarHeight + 1),
static_cast<Uint16>(gmenu2x.width() - 9),
static_cast<Uint16>(gmenu2x.height() - topBarHeight - 25)
static_cast<Uint16>(gmenu2x.height() - topBarHeight - bottomBarHeight)
};

selected = 0;
Expand Down Expand Up @@ -214,7 +215,7 @@ void BrowseDialog::paint()
drawTitleIcon(bg, "icons/explorer.png", true);
writeTitle(bg, title);
writeSubTitle(bg, subtitle);
buttonBox.paint(bg, 5, gmenu2x.height() - 1);
buttonBox.paint(bg, 5, gmenu2x.height() - gmenu2x.skinConfInt["bottomBarHeight"] / 2);

bg.convertToDisplayFormat();
bg.blit(s, 0, 0);
Expand Down Expand Up @@ -253,8 +254,9 @@ void BrowseDialog::paint()
} else {
icon = iconFile;
}
icon->blit(s, 5, offsetY);
gmenu2x.font->write(s, fl[i], 24, offsetY + rowHeight / 2,
int x = 5;
icon->blit(s, x, offsetY);
gmenu2x.font->write(s, fl[i], x + icon->width() * 1.2, offsetY + rowHeight / 2,
Font::HAlignLeft, Font::VAlignMiddle);

offsetY += rowHeight;
Expand Down
5 changes: 3 additions & 2 deletions src/buttonbox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ void ButtonBox::paint(Surface& s, int x, int y)
{
for (auto& button : buttons) {
auto rect = button->getRect();
button->setPosition(x, y - rect.h);
button->setPosition(x, y - rect.h / 2);
button->paint(s);
x += button->getRect().w + 6;
//space 20% of current button between next button
x += button->getRect().w * 1.20;
}
}
19 changes: 19 additions & 0 deletions src/cpp_backports.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#ifndef __CPP_BACKPORTS__
#define __CPP_BACKPORTS__

// Backports of C++ 17 stuff to C++ 14.

namespace stdx {
template <typename _Tp>
constexpr const _Tp& clamp(const _Tp& __val, const _Tp& __lo, const _Tp& __hi) {
return (__val < __lo) ? __lo : (__hi < __val) ? __hi : __val;
}

template <typename _Tp, typename _Compare>
constexpr const _Tp& clamp(const _Tp& __val, const _Tp& __lo, const _Tp& __hi,
_Compare __comp) {
return __comp(__val, __lo) ? __lo : __comp(__hi, __val) ? __hi : __val;
}
} // namespace std

#endif // __CPP_BACKPORTS__
3 changes: 1 addition & 2 deletions src/dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ void Dialog::drawTitleIcon(Surface& s, const std::string &icon, bool skinRes)
if (i==NULL)
i = gmenu2x.sc.skinRes("icons/generic.png");

i->blit(s, 4, (gmenu2x.skinConfInt["topBarHeight"] - 32) / 2);
}
i->blit(s, i->width() * .2, (gmenu2x.skinConfInt["topBarHeight"] - i->height()) / 2);}

void Dialog::writeTitle(Surface& s, const std::string &title)
{
Expand Down
Loading