gg, gx: deprecate gx and replace all occurences with gg (which now contains all the functionality of gx) (#24966)
Some checks failed
Graphics CI / gg-regressions (push) Waiting to run
vlib modules CI / build-module-docs (push) Waiting to run
native backend CI / native-backend-ubuntu (push) Waiting to run
vab CI / v-compiles-os-android (push) Waiting to run
native backend CI / native-backend-windows (push) Waiting to run
Shy and PV CI / v-compiles-puzzle-vibes (push) Waiting to run
Sanitized CI / sanitize-undefined-clang (push) Waiting to run
Sanitized CI / sanitize-undefined-gcc (push) Waiting to run
Sanitized CI / tests-sanitize-address-clang (push) Waiting to run
Sanitized CI / sanitize-address-msvc (push) Waiting to run
Sanitized CI / sanitize-address-gcc (push) Waiting to run
Sanitized CI / sanitize-memory-clang (push) Waiting to run
sdl CI / v-compiles-sdl-examples (push) Waiting to run
Time CI / time-linux (push) Waiting to run
Time CI / time-macos (push) Waiting to run
Time CI / time-windows (push) Waiting to run
toml CI / toml-module-pass-external-test-suites (push) Waiting to run
Tools CI / tools-linux (clang) (push) Waiting to run
Tools CI / tools-linux (gcc) (push) Waiting to run
Tools CI / tools-linux (tcc) (push) Waiting to run
Tools CI / tools-macos (clang) (push) Waiting to run
Tools CI / tools-windows (gcc) (push) Waiting to run
Tools CI / tools-windows (msvc) (push) Waiting to run
Tools CI / tools-windows (tcc) (push) Waiting to run
Tools CI / tools-docker-ubuntu-musl (push) Waiting to run
vab CI / vab-compiles-v-examples (push) Waiting to run
wasm backend CI / wasm-backend (ubuntu-22.04) (push) Waiting to run
wasm backend CI / wasm-backend (windows-2022) (push) Waiting to run
Workflow Lint / lint-yml-workflows (push) Has been cancelled

This commit is contained in:
Eliyaan (Nopana) 2025-08-14 18:53:56 +02:00 committed by GitHub
parent 64ad7c73e8
commit bbb61ab368
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
87 changed files with 1061 additions and 881 deletions

View file

@ -1,7 +1,6 @@
import os
import os.asset
import gg
import gx
const csize = 32
@ -204,7 +203,7 @@ fn (mut g Game) key_down(key gg.KeyCode, _ gg.Modifier, _ voidptr) {
g.win = g.boxes.all(g.warehouse[it.y][it.x] == `@`)
}
fn (g &Game) ctext(ws gg.Size, oy int, message string, size int, color gx.Color) {
fn (g &Game) ctext(ws gg.Size, oy int, message string, size int, color gg.Color) {
g.ctx.draw_text(ws.width / 2, ws.height + oy, message,
color: color
size: size
@ -229,20 +228,20 @@ fn (g &Game) draw_frame(_ voidptr) {
g.ctx.draw_image_by_id(ox + x * csize, oy + y * csize, 32, 32, iid)
}
}
g.ctx.draw_rect_filled(0, ws.height - 70, ws.width, 70, gx.black)
g.ctx.draw_rect_filled(0, ws.height - 70, ws.width, 70, gg.black)
if g.win {
g.ctext(ws, -50, 'You win!!!', 60, gx.yellow)
g.ctext(ws, -15, 'Press `space` to continue.', 20, gx.gray)
g.ctext(ws, -50, 'You win!!!', 60, gg.yellow)
g.ctext(ws, -15, 'Press `space` to continue.', 20, gg.gray)
} else {
for idx, title in g.titles {
g.ctext(ws, -65 + (idx * 20), title, 22, gx.white)
g.ctext(ws, -65 + (idx * 20), title, 22, gg.white)
}
g.ctext(ws, -65 + (g.titles.len * 20), 'Boxes: ${g.boxes.len:04}', 16, gx.gray)
g.ctext(ws, -65 + (g.titles.len * 20), 'Boxes: ${g.boxes.len:04}', 16, gg.gray)
}
g.ctx.draw_rect_filled(0, 0, ws.width, 40, gx.black)
g.ctx.draw_text(30, 0, 'Level: ${g.level + 1:02}', color: gx.green, size: 40)
g.ctx.draw_text(ws.width - 225, 0, 'Moves: ${g.moves:04}', color: gx.green, size: 40)
g.ctx.draw_text(ws.width / 2 - 110, 0, 'Pushes: ${g.pushes:04}', color: gx.green, size: 40)
g.ctx.draw_rect_filled(0, 0, ws.width, 40, gg.black)
g.ctx.draw_text(30, 0, 'Level: ${g.level + 1:02}', color: gg.green, size: 40)
g.ctx.draw_text(ws.width - 225, 0, 'Moves: ${g.moves:04}', color: gg.green, size: 40)
g.ctx.draw_text(ws.width / 2 - 110, 0, 'Pushes: ${g.pushes:04}', color: gg.green, size: 40)
g.ctx.end()
}