Initial commit

This commit is contained in:
Ziver Koc 2019-12-31 16:50:44 +01:00
commit a3503e3e5c
73 changed files with 1348 additions and 0 deletions

23
core/build.gradle Normal file
View file

@ -0,0 +1,23 @@
apply plugin: "java"
sourceCompatibility = 1.7
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
sourceSets {
main {
java.srcDirs = [ "src/" ]
}
test {
java.srcDirs = ["test/"]
}
}
dependencies {
testImplementation "org.junit.jupiter:junit-jupiter-engine:5.5.2"
testImplementation "org.junit.platform:junit-platform-runner:1.5.2"
api "com.badlogicgames.gdx:gdx:$gdxVersion"
}
test {
useJUnitPlatform()
}

18
core/core.iml Normal file
View file

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="android-gradle" name="Android-Gradle">
<configuration>
<option name="GRADLE_PROJECT_PATH" value=":core" />
<option name="LAST_SUCCESSFUL_SYNC_AGP_VERSION" />
<option name="LAST_KNOWN_AGP_VERSION" />
</configuration>
</facet>
<facet type="java-gradle" name="Java-Gradle">
<configuration>
<option name="BUILD_FOLDER_PATH" value="$MODULE_DIR$/build" />
<option name="BUILDABLE" value="true" />
</configuration>
</facet>
</component>
</module>

View file

@ -0,0 +1,33 @@
package se.cookery;
import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
public class CookeryClient extends ApplicationAdapter {
SpriteBatch batch;
Texture img;
@Override
public void create () {
batch = new SpriteBatch();
img = new Texture("badlogic.jpg");
}
@Override
public void render () {
Gdx.gl.glClearColor(1, 0, 0, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
batch.begin();
batch.draw(img, 0, 0);
batch.end();
}
@Override
public void dispose () {
batch.dispose();
img.dispose();
}
}

View file

@ -0,0 +1,4 @@
package se.cookery.world;
public class Block {
}

View file

@ -0,0 +1,42 @@
package se.cookery.world;
import java.util.Map;
import java.util.TreeMap;
public class World {
// Constants
/**
* The size in a virtual coordinate system unit. The square is a square with size BLOCK_SIZE x BLOCK_SIZE.
**/
public static final int SQUARE_SIZE = 1;
/**
* The size of a block in units of squares. The block is a square with size BLOCK_SIZE x BLOCK_SIZE.
**/
public static final int BLOCK_SIZE = 20;
// Variables
private Map<Long, Map<Long, Block>> worldBlocks = new TreeMap<>();
public World() {
}
/**
* @return true if the block coordiante exists, otherwise false
*/
public boolean blockExists(long x, long y) {
return worldBlocks.get(x) != null && worldBlocks.get(x).get(y) != null;
}
/**
* @return the block at the requested coordinates, if block does
* not exist then a new block will be generated for the requested coordinate
*/
public Block getBlock(long x, long y) {
return null;
}
}

View file

@ -0,0 +1,18 @@
package se.cookery.world;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertNull;
public class WorldTest {
@Test
public void blockExists() {
World w = new World();
assertNull(w.getBlock(0, 0));
}
@Test
public void getBlock() {
}
}