mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
make v build-examples work: part 1
This commit is contained in:
parent
78f8a8aee6
commit
4e51867612
@ -233,7 +233,7 @@ pub fn v_build_failing_skipped(zargs string, folder string, skipped []string) bo
|
||||
mut mains := []string{}
|
||||
for f in files {
|
||||
if !f.contains('modules') && !f.contains('preludes') {
|
||||
if f.contains('/vweb/') {
|
||||
if f.contains('/vweb/') || f.contains('/pg/') || f.contains('rune.v') {
|
||||
continue
|
||||
|
||||
}
|
||||
|
@ -8,6 +8,6 @@ fn main(){
|
||||
some_module.do_work()
|
||||
}
|
||||
|
||||
fn on_error(sender voidptr, e &some_module.Error) {
|
||||
fn on_error(sender voidptr, e &some_module.Error, x voidptr) {
|
||||
println(e.message)
|
||||
}
|
||||
|
@ -46,9 +46,9 @@ fn new_automaton(f [][]int) Automaton {
|
||||
maxx = f[y].len
|
||||
}
|
||||
}
|
||||
size := u32(maxx * maxy)
|
||||
field := &A2D{ maxx: maxx maxy: maxy data: &int( vcalloc( sizeof(int) * size ) ) }
|
||||
new_field := &A2D{ maxx: maxx maxy: maxy data: &int( vcalloc( sizeof(int) * size) ) }
|
||||
size := (maxx * maxy)
|
||||
field := &A2D{ maxx: maxx maxy: maxy data: &int( vcalloc( 4 * (size) ) ) }
|
||||
new_field := &A2D{ maxx: maxx maxy: maxy data: &int( vcalloc( 4 * (size)) ) }
|
||||
for y in 0..field.maxy {
|
||||
for x in 0..field.maxx {
|
||||
field.set( x, y, f[y][x] )
|
||||
|
@ -101,7 +101,7 @@ fn main() {
|
||||
}
|
||||
}
|
||||
|
||||
fn (ctx Context) draw() {
|
||||
fn (mut ctx Context) draw() {
|
||||
mut y := 10
|
||||
for line in lines {
|
||||
ctx.ft.draw_text_def(10,y, line)
|
||||
|
@ -34,9 +34,9 @@ pub mut:
|
||||
|
||||
fn advance(sys mut System, dt f64) {
|
||||
for i in 0..c_n - 1 {
|
||||
mut _vx := sys.v[i].x
|
||||
mut _vy := sys.v[i].y
|
||||
mut _vz := sys.v[i].z
|
||||
mut vx := sys.v[i].x
|
||||
mut vy := sys.v[i].y
|
||||
mut vz := sys.v[i].z
|
||||
|
||||
for j := i + 1; j < c_n; j++ {
|
||||
dx := sys.s[i].x - sys.s[j].x
|
||||
@ -48,17 +48,17 @@ fn advance(sys mut System, dt f64) {
|
||||
mag := (dt / (dsquared * distance))
|
||||
mi := sys.v[i].m
|
||||
|
||||
_vx -= dx * sys.v[j].m * mag
|
||||
_vy -= dy * sys.v[j].m * mag
|
||||
_vz -= dz * sys.v[j].m * mag
|
||||
vx -= dx * sys.v[j].m * mag
|
||||
vy -= dy * sys.v[j].m * mag
|
||||
vz -= dz * sys.v[j].m * mag
|
||||
|
||||
sys.v[j].x += dx * mi * mag
|
||||
sys.v[j].y += dy * mi * mag
|
||||
sys.v[j].z += dz * mi * mag
|
||||
}
|
||||
sys.v[i].x = _vx
|
||||
sys.v[i].y = _vy
|
||||
sys.v[i].z = _vz
|
||||
sys.v[i].x = vx
|
||||
sys.v[i].y = vy
|
||||
sys.v[i].z = vz
|
||||
}
|
||||
|
||||
for i in 0..c_n {
|
||||
@ -108,7 +108,7 @@ fn arr_momentum() []Momentum {
|
||||
]
|
||||
}
|
||||
|
||||
pub fn arr_position() []Position {
|
||||
fn arr_position() []Position {
|
||||
return [
|
||||
Position {0.0, 0.0, 0.0},
|
||||
Position {4.84143144246472090e+00, -1.16032004402742839e+00, -1.03622044471123109e-01},
|
||||
|
@ -7,7 +7,7 @@ const (
|
||||
)
|
||||
|
||||
fn main() {
|
||||
rand.seed(time.now().unix)
|
||||
rand.seed(int(time.now().unix))
|
||||
rand.next(gen_max) // skip the first
|
||||
mut arr := []int{}
|
||||
for _ in 0..gen_len {
|
||||
|
@ -136,7 +136,7 @@ fn (state &AppState) render_font() {
|
||||
C.fonsSetColor(state.fons, white)
|
||||
dx = 50
|
||||
dy = 350
|
||||
line(dx - 10, dy, dx + 250, dy)
|
||||
line(f32(dx - 10), f32(dy), f32(dx + 250), f32(dy))
|
||||
C.fonsSetAlign(state.fons, C.FONS_ALIGN_LEFT | C.FONS_ALIGN_TOP)
|
||||
dx = C.fonsDrawText(state.fons, dx, dy, c'Top', C.NULL)
|
||||
dx += 10
|
||||
@ -150,7 +150,7 @@ fn (state &AppState) render_font() {
|
||||
C.fonsDrawText(state.fons, dx, dy, c'Bottom', C.NULL)
|
||||
dx = 150
|
||||
dy = 400
|
||||
line(dx, dy - 30, dx, dy + 80.0)
|
||||
line(f32(dx), f32(dy - 30), f32(dx), f32(dy + 80.0))
|
||||
C.fonsSetAlign(state.fons, C.FONS_ALIGN_LEFT | C.FONS_ALIGN_BASELINE)
|
||||
C.fonsDrawText(state.fons, dx, dy, c'Left', C.NULL)
|
||||
dy += 30
|
||||
|
@ -1,4 +1,4 @@
|
||||
fn println(s string) { }
|
||||
//fn println(s string) { }
|
||||
|
||||
//fn test_fn() {
|
||||
//println('test fn')
|
||||
|
Loading…
Reference in New Issue
Block a user