examples: remove the setting of font_path from drag_n_drop.v and quadtree_demo.v (make them portable to Android + setting the font does not matter, for their goal)

This commit is contained in:
Delyan Angelov 2024-09-22 19:18:11 +03:00
parent cfa91d81d7
commit f98e9d5757
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED
2 changed files with 1 additions and 7 deletions

View File

@ -1,12 +1,10 @@
module main module main
import os
import gg import gg
import gx import gx
import sokol.sapp import sokol.sapp
const max_files = 12 const max_files = 12
const text = 'Drag&Drop here max ${max_files} files.'
const text_size = 16 const text_size = 16
struct App { struct App {
@ -16,7 +14,6 @@ mut:
} }
fn main() { fn main() {
mut font_path := os.resource_abs_path(os.join_path('..', 'assets', 'fonts', 'RobotoMono-Regular.ttf'))
mut app := &App{} mut app := &App{}
app.gg = gg.new_context( app.gg = gg.new_context(
bg_color: gx.rgb(174, 198, 255) bg_color: gx.rgb(174, 198, 255)
@ -24,7 +21,6 @@ fn main() {
height: 400 height: 400
window_title: 'Drag and drop' window_title: 'Drag and drop'
frame_fn: frame frame_fn: frame
font_path: font_path
user_data: app user_data: app
event_fn: my_event_manager event_fn: my_event_manager
// drag & drop // drag & drop
@ -54,7 +50,7 @@ fn frame(mut app App) {
align: .left align: .left
size: int(text_size * app.gg.scale + 0.5) size: int(text_size * app.gg.scale + 0.5)
} }
app.gg.draw_text(12, 12, text, txt_conf) app.gg.draw_text(12, 12, 'Drag&Drop here max ${max_files} files.', txt_conf)
mut y := 40 mut y := 40
for c, f in app.dropped_file_list { for c, f in app.dropped_file_list {

View File

@ -3,7 +3,6 @@ module main
import datatypes import datatypes
import gg import gg
import gx import gx
import os
import time import time
import math import math
import rand import rand
@ -123,7 +122,6 @@ fn main() {
frame_fn: frame frame_fn: frame
event_fn: on_event event_fn: on_event
user_data: app user_data: app
font_path: os.resource_abs_path('../assets/fonts/RobotoMono-Regular.ttf')
) )
app.qt = app.qt.create(0, 0, 1340, 640, 8, 4, 0) app.qt = app.qt.create(0, 0, 1340, 640, 8, 4, 0)
app.start() app.start()