mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
gg: make create_image() return !Image
This commit is contained in:
@@ -12,9 +12,9 @@ pub mut:
|
||||
image gg.Image
|
||||
}
|
||||
|
||||
pub fn (mut window Window) init(_ voidptr) {
|
||||
pub fn (mut window Window) init() {
|
||||
logo_path := os.resource_abs_path(os.join_path('..', 'assets', 'logo.png'))
|
||||
window.image = window.ctx.create_image(logo_path)
|
||||
window.image = window.ctx.create_image(logo_path) or { panic(err) }
|
||||
}
|
||||
|
||||
pub fn (mut window Window) draw(_ voidptr) {
|
||||
|
||||
@@ -30,7 +30,7 @@ fn main() {
|
||||
init_fn: init_images
|
||||
)
|
||||
mut logo_path := os.resource_abs_path(os.join_path('..', 'assets', 'logo.png'))
|
||||
app.image = app.gg.create_image(logo_path).id
|
||||
app.image = app.gg.create_image(logo_path)!.id
|
||||
app.gg.run()
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,9 @@ pub mut:
|
||||
}
|
||||
|
||||
pub fn (mut window Window) init() {
|
||||
window.img = window.ctx.create_image(os.resource_abs_path('../assets/logo.png'))
|
||||
window.img = window.ctx.create_image(os.resource_abs_path('../assets/logo.png')) or {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn (mut window Window) draw() {
|
||||
|
||||
@@ -82,7 +82,7 @@ fn main() {
|
||||
|
||||
fn init_images(mut app App) {
|
||||
mut logo_path := os.resource_abs_path(os.join_path('..', 'assets', 'logo.png'))
|
||||
app.image = app.gg.create_image(logo_path)
|
||||
app.image = app.gg.create_image(logo_path) or { panic(err) }
|
||||
}
|
||||
|
||||
fn frame(mut app App) {
|
||||
|
||||
Reference in New Issue
Block a user