mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
examples: clean file path usage in the examples, move all the fonts in the common assets folder (#12736)
This commit is contained in:
@@ -12,6 +12,7 @@ mut:
|
||||
font_normal int
|
||||
}
|
||||
|
||||
[console]
|
||||
fn main() {
|
||||
mut color_action := C.sg_color_attachment_action{
|
||||
action: gfx.Action(C.SG_ACTION_CLEAR)
|
||||
@@ -46,7 +47,9 @@ fn init(mut state AppState) {
|
||||
C.sgl_setup(s)
|
||||
state.fons = sfons.create(512, 512, 1)
|
||||
// or use DroidSerif-Regular.ttf
|
||||
if bytes := os.read_bytes(os.resource_abs_path('../assets/fonts/RobotoMono-Regular.ttf')) {
|
||||
if bytes := os.read_bytes(os.resource_abs_path(os.join_path('..', 'assets', 'fonts',
|
||||
'RobotoMono-Regular.ttf')))
|
||||
{
|
||||
println('loaded font: $bytes.len')
|
||||
state.font_normal = C.fonsAddFontMem(state.fons, c'sans', bytes.data, bytes.len,
|
||||
false)
|
||||
|
@@ -61,6 +61,7 @@ mut:
|
||||
inited bool
|
||||
}
|
||||
|
||||
[console]
|
||||
fn main() {
|
||||
mut color_action := C.sg_color_attachment_action{
|
||||
action: gfx.Action(C.SG_ACTION_CLEAR)
|
||||
@@ -99,7 +100,9 @@ fn init(user_data voidptr) {
|
||||
C.sgl_setup(s)
|
||||
state.fons = sfons.create(512, 512, 1)
|
||||
// or use DroidSerif-Regular.ttf
|
||||
if bytes := os.read_bytes(os.resource_abs_path('../assets/fonts/RobotoMono-Regular.ttf')) {
|
||||
if bytes := os.read_bytes(os.resource_abs_path(os.join_path('..', 'assets', 'fonts',
|
||||
'RobotoMono-Regular.ttf')))
|
||||
{
|
||||
println('loaded font: $bytes.len')
|
||||
state.font_normal = C.fonsAddFontMem(state.fons, c'sans', bytes.data, bytes.len,
|
||||
false)
|
||||
|
Reference in New Issue
Block a user