Search in sources :

Example 1 with ProjektGGApplication

use of de.gg.game.core.ProjektGGApplication in project ProjektGG by eskalon.

the class DesktopLauncher method main.

public static void main(String[] args) {
    StartOnFirstThreadHelper.executeIfJVMValid(() -> {
        Lwjgl3ApplicationConfiguration config = new Lwjgl3ApplicationConfiguration();
        config.setTitle(ProjektGGApplication.NAME);
        config.setWindowedMode(1280, 720);
        config.setResizable(false);
        config.useVsync(false);
        config.setForegroundFPS(120);
        config.setWindowIcon(FileType.Internal, "icon16.png", "icon32.png", "icon48.png");
        try {
            new Lwjgl3Application(new ProjektGGApplication(), config);
        } catch (Exception e) {
            System.err.println("An unexpected error occurred while starting the game:");
            e.printStackTrace();
            System.exit(-1);
        }
    });
}
Also used : Lwjgl3Application(com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application) ProjektGGApplication(de.gg.game.core.ProjektGGApplication) Lwjgl3ApplicationConfiguration(com.badlogic.gdx.backends.lwjgl3.Lwjgl3ApplicationConfiguration)

Example 2 with ProjektGGApplication

use of de.gg.game.core.ProjektGGApplication in project ProjektGG by eskalon.

the class GameLoadingScreen method onFinishedLoading.

@Override
protected void onFinishedLoading() {
    GameSession session = ((ProjektGGApplication) application).getClient().getSession();
    World world = session.getWorld();
    // Create the ModelInstances
    for (BuildingSlot s : world.getBuildingSlots()) {
        if (s.isBuiltOn()) {
            s.getBuilding().setRenderData(new SelectableRenderData(application.getAssetManager().get(s.getBuilding().getType().getModelPath(), Model.class)));
            // FIXME siehe AuthoritativeSession#init(...)
            s.getBuilding().getRenderData().transform.translate(s.getPosX(), 0, s.getPosZ());
            s.getBuilding().getRenderData().transform.rotate(Y_AXIS, s.getRotationToStreet());
        // TODO Use _one_ scene for all models?
        // new SelectableRenderData(scene,
        // building1.getType().getNodeName(), true);
        }
    }
    Model skyboxModel = application.getAssetManager().get(session.getSessionSetup().getMap().getSkyboxPath(), Model.class);
    for (Material m : skyboxModel.materials) {
        // fixes a bug related to changes in gdx 1.9.9, see
        // https://github.com/libgdx/libgdx/issues/5529
        m.remove(ColorAttribute.Emissive);
    }
    world.setSkybox(new ModelInstance(skyboxModel));
    Log.info("Client", "Game assets loaded");
    if (((ProjektGGApplication) application).isHost()) {
        ((ProjektGGApplication) application).getServer().startMatch();
        Log.info("Server", "Game started!");
    }
    application.getScreenManager().pushScreen("round_end", "simple_zoom", 1);
}
Also used : GameSession(de.gg.game.session.GameSession) ModelInstance(com.badlogic.gdx.graphics.g3d.ModelInstance) Model(com.badlogic.gdx.graphics.g3d.Model) Material(com.badlogic.gdx.graphics.g3d.Material) ProjektGGApplication(de.gg.game.core.ProjektGGApplication) World(de.gg.game.model.World) SelectableRenderData(de.gg.game.ui.rendering.SelectableRenderData) BuildingSlot(de.gg.game.model.entities.BuildingSlot)

Aggregations

ProjektGGApplication (de.gg.game.core.ProjektGGApplication)2 Lwjgl3Application (com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application)1 Lwjgl3ApplicationConfiguration (com.badlogic.gdx.backends.lwjgl3.Lwjgl3ApplicationConfiguration)1 Material (com.badlogic.gdx.graphics.g3d.Material)1 Model (com.badlogic.gdx.graphics.g3d.Model)1 ModelInstance (com.badlogic.gdx.graphics.g3d.ModelInstance)1 World (de.gg.game.model.World)1 BuildingSlot (de.gg.game.model.entities.BuildingSlot)1 GameSession (de.gg.game.session.GameSession)1 SelectableRenderData (de.gg.game.ui.rendering.SelectableRenderData)1