Difference between revisions of "Modules/scroll"
From MSX Game Library
< Modules
(Created page with "{{MODULE |name=scroll |category=Graphic |dependency1=vdp |dependency2= |dependency3= |sample1=s_scroll |sample1_desc= |sample2= |sample2_desc= |sample3= |sample3_desc= |sample...") |
|||
Line 2: | Line 2: | ||
|name=scroll | |name=scroll | ||
|category=Graphic | |category=Graphic | ||
+ | |image=raw.githubusercontent.com/aoineko-fr/MSXgl/main/engine/doc/img/sample_scroll.png | ||
|dependency1=vdp | |dependency1=vdp | ||
|dependency2= | |dependency2= |
Latest revision as of 00:03, 13 January 2024
The scroll module handles multidirectional scrolling. For the moment, it works with tile-based modes. On MSX2, it also supports pixel-per-pixel scrolling via screen adjustment registers, and masks to hide this offset.
Usage
To use this module, include "scroll.h" in your source code, and add "scroll" to the modules list (LibModules) in your project's configuration file (project_config.js).
Samples
See module use cases in the sample programs:
Settings
Library configuration (msxgl_config.h):
// Allow horizontal and/or vertical scrolling #define SCROLL_HORIZONTAL TRUE // Activate horizontal scrolling #define SCROLL_VERTICAL TRUE // Activate vertical scrolling // Source data info #define SCROLL_SRC_X 64 // Start X coordinate of the source data #define SCROLL_SRC_Y 0 // Start Y coordinate of the source data #define SCROLL_SRC_W 128 // Width of the source data #define SCROLL_SRC_H 24 // Height of the source data // Destination data info #define SCROLL_DST_X 0 // Destination x coordinate (in layout table) #define SCROLL_DST_Y 2 // Destination y coordinate (in layout table) #define SCROLL_DST_W 32 // Destination width #define SCROLL_DST_H 20 // Destination height #define SCROLL_SCREEN_W 32 // Screen width in tile number // Allow scroll data looping (only for horizontal scrolling) #define SCROLL_WRAP TRUE // Use screen position adjust register (allow per-pixel scrolling) [MSX2] #define SCROLL_ADJUST TRUE // Global ajustement #define SCROLL_ADJUST_SPLIT TRUE // Destination windows ajustement using screen split // Use sprite mask (allow smooth per-pixel scrolling) [MSX2] #define SCROLL_MASK TRUE // Use sprite to mask #define SCROLL_MASK_ID 0 // First sprite ID to use #define SCROLL_MASK_COLOR COLOR_BLACK // Must be the same than border color #define SCROLL_MASK_PATTERN 0 // Sprite pattern to use
Dependencies
Dependency on other modules:
Documentation