git.y1.nz

gbdk-2020

GameBoy Development Kit
download: https://git.y1.nz/archives/gbdk.tar.gz
README | Files | Log | Refs | LICENSE

commit e3ff4e8fbea388e39bbf2623cb0b859abc611dd4
parent 76ead0df6aaf7e39bdb4cb5ff5b7096ad842bfbf
Author: Toxa <untoxa@mail.ru>
Date:   Sun, 21 Jan 2024 15:46:30 +0300

EXAMPLES: large_map init_camera() function now accept the initial x and y position in pixels

Diffstat:
Mgbdk-lib/examples/cross-platform/large_map/src/large_map.c12+++++-------
1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/gbdk-lib/examples/cross-platform/large_map/src/large_map.c b/gbdk-lib/examples/cross-platform/large_map/src/large_map.c @@ -174,7 +174,7 @@ void set_camera(void) } -void init_map(void) { +void init_camera(uint8_t x, uint8_t y) { // Set up tile data set_native_tile_data(0, bigmap_TILE_COUNT, bigmap_tiles); @@ -193,11 +193,9 @@ void init_map(void) { #endif - // Initial camera position can be set in pixels here. - // The coordinates + camera viewport size should be within the map boundaries. - // Map starts at 0 - camera_x = 0; - camera_y = 0; + // Initial camera position in pixels set here. + camera_x = x; + camera_y = y; // Enforce map limits on initial camera position if (camera_x > camera_max_x) camera_x = camera_max_x; if (camera_y > camera_max_y) camera_y = camera_max_y; @@ -238,7 +236,7 @@ void init_map(void) { void main(void){ DISPLAY_OFF; - init_map(); + init_camera(0, 0); SHOW_BKG; DISPLAY_ON;

This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.