diff --git a/examples/snek/snek.js.v b/examples/snek/snek.js.v index 30636ff130..22aa1b4e33 100644 --- a/examples/snek/snek.js.v +++ b/examples/snek/snek.js.v @@ -190,7 +190,7 @@ fn main() { create_window: true resizable: false window_title: 'snek' - canvas: 'canvas' + html5_canvas_name: 'canvas' ) app.gg.run() diff --git a/examples/tetris/tetris.js.v b/examples/tetris/tetris.js.v index b6af7783fd..c975b504fb 100644 --- a/examples/tetris/tetris.js.v +++ b/examples/tetris/tetris.js.v @@ -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 diff --git a/vlib/gg/gg.js.v b/vlib/gg/gg.js.v index 4ca9366b80..e995b862dc 100644 --- a/vlib/gg/gg.js.v +++ b/vlib/gg/gg.js.v @@ -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