mirror of
https://github.com/vlang/v.git
synced 2025-09-08 14:51:53 -04:00
gg: use html5_canvas_name
as the name of the canvas in gg.js.v
too, similarly to gg.c.v
This commit is contained in:
parent
33965bc29b
commit
be1270540b
@ -190,7 +190,7 @@ fn main() {
|
||||
create_window: true
|
||||
resizable: false
|
||||
window_title: 'snek'
|
||||
canvas: 'canvas'
|
||||
html5_canvas_name: 'canvas'
|
||||
)
|
||||
|
||||
app.gg.run()
|
||||
|
@ -171,7 +171,7 @@ fn main() {
|
||||
user_data: game
|
||||
frame_fn: frame
|
||||
event_fn: on_event
|
||||
canvas: 'canvas'
|
||||
html5_canvas_name: 'canvas'
|
||||
)
|
||||
game.init_game()
|
||||
game.gg.run() // Run the render loop in the main thread
|
||||
|
@ -250,9 +250,9 @@ pub:
|
||||
native_rendering bool // Cocoa on macOS/iOS, GDI+ on Windows
|
||||
// drag&drop
|
||||
enable_dragndrop bool // enable file dropping (drag'n'drop), default is false
|
||||
max_dropped_files int = 1 // max number of dropped files to process (default: 1)
|
||||
max_dropped_file_path_length int = 2048 // max length in bytes of a dropped UTF-8 file path (default: 2048)
|
||||
canvas string
|
||||
max_dropped_files int = 1 // max number of dropped files to process (default: 1)
|
||||
max_dropped_file_path_length int = 2048 // max length in bytes of a dropped UTF-8 file path (default: 2048)
|
||||
html5_canvas_name string = 'canvas' // the id/name of the canvas element, that will be used to render GG apps
|
||||
}
|
||||
|
||||
const size = Size{0, 0}
|
||||
@ -330,8 +330,8 @@ pub fn new_context(cfg Config) &Context {
|
||||
g.config = cfg
|
||||
g.window = dom.window()
|
||||
document := dom.document
|
||||
canvas_elem := document.getElementById(cfg.canvas.str) or {
|
||||
panic('gg: cannot get canvas element')
|
||||
canvas_elem := document.getElementById(cfg.html5_canvas_name.str) or {
|
||||
panic('gg: cannot get canvas element from cfg.html5_canvas_name.str')
|
||||
}
|
||||
canvas := get_canvas(canvas_elem)
|
||||
g.canvas = canvas
|
||||
|
Loading…
x
Reference in New Issue
Block a user