local anim = require("pxl8.anim")
local bytes = require("pxl8.bytes")
local core = require("pxl8.core")
local gfx2d = require("pxl8.gfx2d")
local gfx3d = require("pxl8.gfx3d")
local gui = require("pxl8.gui")
local input = require("pxl8.input")
local math = require("pxl8.math")
local net = require("pxl8.net")
local particles = require("pxl8.particles")
local procgen = require("pxl8.procgen")
local sfx = require("pxl8.sfx")
local tilemap = require("pxl8.tilemap")
local transition = require("pxl8.transition")
local world = require("pxl8.world")
local pxl8 = {}

core.init(pxl8_gfx, pxl8_input, pxl8_rng, pxl8_sfx, pxl8_sys)

pxl8.get_fps = core.get_fps
pxl8.get_height = core.get_height
pxl8.get_title = core.get_title
pxl8.get_width = core.get_width
pxl8.info = core.info
pxl8.warn = core.warn
pxl8.error = core.error
pxl8.debug = core.debug
pxl8.trace = core.trace
pxl8.quit = core.quit

pxl8.hash32 = math.hash32
pxl8.rng_f32 = core.rng_f32
pxl8.rng_next = core.rng_next
pxl8.rng_range = core.rng_range
pxl8.rng_seed = core.rng_seed

pxl8.find_color = core.find_color
pxl8.palette_color = core.palette_color
pxl8.palette_index = core.palette_index
pxl8.ramp_index = core.ramp_index
pxl8.set_colormap = core.set_colormap
pxl8.set_palette = core.set_palette
pxl8.set_palette_rgb = core.set_palette_rgb
pxl8.update_palette_deps = core.update_palette_deps

pxl8.clear = gfx2d.clear
pxl8.pixel = gfx2d.pixel
pxl8.line = gfx2d.line
pxl8.rect = gfx2d.rect
pxl8.rect_fill = gfx2d.rect_fill
pxl8.circle = gfx2d.circle
pxl8.circle_fill = gfx2d.circle_fill
pxl8.text = gfx2d.text
pxl8.sprite = gfx2d.sprite
pxl8.load_palette = gfx2d.load_palette
pxl8.load_sprite = gfx2d.load_sprite
pxl8.create_texture = gfx2d.create_texture
pxl8.gfx_color_ramp = gfx2d.color_ramp
pxl8.gfx_fade_palette = gfx2d.fade_palette
pxl8.gfx_cycle_palette = gfx2d.cycle_palette
pxl8.add_palette_cycle = gfx2d.add_palette_cycle
pxl8.remove_palette_cycle = gfx2d.remove_palette_cycle
pxl8.set_palette_cycle_speed = gfx2d.set_palette_cycle_speed
pxl8.clear_palette_cycles = gfx2d.clear_palette_cycles

pxl8.key_down = input.key_down
pxl8.key_pressed = input.key_pressed
pxl8.key_released = input.key_released
pxl8.mouse_dx = input.mouse_dx
pxl8.mouse_dy = input.mouse_dy
pxl8.mouse_wheel_x = input.mouse_wheel_x
pxl8.mouse_wheel_y = input.mouse_wheel_y
pxl8.mouse_x = input.mouse_x
pxl8.mouse_y = input.mouse_y
pxl8.get_mouse_pos = input.get_mouse_pos
pxl8.mouse_pressed = input.mouse_pressed
pxl8.mouse_released = input.mouse_released
pxl8.center_cursor = input.center_cursor
pxl8.set_cursor = input.set_cursor
pxl8.set_relative_mouse_mode = input.set_relative_mouse_mode

pxl8.Anim = anim.Anim
pxl8.create_anim = anim.Anim.new
pxl8.create_anim_from_ase = anim.Anim.from_ase

pxl8.bounds = math.bounds

pxl8.Camera3D = gfx3d.Camera3D
pxl8.create_camera_3d = gfx3d.Camera3D.new
pxl8.begin_frame_3d = gfx3d.begin_frame
pxl8.clear_3d = gfx3d.clear
pxl8.clear_depth = gfx3d.clear_depth
pxl8.draw_line_3d = gfx3d.draw_line
pxl8.draw_mesh = gfx3d.draw_mesh
pxl8.end_frame_3d = gfx3d.end_frame
pxl8.Mesh = gfx3d.Mesh
pxl8.create_mesh = gfx3d.Mesh.new

pxl8.Compressor = sfx.Compressor
pxl8.create_compressor = sfx.Compressor.new
pxl8.Delay = sfx.Delay
pxl8.create_delay = sfx.Delay.new
pxl8.Reverb = sfx.Reverb
pxl8.create_reverb = sfx.Reverb.new

pxl8.Gui = gui.Gui
pxl8.create_gui = gui.Gui.new
pxl8.gui_label = gui.label
pxl8.gui_window = gui.window

pxl8.mat4_identity = math.mat4_identity
pxl8.mat4_lookat = math.mat4_lookat
pxl8.mat4_multiply = math.mat4_multiply
pxl8.mat4_ortho = math.mat4_ortho
pxl8.mat4_perspective = math.mat4_perspective
pxl8.mat4_rotate_x = math.mat4_rotate_x
pxl8.mat4_rotate_y = math.mat4_rotate_y
pxl8.mat4_rotate_z = math.mat4_rotate_z
pxl8.mat4_scale = math.mat4_scale
pxl8.mat4_translate = math.mat4_translate

pxl8.Net = net.Net
pxl8.create_net = net.Net.new
pxl8.NET_MODE_LOCAL = net.MODE_LOCAL
pxl8.NET_MODE_REMOTE = net.MODE_REMOTE

pxl8.pack_f32_be = bytes.pack_f32_be
pxl8.pack_f32_le = bytes.pack_f32_le
pxl8.pack_f64_be = bytes.pack_f64_be
pxl8.pack_f64_le = bytes.pack_f64_le
pxl8.pack_i8 = bytes.pack_i8
pxl8.pack_i16_be = bytes.pack_i16_be
pxl8.pack_i16_le = bytes.pack_i16_le
pxl8.pack_i32_be = bytes.pack_i32_be
pxl8.pack_i32_le = bytes.pack_i32_le
pxl8.pack_i64_be = bytes.pack_i64_be
pxl8.pack_i64_le = bytes.pack_i64_le
pxl8.pack_u8 = bytes.pack_u8
pxl8.pack_u16_be = bytes.pack_u16_be
pxl8.pack_u16_le = bytes.pack_u16_le
pxl8.pack_u32_be = bytes.pack_u32_be
pxl8.pack_u32_le = bytes.pack_u32_le
pxl8.pack_u64_be = bytes.pack_u64_be
pxl8.pack_u64_le = bytes.pack_u64_le

pxl8.Particles = particles.Particles
pxl8.create_particles = particles.Particles.new

pxl8.Graph = procgen.Graph
pxl8.create_graph = procgen.create_graph
pxl8.PROCGEN_ROOMS = world.PROCGEN_ROOMS
pxl8.PROCGEN_TERRAIN = world.PROCGEN_TERRAIN

pxl8.SfxContext = sfx.SfxContext
pxl8.SfxNode = sfx.SfxNode
pxl8.create_sfx_context = sfx.SfxContext.new
pxl8.sfx_get_master_volume = sfx.get_master_volume
pxl8.sfx_note_to_freq = sfx.note_to_freq
pxl8.sfx_set_master_volume = sfx.set_master_volume
pxl8.sfx_voice_params = sfx.voice_params

pxl8.SFX_FILTER_BANDPASS = sfx.FILTER_BANDPASS
pxl8.SFX_FILTER_HIGHPASS = sfx.FILTER_HIGHPASS
pxl8.SFX_FILTER_LOWPASS = sfx.FILTER_LOWPASS
pxl8.SFX_FILTER_NONE = sfx.FILTER_NONE
pxl8.SFX_LFO_AMPLITUDE = sfx.LFO_AMPLITUDE
pxl8.SFX_LFO_FILTER = sfx.LFO_FILTER
pxl8.SFX_LFO_PITCH = sfx.LFO_PITCH
pxl8.SFX_NODE_COMPRESSOR = sfx.NODE_COMPRESSOR
pxl8.SFX_NODE_DELAY = sfx.NODE_DELAY
pxl8.SFX_NODE_REVERB = sfx.NODE_REVERB
pxl8.SFX_WAVE_NOISE = sfx.WAVE_NOISE
pxl8.SFX_WAVE_PULSE = sfx.WAVE_PULSE
pxl8.SFX_WAVE_SAW = sfx.WAVE_SAW
pxl8.SFX_WAVE_SINE = sfx.WAVE_SINE
pxl8.SFX_WAVE_SQUARE = sfx.WAVE_SQUARE
pxl8.SFX_WAVE_TRIANGLE = sfx.WAVE_TRIANGLE

pxl8.TILE_FLIP_X = tilemap.TILE_FLIP_X
pxl8.TILE_FLIP_Y = tilemap.TILE_FLIP_Y
pxl8.TILE_SOLID = tilemap.TILE_SOLID
pxl8.TILE_TRIGGER = tilemap.TILE_TRIGGER
pxl8.Tilemap = tilemap.Tilemap
pxl8.create_tilemap = tilemap.Tilemap.new
pxl8.Tilesheet = tilemap.Tilesheet
pxl8.create_tilesheet = tilemap.Tilesheet.new

pxl8.Transition = transition.Transition
pxl8.create_transition = transition.Transition.new
pxl8.TRANSITION_TYPES = transition.TYPES

pxl8.unpack_f32_be = bytes.unpack_f32_be
pxl8.unpack_f32_le = bytes.unpack_f32_le
pxl8.unpack_f64_be = bytes.unpack_f64_be
pxl8.unpack_f64_le = bytes.unpack_f64_le
pxl8.unpack_i8 = bytes.unpack_i8
pxl8.unpack_i16_be = bytes.unpack_i16_be
pxl8.unpack_i16_le = bytes.unpack_i16_le
pxl8.unpack_i32_be = bytes.unpack_i32_be
pxl8.unpack_i32_le = bytes.unpack_i32_le
pxl8.unpack_i64_be = bytes.unpack_i64_be
pxl8.unpack_i64_le = bytes.unpack_i64_le
pxl8.unpack_u8 = bytes.unpack_u8
pxl8.unpack_u16_be = bytes.unpack_u16_be
pxl8.unpack_u16_le = bytes.unpack_u16_le
pxl8.unpack_u32_be = bytes.unpack_u32_be
pxl8.unpack_u32_le = bytes.unpack_u32_le
pxl8.unpack_u64_be = bytes.unpack_u64_be
pxl8.unpack_u64_le = bytes.unpack_u64_le

pxl8.World = world.World
pxl8.create_world = world.World.new

return pxl8
