mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
tetris: fix &Foo instead of *Foo warnings.
This commit is contained in:
parent
83d724fb70
commit
ecb661f719
@ -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
|
||||
}
|
||||
|
||||
|
@ -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 {
|
||||
|
@ -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{
|
||||
|
@ -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());
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user