I've done the prod build and it says me this ^^ so I was told to create this issue I hope I've put here everything ^^
(I'm on windows)
import spytheman.vperlin as perlin
import gg
import gx
//import math as m
const (
win_width = 601
win_height = 601
bg_color = gx.black
colour = gx.black
player_size = 8
tiles_number = 75
tiles_size = 8
world_size = tiles_size * tiles_number
)
struct Grass{
mut:
coords struct {
x int
y int
}
}
struct App {
mut:
gg &gg.Context = unsafe { nil }
mouse struct {
mut:
x f32
y f32
}
grass_list []Grass = []Grass{}
player_loc []int = [(tiles_number*tiles_size)/2 + 1, (tiles_number*tiles_size)/2 + 1]
}
fn main() {
mut app := &App{
gg: 0
}
app.gg = gg.new_context(
width: win_width
height: win_height
create_window: true
window_title: 'Tests'
user_data: app
bg_color: bg_color
frame_fn: on_frame
event_fn: on_event
)
generate_grass(mut app)
app.gg.run()
}
fn generate_grass(mut app App){
for x in 0..tiles_number{
for y in 0..tiles_number{
match true {
(perlin_noise_manager(x, y, 0.0, 0.0, 25, 4.5)) > 0.450 {app.grass_list << Grass{coords: struct{x*tiles_size+1 y*tiles_size+1}}}
else{}
}
}
}
}
// Perlin noise manager: /!\ dont create negative inputs in the perlin.noise2d function /!\
// It's used to output an integer on the perlin noise height map.
// The X and Y coordinates (the two first variables) are the coordinates that you input for exemple {2.0, 3.0}
// The X and Y offsets are here to allow a "seed" to "change" the terrain that you generate
// The X and Y dividers are here to scale the map when you put some small dividers the 'movement' in the map is faster so it scales down the output and when you put some big dividers the movement is slower so it scales the map up ^^
// Hope that it helped ^^
fn perlin_noise_manager(x_coord f32, y_coord f32, x_offset f32, y_offset f32, x_divider f32, y_divider f32) f64{
return perlin.noise2d((x_coord + x_offset)/x_divider, (y_coord + y_offset)/y_divider)
}
fn on_frame(mut app App) {
app.gg.begin()
app.gg.draw_text_def(250, 10, 'Player coords : ${app.player_loc}')
for grass in app.grass_list{
app.gg.draw_square_empty(grass.coords.x, grass.coords.y, tiles_size, gx.rgb(121, 199, 101))
}
app.gg.draw_square_empty(app.player_loc[0], app.player_loc[1], player_size, gx.rgb(97, 244, 255))
app.gg.end()
}
fn on_event(e &gg.Event, mut app App) {
match e.typ {
.key_down {
match e.key_code {
.escape {
app.gg.quit()
}
.right {
if app.player_loc[0] < world_size+1{app.player_loc[0] += tiles_size}
}
.left {
if app.player_loc[0] > 1 {app.player_loc[0] -= tiles_size}
}
.down {
if app.player_loc[1] < world_size+1{app.player_loc[1] += tiles_size}
}
.up {
if app.player_loc[1] > 1 {app.player_loc[1] -= tiles_size}
}
else {}
}
}
.mouse_move {
app.mouse.x = e.mouse_x
app.mouse.y = e.mouse_y
}
else {}
}
}
I've done the prod build and it says me this ^^ so I was told to create this issue I hope I've put here everything ^^ (I'm on windows)