/// @description 

#macro GAME_NAME "ASHSTRIKE"

#macro WIN_WIDTH 160
#macro WIN_HEIGHT 144

#macro vec2_x 0
#macro vec2_y 1

#macro BLOCK_WIDTH 8
#macro BLOCK_HEIGHT 8

#macro PATH_DATA (working_directory + "data/")

randomize();

font_default = font_add_sprite(spr_font_default, ord("!"), false, 1);
font_small = font_add_sprite(spr_font_small, ord("0"), true, 1);
#macro CH_DMG ":"
#macro CH_TIME ";"
#macro CH_RANGE "<"
#macro CH_PLUS "="

enum GAME_STATE {
	GAME,
	MENU,
	VICTORY,
	GAME_OVER
};
game_over = 0;

draw_set_color(c_white);
draw_set_font(font_default);

window_set_caption("GameBoy");
application_surface_draw_enable(false);

sc_init_keys();
sc_init_turrets();
sc_init_enemies();
sc_init_audio();
sc_init_levels();
global.music_current = gpmusic[MUSIC.MENU];
sc_music_change(global.music_current);
sc_init_menu();
sc_menu_load(game_menu);
global.game_state = GAME_STATE.MENU;

global.victory_surf = 0;

sc_init_stats();
global.level_cur = 1;

global.camera_x = 0;
global.camera_y = 0;

global.win_scale = 1;
global.win_scale_max = 1;

var _border = 100;
var _scr_w = display_get_width() - _border;
var _scr_h = display_get_height() - _border;

for(var i = 2; i < 10; i++) {
	var _game_w = WIN_WIDTH * i;
	var _game_h = WIN_HEIGHT * i;
  
	if (_game_w < _scr_w && _game_h < _scr_h)
		global.win_scale_max++;
	else
		break;
}

display_set_gui_size(WIN_WIDTH, WIN_HEIGHT);
surface_resize(application_surface, WIN_WIDTH, WIN_HEIGHT);
sc_refresh_window(global.win_scale_max);

global.pal_enable = true;
pal_black = shader_get_uniform(shd_palette, "u_vNewBlack");
pal_dkgray = shader_get_uniform(shd_palette, "u_vNewDkGray");
pal_gray = shader_get_uniform(shd_palette, "u_vNewGray");
pal_white = shader_get_uniform(shd_palette, "u_vNewWhite");

npal_black = [];
npal_dkgray = [];
npal_gray = [];
npal_white = [];

pal_cur = 1;
sc_palette_swap(pal_cur);

turret_shop = false;
shop_cur = 0;