diff --git a/examples/game_of_life/life_gg.v b/examples/game_of_life/life_gg.v index 2b3768228e..7b1e8e9b43 100644 --- a/examples/game_of_life/life_gg.v +++ b/examples/game_of_life/life_gg.v @@ -10,7 +10,7 @@ const ( filled_color = gx.blue ) -fn new_graphics() &gg.GG { +fn new_graphics() &gg.Context { glfw.init_glfw() return gg.new_context(gg.Cfg{ width: screen_width diff --git a/examples/gg/gg2.v b/examples/gg/gg2.v index e4ba99b0fa..cc777c9f8c 100644 --- a/examples/gg/gg2.v +++ b/examples/gg/gg2.v @@ -11,7 +11,7 @@ const ( struct App { mut: - gg &gg.GG + gg &gg.Context } fn main() { diff --git a/examples/gg/gg_freetype.v b/examples/gg/gg_freetype.v index 4689241753..fbe2ddc73e 100644 --- a/examples/gg/gg_freetype.v +++ b/examples/gg/gg_freetype.v @@ -61,7 +61,7 @@ lines = text.split('\n') struct App { mut: - gg &gg.GG + gg &gg.Context ft &ft.FT } diff --git a/examples/hot_reload/bounce.v b/examples/hot_reload/bounce.v index 957eefe39f..98e2202fc2 100644 --- a/examples/hot_reload/bounce.v +++ b/examples/hot_reload/bounce.v @@ -8,7 +8,7 @@ import time struct Game { mut: - gg &gg.GG + gg &gg.Context x int y int dy int diff --git a/examples/hot_reload/graph.v b/examples/hot_reload/graph.v index 1e22329681..74c984cb17 100644 --- a/examples/hot_reload/graph.v +++ b/examples/hot_reload/graph.v @@ -13,7 +13,7 @@ const ( ) struct Context { - gg &gg.GG + gg &gg.Context } fn main() { diff --git a/examples/tetris/tetris.v b/examples/tetris/tetris.v index 47b957aeae..702d55889a 100644 --- a/examples/tetris/tetris.v +++ b/examples/tetris/tetris.v @@ -126,7 +126,7 @@ struct Game { // Index of the rotation (0-3) rotation_idx int // gg context for drawing - gg &gg.GG = voidptr(0) + gg &gg.Context = voidptr(0) // ft context for font drawing ft &ft.FT = voidptr(0) font_loaded bool diff --git a/vlib/builtin/float.v b/vlib/builtin/float.v index 1418aab8eb..e52e0ffa19 100644 --- a/vlib/builtin/float.v +++ b/vlib/builtin/float.v @@ -124,7 +124,7 @@ fn f64_min(a, b f64) f64 { } [inline] -fn (a f32) eq_epsilon(b f32) bool { +pub fn (a f32) eq_epsilon(b f32) bool { hi := f32_max(f32_abs(a), f32_abs(b)) delta := f32_abs(a - b) if hi > f32(1.0) { @@ -135,7 +135,7 @@ fn (a f32) eq_epsilon(b f32) bool { } [inline] -fn (a f64) eq_epsilon(b f64) bool { +pub fn (a f64) eq_epsilon(b f64) bool { hi := f64_max(f64_abs(a), f64_abs(b)) delta := f64_abs(a - b) if hi > 1.0 { diff --git a/vlib/builtin/js/builtin.v b/vlib/builtin/js/builtin.v index 130777bf83..d5be73abbe 100644 --- a/vlib/builtin/js/builtin.v +++ b/vlib/builtin/js/builtin.v @@ -13,4 +13,4 @@ pub fn println(s any) { pub fn print(s any) { JS.process.stdout.write(s) -} \ No newline at end of file +} diff --git a/vlib/gg/gg.v b/vlib/gg/gg.v index 2a59db918b..1f3fd1d109 100644 --- a/vlib/gg/gg.v +++ b/vlib/gg/gg.v @@ -9,7 +9,7 @@ import sokol import sokol.sapp import sokol.sgl import sokol.gfx -import gg.ft +//import gg.ft type FNvoidptr1 fn(voidptr) type FNvoidptr2 fn(voidptr,voidptr) @@ -40,7 +40,7 @@ pub: font_path string } -pub struct GG { +pub struct Context { scale f32 = 1.0// retina = 2 , normal = 1 pub mut: width int @@ -53,7 +53,7 @@ pub mut: pub struct Size { pub: width int height int } fn gg_init_sokol_window(user_data voidptr) { - mut g := &GG(user_data) + mut g := &Context(user_data) desc := C.sg_desc{ mtl_device: sapp.metal_get_device() mtl_renderpass_descriptor_cb: sapp.metal_get_renderpass_descriptor @@ -72,28 +72,28 @@ fn gg_init_sokol_window(user_data voidptr) { } fn gg_frame_fn(user_data voidptr) { - mut g := &GG(user_data) + mut g := &Context(user_data) if g.config.frame_fn != voidptr(0) { g.config.frame_fn( g.config.user_data ) } } fn gg_event_fn(e &C.sapp_event, user_data voidptr){ - mut g := &GG(user_data) + mut g := &Context(user_data) if g.config.event_fn != voidptr(0) { g.config.event_fn(e, g.config.user_data) } } fn gg_cleanup_fn(user_data voidptr){ - mut g := &GG(user_data) + mut g := &Context(user_data) if g.config.cleanup_fn != voidptr(0) { g.config.cleanup_fn(g.config.user_data) } } fn gg_fail_fn(msg charptr, user_data voidptr){ - mut g := &GG(user_data) + mut g := &Context(user_data) vmsg := tos3(msg) if g.config.fail_fn != voidptr(0) { g.config.fail_fn(vmsg, g.config.user_data) @@ -104,8 +104,8 @@ fn gg_fail_fn(msg charptr, user_data voidptr){ // -pub fn new_context(cfg Config) &GG { - mut g := &GG{ +pub fn new_context(cfg Config) &Context{ + mut g := &Context{ width: cfg.width height: cfg.height clear_pass: gfx.create_clear_pass( f32(cfg.bg_color.r) / 255.0, f32(cfg.bg_color.g) / 255.0, @@ -136,11 +136,11 @@ f32(cfg.bg_color.b) / 255.0, 1.0) return g } -pub fn (gg &GG) run() { +pub fn (gg &Context) run() { sapp.run(&gg.window) } -pub fn (ctx &GG) draw_rect(x, y, w, h f32, c gx.Color) { +pub fn (ctx &Context) draw_rect(x, y, w, h f32, c gx.Color) { sgl.c4b(c.r, c.g, c.b, 128) sgl.begin_quads() sgl.v2f(x * ctx.scale, y * ctx.scale) @@ -150,7 +150,7 @@ pub fn (ctx &GG) draw_rect(x, y, w, h f32, c gx.Color) { sgl.end() } -pub fn (gg &GG) draw_empty_rect(x, y, w, h f32, c gx.Color) { +pub fn (gg &Context) draw_empty_rect(x, y, w, h f32, c gx.Color) { sgl.c4b(c.r, c.g, c.b, 128) sgl.begin_line_strip() sgl.v2f(x, y) @@ -179,13 +179,13 @@ pub fn create_image_from_memory(buf byteptr) u32 { return 0 // texture } -pub fn (gg &GG) begin() { +pub fn (gg &Context) begin() { sgl.defaults() sgl.matrix_mode_projection() sgl.ortho(0.0, f32(sapp.width()), f32(sapp.height()), 0.0, -1.0, 1.0) } -pub fn (gg &GG) end() { +pub fn (gg &Context) end() { gfx.begin_default_pass(gg.clear_pass, sapp.width(), sapp.height()) sgl.draw() gfx.end_pass() @@ -196,7 +196,7 @@ pub fn (gg &GG) end() { } } -pub fn (ctx &GG) draw_line(x, y, x2, y2 f32, color gx.Color) {} +pub fn (ctx &Context) draw_line(x, y, x2, y2 f32, color gx.Color) {} fn C.WaitMessage() diff --git a/vlib/math/fractions/approximations_test.v b/vlib/math/fractions/approximations_test.v index af1406071b..f688cc76f0 100644 --- a/vlib/math/fractions/approximations_test.v +++ b/vlib/math/fractions/approximations_test.v @@ -177,4 +177,4 @@ fn test_phi_11_digits() { fn test_phi_12_digits() { assert fractions.approximate_with_eps(math.phi, 5.0e-13).equals(fractions.fraction(2178309, 1346269)) -} \ No newline at end of file +} diff --git a/vlib/math/fractions/fraction_test.v b/vlib/math/fractions/fraction_test.v index afaeb2c7ae..d84579960e 100644 --- a/vlib/math/fractions/fraction_test.v +++ b/vlib/math/fractions/fraction_test.v @@ -266,4 +266,4 @@ fn test_49_by_75_not_greater_than_2_by_3() { f2 := fractions.fraction(2, 3) assert !f1.gt(f2) assert !f1.ge(f2) -} \ No newline at end of file +} diff --git a/vlib/net/websocket/logger/logger.v b/vlib/net/websocket/logger/logger.v index ad3768074b..db053e8948 100644 --- a/vlib/net/websocket/logger/logger.v +++ b/vlib/net/websocket/logger/logger.v @@ -53,4 +53,4 @@ pub fn (l &Logger) s(message string) { fn (l &Logger) print(mod, message string) { println('${colors[mod]};7m[${mod}]\e[0m \e[1m${l.mod}\e[0m: ${message}') -} \ No newline at end of file +} diff --git a/vlib/os/const_windows.c.v b/vlib/os/const_windows.c.v index fba66a8685..8bb704a2dc 100644 --- a/vlib/os/const_windows.c.v +++ b/vlib/os/const_windows.c.v @@ -136,4 +136,4 @@ const ( status_stack_buffer_overrun = 0xC0000409 status_invalid_cruntime_parameter = 0xC0000417 status_assertion_failure = 0xC0000420 -) \ No newline at end of file +) diff --git a/vlib/rand/system_rng.js.v b/vlib/rand/system_rng.js.v index 223ab3a0ac..833ba81596 100644 --- a/vlib/rand/system_rng.js.v +++ b/vlib/rand/system_rng.js.v @@ -12,4 +12,4 @@ type SysRNG WyRandRNG [inline] pub fn (r SysRNG) default_rand() int { return r.int() -} \ No newline at end of file +} diff --git a/vlib/v/builder/js.v b/vlib/v/builder/js.v index 715e93a0a9..2ba4d587d8 100644 --- a/vlib/v/builder/js.v +++ b/vlib/v/builder/js.v @@ -56,4 +56,4 @@ fn (mut b Builder) run_js() { return } println(res.output) -} \ No newline at end of file +} diff --git a/vlib/v/gen/js/tests/hello/hello.js.v b/vlib/v/gen/js/tests/hello/hello.js.v index 4216b86b41..0b3fe40a08 100644 --- a/vlib/v/gen/js/tests/hello/hello.js.v +++ b/vlib/v/gen/js/tests/hello/hello.js.v @@ -2,4 +2,4 @@ module hello pub fn raw_js_log() { #console.log('hello') -} \ No newline at end of file +} diff --git a/vlib/v/gen/js/tests/hello/hello.v b/vlib/v/gen/js/tests/hello/hello.v index 8950384c6f..e1ad262087 100644 --- a/vlib/v/gen/js/tests/hello/hello.v +++ b/vlib/v/gen/js/tests/hello/hello.v @@ -28,4 +28,4 @@ pub fn debugger() string { pub fn excited() string { return debugger() + "!" -} \ No newline at end of file +} diff --git a/vlib/v/tests/pointers_test.v b/vlib/v/tests/pointers_test.v index 9cc250b080..a4cb372047 100644 --- a/vlib/v/tests/pointers_test.v +++ b/vlib/v/tests/pointers_test.v @@ -24,4 +24,4 @@ fn test_multi_level_pointer_dereferencing() { } assert n == 300 // updated by the unsafe pointer manipulation } -*/ \ No newline at end of file +*/