Skip to content

Commit

Permalink
Minor adjustments.
Browse files Browse the repository at this point in the history
  • Loading branch information
punesemu committed Feb 5, 2024
1 parent b2fcc93 commit d58c234
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 15 deletions.
13 changes: 5 additions & 8 deletions src/core/nsf.c
Original file line number Diff line number Diff line change
Expand Up @@ -1359,14 +1359,12 @@ static void nsf_draw_controls(void) {
uL("[cyan]" uPs("") "[white] - [yellow]" uPs("") "[white] - " uPs("") ""),
nsf.info.name, nsf.info.artist, nsf.info.copyright);
}

// player
{
if (nes[0].p.ppu.frames == 0) {
y = 33;
dos_hline(0, 0, y, SCR_COLUMNS, DOS_BROWN);
dos_text(0, DOS_ALIGNHCENTER, y - 4, 0, 0, -1, -1, DOS_RED, DOS_BLACK,
uL("pixelmix"), 8, uL(" Player "));
dos_text(0, DOS_ALIGNHCENTER, y - 4, 0, 0, -1, -1, DOS_RED, DOS_BLACK, uL("pixelmix"), 8, uL(" Player "));
dos_image(0, NSF_GUI_PPUX, NSF_GUI_PPUY, 0, 0, -1, -1, uL(":/pics/pics/nsf_player.png"));
}
// note dell'autore
Expand Down Expand Up @@ -1416,11 +1414,11 @@ static void nsf_draw_controls(void) {
uL("" uPs("") ""),
nsf_print_time(timer, nsf.info_song && nsf.current_song.use_timer && !nsf.options.visual_duration, fg_ok));
ttimer2 = timer;
bg = !nsf.info_song || !nsf.current_song.use_timer || nsf.options.visual_duration ? DOS_TL02 : DOS_TL03;
dos_box(0, NSF_GUI_TIMERS_3_PPUX, NSF_GUI_TIMERS_3_PPUY + 2, 2, 2, bg, bg, bg);
bg = !nsf.info_song || !nsf.current_song.use_timer || !nsf.options.visual_duration ? DOS_TL02 : DOS_TL03;
dos_box(0, NSF_GUI_TIMERS_3_PPUX, NSF_GUI_TIMERS_3_PPUY + 6, 2, 2, bg, bg, bg);
}
bg = !nsf.info_song || !nsf.current_song.use_timer || nsf.options.visual_duration ? DOS_TL02 : DOS_TL03;
dos_box(0, NSF_GUI_TIMERS_3_PPUX, NSF_GUI_TIMERS_3_PPUY + 2, 2, 2, bg, bg, bg);
bg = !nsf.info_song || !nsf.current_song.use_timer || !nsf.options.visual_duration ? DOS_TL02 : DOS_TL03;
dos_box(0, NSF_GUI_TIMERS_3_PPUX, NSF_GUI_TIMERS_3_PPUY + 6, 2, 2, bg, bg, bg);
}
// canzoni
{
Expand All @@ -1439,7 +1437,6 @@ static void nsf_draw_controls(void) {
DOS_ALIGNHCENTER, 0, NSF_GUI_SONGS_W, NSF_GUI_SONGS_H, fg, bg, uL("lemon_10"), 10, buff);
scurrent = nsf.songs.current;
}

if (nsf.playlist.count > 0) {
if (force || (spindex != nsf.playlist.index)) {
condition = !cfg->nsf_player_playlist;
Expand Down
11 changes: 4 additions & 7 deletions src/gui/draw_on_screen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ static QList<_dos_tag_ele> dos_tags = {

void dos_text(BYTE nidx, int ppu_x, int ppu_y, int rect_x, int rect_y, int rect_w, int rect_h,
const WORD fg_def, const WORD bg_def, const uTCHAR *font_family, const int font_size, const uTCHAR *fmt, ...) {
uint mask0 = qRgb(255, 255, 255), mask1 = qRgb(0, 0, 0);
static uint mask0 = qRgb(255, 255, 255), mask1 = qRgb(0, 0, 0);
QFont font(uQString(font_family));
WORD fg = fg_def, bg = bg_def;
QString line;
Expand All @@ -133,7 +133,6 @@ void dos_text(BYTE nidx, int ppu_x, int ppu_y, int rect_x, int rect_y, int rect_

{
int char_x = 0, wpixels = 0, hpixels = 0;
QVector<QRgb> v = { mask0, mask1 };
QFontMetrics fontMetrics(font);
QString subimage = "";
bool is_bck_tag = false;
Expand All @@ -156,8 +155,7 @@ void dos_text(BYTE nidx, int ppu_x, int ppu_y, int rect_x, int rect_y, int rect_
}

QImage mask(rect_w, rect_h, QImage::Format_Mono);
v << mask0 << mask1;
mask.setColorTable(v);
mask.setColorTable(QVector<QRgb>{ mask0, mask1 });
// nero
mask.fill(1);

Expand Down Expand Up @@ -276,6 +274,7 @@ void dos_text(BYTE nidx, int ppu_x, int ppu_y, int rect_x, int rect_y, int rect_
}
}
}

void dos_text_scroll_tick(BYTE nidx, int ppu_x, int ppu_y, const WORD fg_def, const WORD bg_def,
const uTCHAR *font_family, const int font_size, _dos_text_scroll *scroll, const uTCHAR *fmt, ...) {
int wpixels = 0;
Expand Down Expand Up @@ -644,7 +643,5 @@ static INLINE int dos_round(double d0, double d1) {
return (result);
}
static INLINE QSize dos_image_dim(const uTCHAR *resource) {
QImage image(uQString(resource));

return (image.size());
return (QImageReader(uQString(resource)).size());
}
1 change: 1 addition & 0 deletions src/gui/draw_on_screen.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ typedef struct _dos_text_curtain {

EXTERNC void dos_text(BYTE nidx, int ppu_x, int ppu_y, int img_x, int img_y, int img_w, int img_h,
const WORD fg_def, const WORD bg_def, const uTCHAR *font_family, const int font_size, const uTCHAR *fmt, ...);

EXTERNC void dos_text_scroll_tick(BYTE nidx, int ppu_x, int ppu_y, const WORD fg_def, const WORD bg_def,
const uTCHAR *font_family, const int font_size, _dos_text_scroll *scroll, const uTCHAR *fmt, ...);

Expand Down

0 comments on commit d58c234

Please sign in to comment.