mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
fix Tetris example
This commit is contained in:
parent
f72de84e9c
commit
c619243067
@ -2287,8 +2287,8 @@ fn (p mut Parser) array_init() string {
|
|||||||
// println('GOT TYP after [] $typ')
|
// println('GOT TYP after [] $typ')
|
||||||
}
|
}
|
||||||
// ! after array => no malloc and no copy
|
// ! after array => no malloc and no copy
|
||||||
no_copy := p.tok == NOT
|
no_alloc := p.tok == NOT
|
||||||
if no_copy {
|
if no_alloc {
|
||||||
p.next()
|
p.next()
|
||||||
}
|
}
|
||||||
// [1,2,3]!! => [3]int{1,2,3}
|
// [1,2,3]!! => [3]int{1,2,3}
|
||||||
@ -2312,8 +2312,8 @@ fn (p mut Parser) array_init() string {
|
|||||||
// typ += '_ptr"
|
// typ += '_ptr"
|
||||||
// }
|
// }
|
||||||
mut new_arr := 'new_array_from_c_array'
|
mut new_arr := 'new_array_from_c_array'
|
||||||
if no_copy {
|
if no_alloc {
|
||||||
new_arr += '_no_copy'
|
new_arr += '_no_alloc'
|
||||||
}
|
}
|
||||||
p.gen(' })')
|
p.gen(' })')
|
||||||
// p.gen('$new_arr($vals.len, $vals.len, sizeof($typ), ($typ[]) $c_arr );')
|
// p.gen('$new_arr($vals.len, $vals.len, sizeof($typ), ($typ[]) $c_arr );')
|
||||||
|
5
gl/gl.v
5
gl/gl.v
@ -13,8 +13,13 @@ import const (
|
|||||||
GL_DEPTH_TEST
|
GL_DEPTH_TEST
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// TODO: windows support
|
||||||
|
#flag linux -I$HOME/code/v/thirdparty/glad
|
||||||
|
#flag darwin -I$HOME/code/v/thirdparty/glad
|
||||||
|
|
||||||
#include "glad.h"
|
#include "glad.h"
|
||||||
#include "glad.c"
|
#include "glad.c"
|
||||||
|
|
||||||
fn init_glad() {
|
fn init_glad() {
|
||||||
ok := C.gladLoadGL()
|
ok := C.gladLoadGL()
|
||||||
if !ok {
|
if !ok {
|
||||||
|
@ -129,6 +129,10 @@ fn rotate(m Mat4, angle float, vec Vec3) Mat4 {
|
|||||||
return Mat4{}
|
return Mat4{}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
fn float_calloc(n int) *float {
|
||||||
|
return *float(calloc(n * sizeof(float)))
|
||||||
|
}
|
||||||
// fn translate(vec Vec3) *float {
|
// fn translate(vec Vec3) *float {
|
||||||
fn translate(m Mat4, v Vec3) Mat4 {
|
fn translate(m Mat4, v Vec3) Mat4 {
|
||||||
// # return glm__mat4(myglm_translate(vec.x,vec.y,vec.z) );
|
// # return glm__mat4(myglm_translate(vec.x,vec.y,vec.z) );
|
||||||
|
Loading…
Reference in New Issue
Block a user