1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

gg: use gg types for Events instead of sapp

This commit is contained in:
Alexander Medvednikov
2021-02-17 06:44:01 +01:00
parent 3341c17202
commit d4a05bebde
9 changed files with 247 additions and 74 deletions

View File

@@ -16,7 +16,7 @@ const (
]
)
// UI
// UI
struct App_data {
pub mut:
gg &gg.Context
@@ -59,7 +59,7 @@ fn draw_frame(mut app App_data) {
txt1.create_text(cframe_txt, 43)
txt1.create_texture()
}
// ----- decomment if you want text rotation ----
// ----- decomment if you want text rotation ----
// txt1.bmp.angle = 3.141592 / 180 * f32(app.frame_c % 360)
// txt1.draw_text_bmp(app.gg, 300, 350)
// txt1.bmp.angle = 0
@@ -108,7 +108,7 @@ But Vwill prevail for sure, V is the way!!
app.gg.end()
}
fn my_event_manager(mut ev sapp.Event, mut app App_data) {
fn my_event_manager(mut ev gg.Event, mut app App_data) {
if ev.typ == .mouse_move {
app.mouse_x = int(ev.mouse_x)
app.mouse_y = int(ev.mouse_y)
@@ -145,7 +145,7 @@ fn main() {
app.ttf_render << &ttf.TTF_render_Sokol{
bmp: &ttf.BitMap{
tf: &(app.tf[0])
buf: unsafe {malloc(32000000)}
buf: unsafe { malloc(32000000) }
buf_size: (32000000)
color: 0xFF0000FF
// style: .raw