82 lines
2.4 KiB
Java
82 lines
2.4 KiB
Java
package shootergame;
|
|
|
|
import java.util.Random;
|
|
|
|
import javax.swing.text.html.parser.Entity;
|
|
|
|
import mainloop.manager.MainloopManager;
|
|
import shootergame.audio.AudioEngine;
|
|
import shootergame.audio.AudioSources;
|
|
import shootergame.cheats.Cheats;
|
|
import shootergame.display.DisplayStatsEventHandler;
|
|
import shootergame.display.DisplayWindow;
|
|
import shootergame.entity.EntityEventHandler;
|
|
import shootergame.entity.EntityZombie;
|
|
import shootergame.entity.player.EntityPlayer;
|
|
import shootergame.init.Entities;
|
|
import shootergame.init.Resources;
|
|
import shootergame.init.Sounds;
|
|
import shootergame.init.Textures;
|
|
import shootergame.input.JoystickCallback;
|
|
import shootergame.mainloop.MainloopEventHandler;
|
|
import shootergame.resources.Resource;
|
|
import shootergame.util.math.MathHelpers;
|
|
import shootergame.util.math.vec.Vec2i;
|
|
import shootergame.util.math.vec.Vec3d;
|
|
import shootergame.world.World;
|
|
import shootergame.world.chunk.ChunkEventHandler;
|
|
import shootergame.world.layer.layergen.LayerGenCaves;
|
|
import shootergame.world.layer.layergen.LayerGenEarth;
|
|
|
|
public class Main
|
|
{
|
|
public static MainloopManager mainloop;
|
|
public static DisplayWindow window;
|
|
public static EntityPlayer player = new EntityPlayer();
|
|
public static World world;
|
|
public static AudioEngine audio;
|
|
|
|
public static void main(String[] args)
|
|
{
|
|
// Initialize the cheats
|
|
Cheats.init(args);
|
|
|
|
// Load the resources
|
|
Resources.loadResources();
|
|
|
|
// Initialize the sound engine
|
|
audio = new AudioEngine();
|
|
audio.init();
|
|
|
|
// Initialise the sounds
|
|
AudioSources.init();
|
|
Sounds.init();
|
|
|
|
// Create the mainloop
|
|
mainloop = new MainloopManager(MainloopEventHandler.MAINLOOP_EVENT_HANDLER);
|
|
mainloop.register(MainloopEventHandler.MAINLOOP_EVENT_HANDLER);
|
|
mainloop.register(ChunkEventHandler.CHUNK_EVENT_HANDLER);
|
|
mainloop.register(DisplayStatsEventHandler.DISPLAY_STATS_EVENT_HANDLER);
|
|
mainloop.register(JoystickCallback.JOYSTICK_CALLBACK);
|
|
|
|
// Create the display
|
|
window = new DisplayWindow("ShooterGame");
|
|
window.init();
|
|
|
|
// Initialise the textures
|
|
Textures.initTextures(window);
|
|
|
|
// Initialize the gamepad
|
|
JoystickCallback.JOYSTICK_CALLBACK.init();
|
|
|
|
// Create the world
|
|
world = new World(new Random(), new LayerGenEarth(), new LayerGenCaves());
|
|
|
|
// Initialise the entities
|
|
mainloop.register(EntityEventHandler.ENTITY_EVENT_HANDLER);
|
|
|
|
// Start the mainloop
|
|
mainloop.start();
|
|
}
|
|
}
|