mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
all: unify const names to snake_case
This commit is contained in:
@@ -7,8 +7,8 @@ import glfw
|
||||
import math
|
||||
|
||||
const (
|
||||
Size = 700
|
||||
Scale = 50.0
|
||||
size = 700
|
||||
scale = 50.0
|
||||
pi = math.pi
|
||||
)
|
||||
|
||||
@@ -19,8 +19,8 @@ struct Context {
|
||||
fn main() {
|
||||
glfw.init_glfw()
|
||||
gconfig := gg.Cfg {
|
||||
width: Size
|
||||
height: Size
|
||||
width: size
|
||||
height: size
|
||||
use_ortho: true
|
||||
create_window: true
|
||||
window_title: 'Graph builder'
|
||||
@@ -41,9 +41,9 @@ fn main() {
|
||||
|
||||
[live]
|
||||
fn (ctx &Context) draw() {
|
||||
center := f64(Size / 2)
|
||||
ctx.gg.draw_line(0, center, Size, center, gx.gray) // x axis
|
||||
ctx.gg.draw_line(center, 0, center, Size, gx.gray) // y axis
|
||||
center := f64(size / 2)
|
||||
ctx.gg.draw_line(0, center, size, center, gx.gray) // x axis
|
||||
ctx.gg.draw_line(center, 0, center, size, gx.gray) // y axis
|
||||
atime := f64( time.ticks() / 10 )
|
||||
stime := math.sin( 2.0 * pi * f64( time.ticks() % 6000 ) / 6000 )
|
||||
mut y := 0.0
|
||||
@@ -58,8 +58,8 @@ fn (ctx &Context) draw() {
|
||||
//y = (x + 3) * (x + 3) / stime + stime*2.5
|
||||
//y = math.sqrt(30.0 - x * x) * stime
|
||||
//y -= (stime-0.5) + stime
|
||||
ctx.gg.draw_rect(center + x * Scale, center - y * Scale, 1, 1, gx.Blue)
|
||||
ctx.gg.draw_rect(center + x * Scale, center + y * Scale, 1, 1, gx.Red)
|
||||
ctx.gg.draw_rect(center + x * scale, center - y * scale, 1, 1, gx.blue)
|
||||
ctx.gg.draw_rect(center + x * scale, center + y * scale, 1, 1, gx.red)
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user