Skip to content

Commit 4a381ae

Browse files
committed
centering display
1 parent e6fbba7 commit 4a381ae

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

screen.cpp

+4-6
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,8 @@
1010
#include "roms/rom82s126_4a.h" // palette
1111

1212
void Screen::begin() {
13-
Display::begin(BLACK, WHITE, ORIENT);
13+
Display::begin(BLACK, WHITE, ORIENT, DISPLAY_WIDTH, DISPLAY_HEIGHT);
1414
clear();
15-
_xoff = (_dx - DISPLAY_WIDTH) / 2;
16-
_yoff = (_dy - DISPLAY_HEIGHT) / 2;
1715
}
1816

1917
static void get_palette(palette_entry &p, uint8_t index) {
@@ -60,12 +58,12 @@ void Screen::_set(uint16_t a, uint8_t b) {
6058
x = 27 - a+0x3e2;
6159
y = 1;
6260
}
63-
draw_tile(a, 8*x + _xoff, 8*y + _yoff);
61+
draw_tile(a, 8*x, 8*y);
6462
}
6563

6664
void Screen::set_sprite(uint16_t off, uint8_t sx, uint8_t sy) {
67-
int x = DISPLAY_WIDTH - sx + 15 + _xoff;
68-
int y = DISPLAY_HEIGHT - sy - 16 + _yoff;
65+
int x = DISPLAY_WIDTH - sx + 15;
66+
int y = DISPLAY_HEIGHT - sy - 16;
6967

7068
palette_entry p;
7169
get_palette(p, _mem[0x4ff1 + off]);

screen.h

-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ class Screen: public Display, public Memory::Device {
4848
void _set(uint16_t a, uint8_t b);
4949
void draw_tile(uint16_t addr, int x, int y);
5050

51-
unsigned _xoff, _yoff;
5251
uint8_t _tp[2048];
5352
Memory &_mem;
5453
};

0 commit comments

Comments
 (0)