Draw into the whole window, not its top-left 320x200
The graphics verbs documented a coordinate transform that did not exist. With SCALE off a coordinate went straight to akgl_draw_* as a pixel address, so an 800x600 window drew a C128 listing into its corner and left the rest unused -- while the chapter said coordinates were 320x200 and stretching to fit was the host's business. akbasic_GraphicsBackend gains a size entry point, require_graphics() asks it before every verb that draws so a resized window is honoured between two statements, and 320x200 becomes the fallback for a backend that leaves it NULL. It is the record's one optional member, so a host written against the old header keeps the behaviour it had. SCALE now maps onto the device, and RGR(1)/RGR(2) report the drawing surface so a program can use a window whose size it did not choose. RGR(0) is BASIC 7.0's own field, the GRAPHIC mode. SCALE also mapped xmax onto the width rather than onto the last pixel, so SCALE 1, 319, 199 followed by DRAW 1, 319, 199 drew nothing at all -- one pixel past the surface. Fixed in the same line, because it is what makes "SCALE gives a C128 listing the whole window" true rather than nearly true. The akgl test renders against a 128x128 target, deliberately smaller than the old constants: a SCALE still dividing by them misses it entirely rather than landing somewhere plausible. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -89,7 +89,10 @@ interpreter's error code, which bears no relation to a Commodore error number. P
|
||||
|
||||
## Graphics
|
||||
|
||||
- **Coordinates are always 320 by 200**, whatever the window size.
|
||||
- **A coordinate is a window pixel, not one of 320 by 200.** A C128 listing therefore
|
||||
draws in the top-left corner of a larger window; `SCALE 1, 319, 199` gives it the
|
||||
whole window back. `RGR(1)` and `RGR(2)` report the size, and are ours rather than
|
||||
7.0's — where 7.0's `RGR` takes only field 0, the `GRAPHIC` mode.
|
||||
- **`SSHAPE` puts a handle in the string, not the pixels.** You can pass it to `GSHAPE`
|
||||
and `SPRSAV`; you cannot save it or take its `LEN`.
|
||||
- **`WIDTH` is emulated** by drawing parallel passes.
|
||||
@@ -107,7 +110,8 @@ interpreter's error code, which bears no relation to a Commodore error number. P
|
||||
|
||||
## Sprites
|
||||
|
||||
- **Coordinates are the 320 by 200 drawing space**, not the VIC-II's raster space.
|
||||
- **Coordinates are window pixels**, not the VIC-II's raster space, and `SCALE` does
|
||||
not apply to them.
|
||||
- **`SPRSAV` takes an integer array**, not a string, for the data form — a string here
|
||||
cannot hold a zero byte. It also takes an **image file path**, which a C128 cannot.
|
||||
- **A sprite loaded from a file keeps the image's own size**, not 24 by 21.
|
||||
|
||||
Reference in New Issue
Block a user