mirror of
https://github.com/vlang/v.git
synced 2025-09-13 14:32:26 +03:00
sokol, gg, examples: update to match uptream at 058a4c5 (#20953)
This commit is contained in:
parent
60b4fb31a1
commit
790ea2f1bd
20 changed files with 3092 additions and 2362 deletions
|
@ -387,7 +387,8 @@ fn draw_cube_glsl(app App) {
|
|||
}
|
||||
mut pass_action := gfx.PassAction{}
|
||||
pass_action.colors[0] = color_action
|
||||
gfx.begin_default_pass(&pass_action, ws.width, ws.height)
|
||||
pass := sapp.create_default_pass(pass_action)
|
||||
gfx.begin_pass(&pass)
|
||||
{
|
||||
rot := [f32(app.mouse_y), f32(app.mouse_x)]
|
||||
// ratio := f32(ws.width)/ws.height
|
||||
|
|
|
@ -314,8 +314,6 @@ fn draw_cube_glsl(app App) {
|
|||
}
|
||||
|
||||
fn frame(mut app App) {
|
||||
ws := gg.window_size_real_pixels()
|
||||
|
||||
// clear
|
||||
mut color_action := gfx.ColorAttachmentAction{
|
||||
load_action: .clear
|
||||
|
@ -329,7 +327,8 @@ fn frame(mut app App) {
|
|||
|
||||
mut pass_action := gfx.PassAction{}
|
||||
pass_action.colors[0] = color_action
|
||||
gfx.begin_default_pass(&pass_action, ws.width, ws.height)
|
||||
pass := sapp.create_default_pass(pass_action)
|
||||
gfx.begin_pass(&pass)
|
||||
|
||||
// glsl cube
|
||||
draw_cube_glsl(app)
|
||||
|
|
|
@ -502,8 +502,6 @@ fn draw_end_glsl(app App) {
|
|||
}
|
||||
|
||||
fn frame(mut app App) {
|
||||
ws := gg.window_size_real_pixels()
|
||||
|
||||
// clear
|
||||
mut color_action := gfx.ColorAttachmentAction{
|
||||
load_action: .clear
|
||||
|
@ -516,7 +514,8 @@ fn frame(mut app App) {
|
|||
}
|
||||
mut pass_action := gfx.PassAction{}
|
||||
pass_action.colors[0] = color_action
|
||||
gfx.begin_default_pass(&pass_action, ws.width, ws.height)
|
||||
pass := sapp.create_default_pass(pass_action)
|
||||
gfx.begin_pass(&pass)
|
||||
|
||||
/*
|
||||
// glsl cube
|
||||
|
|
|
@ -388,8 +388,6 @@ fn draw_end_glsl(app App) {
|
|||
}
|
||||
|
||||
fn frame(mut app App) {
|
||||
ws := gg.window_size_real_pixels()
|
||||
|
||||
// clear
|
||||
mut color_action := gfx.ColorAttachmentAction{
|
||||
load_action: .clear
|
||||
|
@ -402,7 +400,8 @@ fn frame(mut app App) {
|
|||
}
|
||||
mut pass_action := gfx.PassAction{}
|
||||
pass_action.colors[0] = color_action
|
||||
gfx.begin_default_pass(&pass_action, ws.width, ws.height)
|
||||
pass := gg.create_default_pass(pass_action)
|
||||
gfx.begin_pass(&pass)
|
||||
|
||||
draw_start_glsl(app)
|
||||
draw_cube_glsl_i(mut app)
|
||||
|
|
|
@ -144,8 +144,6 @@ fn draw_model(app App, model_pos m4.Vec4) u32 {
|
|||
}
|
||||
|
||||
fn frame(mut app App) {
|
||||
ws := gg.window_size_real_pixels()
|
||||
|
||||
// clear
|
||||
mut color_action := gfx.ColorAttachmentAction{
|
||||
load_action: .clear
|
||||
|
@ -159,7 +157,8 @@ fn frame(mut app App) {
|
|||
|
||||
mut pass_action := gfx.PassAction{}
|
||||
pass_action.colors[0] = color_action
|
||||
gfx.begin_default_pass(&pass_action, ws.width, ws.height)
|
||||
pass := sapp.create_default_pass(pass_action)
|
||||
gfx.begin_pass(&pass)
|
||||
|
||||
// render the data
|
||||
draw_start_glsl(app)
|
||||
|
|
|
@ -11,7 +11,7 @@ const used_import = sokol.used_import
|
|||
|
||||
fn main() {
|
||||
state := &AppState{
|
||||
pass_action: gfx.create_clear_pass(0.1, 0.1, 0.1, 1.0)
|
||||
pass_action: gfx.create_clear_pass_action(0.1, 0.1, 0.1, 1.0)
|
||||
}
|
||||
title := 'Sokol Drawing Template'
|
||||
desc := sapp.Desc{
|
||||
|
@ -36,7 +36,8 @@ fn init(user_data voidptr) {
|
|||
fn frame(state &AppState) {
|
||||
// println('frame')
|
||||
draw()
|
||||
gfx.begin_default_pass(&state.pass_action, sapp.width(), sapp.height())
|
||||
pass := sapp.create_default_pass(state.pass_action)
|
||||
gfx.begin_pass(&pass)
|
||||
sgl.draw()
|
||||
gfx.end_pass()
|
||||
gfx.commit()
|
||||
|
|
|
@ -14,19 +14,8 @@ mut:
|
|||
}
|
||||
|
||||
fn main() {
|
||||
mut color_action := gfx.ColorAttachmentAction{
|
||||
load_action: .clear
|
||||
clear_value: gfx.Color{
|
||||
r: 0.3
|
||||
g: 0.3
|
||||
b: 0.32
|
||||
a: 1.0
|
||||
}
|
||||
}
|
||||
mut pass_action := gfx.PassAction{}
|
||||
pass_action.colors[0] = color_action
|
||||
state := &AppState{
|
||||
pass_action: pass_action
|
||||
pass_action: gfx.create_clear_pass_action(0.3, 0.3, 0.32, 1.0)
|
||||
font_context: unsafe { nil } // &fontstash.Context(0)
|
||||
}
|
||||
title := 'V Metal/GL Text Rendering'
|
||||
|
@ -57,7 +46,8 @@ fn init(mut state AppState) {
|
|||
|
||||
fn frame(mut state AppState) {
|
||||
state.render_font()
|
||||
gfx.begin_default_pass(&state.pass_action, sapp.width(), sapp.height())
|
||||
pass := sapp.create_default_pass(state.pass_action)
|
||||
gfx.begin_pass(&pass)
|
||||
sgl.draw()
|
||||
gfx.end_pass()
|
||||
gfx.commit()
|
||||
|
|
|
@ -107,7 +107,8 @@ fn init(mut state AppState) {
|
|||
|
||||
fn frame(mut state AppState) {
|
||||
state.render_font()
|
||||
gfx.begin_default_pass(&state.pass_action, sapp.width(), sapp.height())
|
||||
pass := sapp.create_default_pass(state.pass_action)
|
||||
gfx.begin_pass(&pass)
|
||||
sgl.draw()
|
||||
gfx.end_pass()
|
||||
gfx.commit()
|
||||
|
|
|
@ -15,7 +15,7 @@ fn main() {
|
|||
mut app := &App{
|
||||
width: 800
|
||||
height: 400
|
||||
pass_action: gfx.create_clear_pass(0.1, 0.1, 0.1, 1.0)
|
||||
pass_action: gfx.create_clear_pass_action(0.1, 0.1, 0.1, 1.0)
|
||||
}
|
||||
app.init()
|
||||
app.run()
|
||||
|
@ -105,7 +105,8 @@ fn frame(mut app App) {
|
|||
dt := f64(t - app.last) / 1000.0
|
||||
app.ps.update(dt)
|
||||
draw(app)
|
||||
gfx.begin_default_pass(&app.pass_action, app.width, app.height)
|
||||
pass := sapp.create_default_pass(app.pass_action)
|
||||
gfx.begin_pass(&pass)
|
||||
sgl.default_pipeline()
|
||||
sgl.draw()
|
||||
gfx.end_pass()
|
||||
|
|
|
@ -36,7 +36,7 @@ fn main() {
|
|||
mut app := &App{
|
||||
width: 800
|
||||
height: 400
|
||||
pass_action: gfx.create_clear_pass(0.0, 0.0, 0.0, 1.0) // This will create a black color as a default pass (window background color)
|
||||
pass_action: gfx.create_clear_pass_action(0.0, 0.0, 0.0, 1.0) // This will create a black color as a default pass (window background color)
|
||||
}
|
||||
app.run()
|
||||
}
|
||||
|
@ -143,7 +143,8 @@ fn cleanup(user_data voidptr) {
|
|||
fn frame(user_data voidptr) {
|
||||
mut app := unsafe { &App(user_data) }
|
||||
|
||||
gfx.begin_default_pass(&app.pass_action, sapp.width(), sapp.height())
|
||||
pass := sapp.create_default_pass(state.pass_action)
|
||||
gfx.begin_pass(&pass)
|
||||
|
||||
gfx.apply_pipeline(app.shader_pipeline)
|
||||
gfx.apply_bindings(&app.bind)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue