diff --git a/examples/mini_calculator.v b/examples/mini_calculator.v index bb97763d71..a9576cdb8d 100644 --- a/examples/mini_calculator.v +++ b/examples/mini_calculator.v @@ -131,4 +131,4 @@ fn main() { } println(res) } -} \ No newline at end of file +} diff --git a/examples/tetris/tetris.v b/examples/tetris/tetris.v index 11866ec203..8f3ba73f79 100644 --- a/examples/tetris/tetris.v +++ b/examples/tetris/tetris.v @@ -26,12 +26,12 @@ const ( const ( text_cfg = gx.TextCfg{ - align:gx.ALIGN_LEFT + align:gx.align_left size:TextSize color:gx.rgb(0, 0, 0) } over_cfg = gx.TextCfg{ - align:gx.ALIGN_LEFT + align:gx.align_left size:TextSize color:gx.White } diff --git a/vlib/freetype/freetype.v b/vlib/freetype/freetype.v index a6ec8f9081..11d137d52b 100644 --- a/vlib/freetype/freetype.v +++ b/vlib/freetype/freetype.v @@ -110,16 +110,16 @@ struct C.FT_Glyph_Metrics { } struct C.Glyph { - bitmap Bitmap + bitmap C.Bitmap bitmap_left int bitmap_top int advance Advance - metrics FT_Glyph_Metrics + metrics C.FT_Glyph_Metrics } [typedef] struct C.FT_Face { - glyph &Glyph + glyph &C.Glyph family_name charptr style_name charptr } @@ -193,7 +193,7 @@ pub fn new_context(cfg gg.Cfg) &FreeType { projection := glm.ortho(0, width, 0, height)// 0 at BOT shader.set_mat4('projection', projection) // FREETYPE - ft := FT_Library{0} + ft := C.FT_Library{0} // All functions return a value different than 0 whenever // an error occurred mut ret := C.FT_Init_FreeType(&ft) @@ -386,7 +386,7 @@ pub fn (ctx mut FreeType) draw_text_def(x, y int, text string) { cfg := gx.TextCfg { color: gx.Black size: default_font_size - align: gx.ALIGN_LEFT + align: gx.align_left } ctx.draw_text(x, y, text, cfg) } @@ -451,9 +451,12 @@ pub fn (ctx mut FreeType) text_size(s string) (int, int) { return scaled_x, scaled_y } +/* pub fn (f FT_Face) str() string { return 'FT_Face{ style_name: ${ptr_str(f.style_name)} family_name: ${ptr_str(f.family_name)} }' } +*/ + pub fn (ac []Character) str() string { mut res := []string for c in ac { diff --git a/vlib/gg2/gg.v b/vlib/gg2/gg.v index 34347fdfa9..8190aa9fcc 100644 --- a/vlib/gg2/gg.v +++ b/vlib/gg2/gg.v @@ -120,7 +120,7 @@ pub fn (ctx &GG) draw_text_def(x, y int, text string) { cfg := gx.TextCfg { color: gx.Black size: default_font_size - align: gx.ALIGN_LEFT + align: gx.align_left } ctx.draw_text(x, y, text, cfg) } diff --git a/vlib/gl/gl.v b/vlib/gl/gl.v index 395b58b8c9..a97be08071 100644 --- a/vlib/gl/gl.v +++ b/vlib/gl/gl.v @@ -11,6 +11,46 @@ module gl // joe-c: fix & remove pub enum TmpGlImportHack{ non_empty } +fn C.glDisable() +fn C.glEnable() +fn C.glScissor() +fn C.glVertexAttribPointer() +fn C.glGenBuffers() +fn C.glEnableVertexAttribArray() +fn C.glGenVertexArrays() +fn C.glDrawElements() +fn C.glUseProgram() +fn C.glDrawArrays() +fn C.glBufferData() +fn C.glGenerateMipmap() +fn C.glTexParameteri() +fn C.glDeleteTextures() +fn C.glBindTexture() +fn C.glActiveTexture() +fn C.glGenTextures() +fn C.glBindBuffer() +fn C.glBindVertexArray() +fn C.glGetProgramInfoLog() +fn C.glGetShaderInfoLog() +fn C.glDeleteShader() +fn C.glGetProgramiv() +fn C.glLinkProgram() +fn C.glAttachShader() +fn C.glGetShaderiv() +fn C.glCompileShader() +fn C.glShaderSource() +fn C.glCreateProgram() +fn C.glClear() +fn C.glCreateShader() +fn C.glClearColor() +fn C.glViewport() +fn C.gladLoadGL() +fn C.glTexImage2D() +fn C.glPixelStorei() +fn C.glBlendFunc() + + + pub fn init_glad() { ok := C.gladLoadGL() if isnil(ok) { diff --git a/vlib/glfw/glfw.v b/vlib/glfw/glfw.v index 1cf3f70d7a..6e3816ea96 100644 --- a/vlib/glfw/glfw.v +++ b/vlib/glfw/glfw.v @@ -51,6 +51,25 @@ pub const ( KeyDown = 264 ) +fn C.glfwGetWindowUserPointer() voidptr +fn C.glfwGetPrimaryMonitor() voidptr +fn C.glfwSetWindowUserPointer() +fn C.glfwSetCursor() +fn C.glfwGetCursorPos() +fn C.glfwSetClipboardString() +fn C.glfwGetWindowContentScale() +fn C.glfwGetClipboardString() +fn C.glfwGetKey() +fn C.glfwGetTime() +fn C.glfwSetCharModsCallback() +fn C.glfwSetKeyCallback() +fn C.glfwPostEmptyEvent() +fn C.glfwSetScrollCallback() +fn C.glfwSetWindowSizeCallback() +fn C.glfwSetMouseButtonCallback() +fn C.glfwSetCursorPosCallback() +fn C.glfwSwapBuffers() + // joe-c: fix & remove struct TmpGlImportHack { hack gl.TmpGlImportHack @@ -341,3 +360,4 @@ pub fn (size Size) str() string { pub fn get_window_user_pointer(gwnd voidptr) voidptr { return C.glfwGetWindowUserPointer(gwnd) } + diff --git a/vlib/glm/glm.v b/vlib/glm/glm.v index ac6dcc835f..86cab45c78 100644 --- a/vlib/glm/glm.v +++ b/vlib/glm/glm.v @@ -262,7 +262,7 @@ pub fn identity2(res mut &f32) { } pub fn identity3() []f32 { - res := [1.0, 0, 0, 0, + res := [f32(1.0), 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, diff --git a/vlib/gx/gx.v b/vlib/gx/gx.v index a28532d902..f770fadbe2 100644 --- a/vlib/gx/gx.v +++ b/vlib/gx/gx.v @@ -48,7 +48,7 @@ pub const ( ) pub const ( - ALIGN_LEFT = 1 + align_left = 1 ALIGN_RIGHT = 4 ) diff --git a/vlib/v/checker/checker.v b/vlib/v/checker/checker.v index 8ac086051d..721fbc31f4 100644 --- a/vlib/v/checker/checker.v +++ b/vlib/v/checker/checker.v @@ -11,7 +11,7 @@ import ( ) const ( - max_nr_errors = 100 + max_nr_errors = 300 ) pub struct Checker { diff --git a/vlib/v/gen/cgen.v b/vlib/v/gen/cgen.v index 20612056b0..88e75e2290 100644 --- a/vlib/v/gen/cgen.v +++ b/vlib/v/gen/cgen.v @@ -790,9 +790,9 @@ fn (g mut Gen) gen_fn_decl(it ast.FnDecl) { g.writeln('free(_const_os__args.data); // empty, inited in _vinit()') } $if windows { - g.writeln('_const_os__args = os__init_os_args(argc, (byteptr*)argv);') - } $else { g.writeln('_const_os__args = os__init_os_args_wide(argc, (byteptr*)argv);') + } $else { + g.writeln('_const_os__args = os__init_os_args(argc, (byteptr*)argv);') } } }