Split project to submodules
This commit is contained in:
39
game/build.gradle
Executable file
39
game/build.gradle
Executable file
@@ -0,0 +1,39 @@
|
||||
plugins {
|
||||
id 'org.springframework.boot' version "$springBootVersion"
|
||||
id 'io.spring.dependency-management' version "$springDependencyManagementVersion"
|
||||
id 'java'
|
||||
id 'application'
|
||||
}
|
||||
|
||||
group 'com.bartlomiejpluta.base'
|
||||
version 'unspecified'
|
||||
|
||||
configurations {
|
||||
compileOnly {
|
||||
extendsFrom annotationProcessor
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
jcenter()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation project(":engine")
|
||||
|
||||
// Spring
|
||||
implementation 'org.springframework.boot:spring-boot-starter'
|
||||
compileOnly 'org.projectlombok:lombok'
|
||||
annotationProcessor 'org.projectlombok:lombok'
|
||||
testImplementation 'org.springframework.boot:spring-boot-starter-test'
|
||||
|
||||
// This dependency is used by the application.
|
||||
implementation "com.google.guava:guava:${guavaVersion}"
|
||||
implementation "org.joml:joml:${jomlVersion}"
|
||||
}
|
||||
|
||||
application {
|
||||
// Define the main class for the application.
|
||||
mainClass = 'com.bartlomiejpluta.base.game.App'
|
||||
}
|
||||
30
game/src/main/java/com/bartlomiejpluta/base/game/App.java
Executable file
30
game/src/main/java/com/bartlomiejpluta/base/game/App.java
Executable file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* This Java source file was generated by the Gradle 'init' task.
|
||||
*/
|
||||
package com.bartlomiejpluta.base.game;
|
||||
|
||||
import com.bartlomiejpluta.base.core.engine.GameEngine;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.ApplicationArguments;
|
||||
import org.springframework.boot.ApplicationRunner;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@Slf4j
|
||||
@SpringBootApplication(scanBasePackages = "com.bartlomiejpluta.base")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class App implements ApplicationRunner {
|
||||
private final GameEngine gameEngine;
|
||||
|
||||
@Override
|
||||
public void run(ApplicationArguments args) {
|
||||
log.info("Starting game engine");
|
||||
gameEngine.start();
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(App.class, args);
|
||||
}
|
||||
}
|
||||
51
game/src/main/java/com/bartlomiejpluta/base/game/logic/DefaultGameLogic.java
Executable file
51
game/src/main/java/com/bartlomiejpluta/base/game/logic/DefaultGameLogic.java
Executable file
@@ -0,0 +1,51 @@
|
||||
package com.bartlomiejpluta.base.game.logic;
|
||||
|
||||
import com.bartlomiejpluta.base.core.gl.render.Renderer;
|
||||
import com.bartlomiejpluta.base.core.logic.GameLogic;
|
||||
import com.bartlomiejpluta.base.core.ui.Window;
|
||||
import com.bartlomiejpluta.base.core.world.camera.Camera;
|
||||
import com.bartlomiejpluta.base.core.world.scene.Scene;
|
||||
import com.bartlomiejpluta.base.core.world.map.GameMap;
|
||||
import com.bartlomiejpluta.base.core.world.tileset.manager.TileSetManager;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class DefaultGameLogic implements GameLogic {
|
||||
private final Renderer renderer;
|
||||
private final TileSetManager tileSetManager;
|
||||
|
||||
private Camera camera;
|
||||
private GameMap map;
|
||||
private Scene scene;
|
||||
|
||||
@Override
|
||||
public void init(Window window) {
|
||||
log.info("Initializing game logic");
|
||||
renderer.init();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void input(Window window) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(float dt) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(Window window) {
|
||||
renderer.render(window, scene);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cleanUp() {
|
||||
renderer.cleanUp();
|
||||
scene.cleanUp();
|
||||
}
|
||||
}
|
||||
13
game/src/main/resources/application.yml
Executable file
13
game/src/main/resources/application.yml
Executable file
@@ -0,0 +1,13 @@
|
||||
app:
|
||||
window:
|
||||
title: "Simple Game"
|
||||
width: 640
|
||||
height: 480
|
||||
|
||||
core:
|
||||
targetUps: 50 # Updates per second
|
||||
|
||||
map:
|
||||
tile:
|
||||
width: 50
|
||||
height: 50
|
||||
Reference in New Issue
Block a user