From ecb661f71933a3b065d8c6811d459ea247838999 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Tue, 3 Sep 2019 09:04:11 +0300 Subject: [PATCH] tetris: fix &Foo instead of *Foo warnings. --- examples/tetris/tetris.v | 4 ++-- vlib/freetype/freetype.v | 4 ++-- vlib/gg/gg.v | 4 ++-- vlib/glfw/glfw.v | 4 ++-- vlib/glm/glm.v | 10 +++++----- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/examples/tetris/tetris.v b/examples/tetris/tetris.v index 8f82934171..bf59ba6dd4 100644 --- a/examples/tetris/tetris.v +++ b/examples/tetris/tetris.v @@ -116,9 +116,9 @@ struct Game { // Index of the rotation (0-3) rotation_idx int // gg context for drawing - gg *gg.GG + gg &gg.GG // ft context for font drawing - ft *freetype.Context + ft &freetype.Context font_loaded bool } diff --git a/vlib/freetype/freetype.v b/vlib/freetype/freetype.v index 9a4a8db916..4f2f377712 100644 --- a/vlib/freetype/freetype.v +++ b/vlib/freetype/freetype.v @@ -89,7 +89,7 @@ struct C.Glyph { [typedef] struct C.FT_Face { - glyph *Glyph + glyph &Glyph } fn C.FT_Load_Char(voidptr, i64, int) int @@ -129,7 +129,7 @@ fn ft_load_char(face C.FT_Face, code i64) Character { } } -pub fn new_context(cfg gg.Cfg) *Context { +pub fn new_context(cfg gg.Cfg) &Context { scale := cfg.scale // Can only have text in ortho mode if !cfg.use_ortho { diff --git a/vlib/gg/gg.v b/vlib/gg/gg.v index f185fc525d..1fce639af7 100644 --- a/vlib/gg/gg.v +++ b/vlib/gg/gg.v @@ -61,13 +61,13 @@ struct GG { vbo u32 scale int // retina = 2 , normal = 1 pub mut: - window *glfw.Window + window &glfw.Window render_fn fn() } // fn new_context(width, height int, use_ortho bool, font_size int) *GG { -pub fn new_context(cfg Cfg) *GG { +pub fn new_context(cfg Cfg) &GG { mut window := &glfw.Window{!} if cfg.create_window { window = glfw.create_window(glfw.WinCfg{ diff --git a/vlib/glfw/glfw.v b/vlib/glfw/glfw.v index c81aeab373..59eae76772 100644 --- a/vlib/glfw/glfw.v +++ b/vlib/glfw/glfw.v @@ -102,7 +102,7 @@ pub fn window_hint(key, val int) { C.glfwWindowHint(key, val) } -pub fn create_window(c WinCfg) *Window { +pub fn create_window(c WinCfg) &Window { if c.borderless { window_hint(C.GLFW_RESIZABLE, 0) window_hint(C.GLFW_DECORATED, 0) @@ -227,7 +227,7 @@ struct C.GLFWvidmode { height int } -pub fn C.glfwGetVideoMode() *C.GLFWvidmode +pub fn C.glfwGetVideoMode() &C.GLFWvidmode pub fn get_monitor_size() Size { //# GLFWvidmode* mode = glfwGetVideoMode(glfwGetPrimaryMonitor()); diff --git a/vlib/glm/glm.v b/vlib/glm/glm.v index f64af1d8b7..d2a7685fd0 100644 --- a/vlib/glm/glm.v +++ b/vlib/glm/glm.v @@ -19,7 +19,7 @@ import math // # glm__Vec3 myglm_normalize(glm__Vec3); struct Mat4 { pub: - data *f32 + data &f32 } struct Vec2 { @@ -42,7 +42,7 @@ pub fn vec3(x, y, z f32) Vec3 { return res } -fn mat4(f *f32) Mat4 { +fn mat4(f &f32) Mat4 { res := Mat4 { data: f } @@ -130,7 +130,7 @@ fn rotate(m Mat4, angle f32, vec Vec3) Mat4 { } */ -fn f32_calloc(n int) *f32 { +fn f32_calloc(n int) &f32 { return *f32(calloc(n * sizeof(f32))) } // fn translate(vec Vec3) *f32 { @@ -250,7 +250,7 @@ pub fn identity() Mat4 { } // returns *f32 without allocation -pub fn identity2(res mut *f32) { +pub fn identity2(res mut &f32) { res[0] = 1 res[5] = 1 res[10] = 1 @@ -271,7 +271,7 @@ pub fn identity3() []f32 { } // https://github.com/toji/gl-matrix/blob/1549cf21dfa14a2bc845993485343d519cf064fe/src/gl-matrix/mat4.js -fn ortho_js(left, right, bottom, top f32) *f32 { +fn ortho_js(left, right, bottom, top f32) &f32 { mynear := 1 myfar := 1 lr := 1.0 / (left - right)