initial project
This commit is contained in:
51
core/src/com/darkrp2d/DarkRP2D.java
Executable file
51
core/src/com/darkrp2d/DarkRP2D.java
Executable file
@@ -0,0 +1,51 @@
|
||||
package com.darkrp2d;
|
||||
|
||||
import com.badlogic.gdx.Game;
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.graphics.GL20;
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont;
|
||||
import com.badlogic.gdx.graphics.g2d.GlyphLayout;
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
|
||||
import com.darkrp2d.input.CommandStream;
|
||||
import com.darkrp2d.input.InputHandler;
|
||||
import com.darkrp2d.input.commands.Command;
|
||||
|
||||
|
||||
public class DarkRP2D extends Game {
|
||||
|
||||
public BitmapFont font;
|
||||
public SpriteBatch batch;
|
||||
|
||||
@Override
|
||||
public void create () {
|
||||
//Sets inputs
|
||||
Gdx.input.setInputProcessor(new InputHandler());
|
||||
|
||||
|
||||
font = new BitmapFont();
|
||||
batch = new SpriteBatch();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render () {
|
||||
//Update stuff
|
||||
Command currentCommand = CommandStream.pollCommand();
|
||||
if(currentCommand != null) {
|
||||
currentCommand.execute();
|
||||
}
|
||||
//Render stuff
|
||||
super.render();
|
||||
Gdx.gl.glClearColor(0.f, 0.f, 0.f, 1.f);
|
||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
||||
batch.begin();
|
||||
GlyphLayout layout = new GlyphLayout(font, "Hello World");
|
||||
font.draw(batch, layout, Gdx.graphics.getWidth()/2-layout.width/2, Gdx.graphics.getHeight()/2-layout.height/2);
|
||||
batch.end();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose () {
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
27
core/src/com/darkrp2d/IDEAS.java
Normal file
27
core/src/com/darkrp2d/IDEAS.java
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.darkrp2d;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author gulum
|
||||
*/
|
||||
public class IDEAS {
|
||||
|
||||
/*
|
||||
* - Stadt info button
|
||||
* -> Population
|
||||
* ( Freischaltung von Berufen je nach Einwohnerzahl z.B. Feuerwehr
|
||||
* ab 15 Einwohner, dann können auch erst Feuer ausbrechen. )
|
||||
*
|
||||
*
|
||||
*
|
||||
* - Jobs
|
||||
* - Gang? Drug Dealer?
|
||||
* - Ganzes haus voller Marihuana Pflanzen (Leute abhängig (rimworld) oder irgendwelche boosts)
|
||||
*/
|
||||
|
||||
}
|
||||
29
core/src/com/darkrp2d/input/CommandStream.java
Normal file
29
core/src/com/darkrp2d/input/CommandStream.java
Normal file
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.darkrp2d.input;
|
||||
|
||||
import com.darkrp2d.input.commands.Command;
|
||||
import java.util.LinkedList;
|
||||
import java.util.Queue;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author gulum
|
||||
*/
|
||||
public class CommandStream {
|
||||
|
||||
private static Queue<Command> commandStream = new LinkedList<Command>();
|
||||
|
||||
|
||||
public static boolean registerCommand(Command com) {
|
||||
return commandStream.offer(com);
|
||||
}
|
||||
|
||||
public static Command pollCommand() {
|
||||
return commandStream.poll();
|
||||
}
|
||||
|
||||
}
|
||||
67
core/src/com/darkrp2d/input/InputHandler.java
Normal file
67
core/src/com/darkrp2d/input/InputHandler.java
Normal file
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.darkrp2d.input;
|
||||
|
||||
import com.badlogic.gdx.Input;
|
||||
import com.badlogic.gdx.InputProcessor;
|
||||
import com.darkrp2d.input.commands.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author gulum
|
||||
*/
|
||||
public class InputHandler implements InputProcessor {
|
||||
|
||||
Command testCommand;
|
||||
|
||||
public InputHandler() {
|
||||
testCommand = new TestCommand();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean keyDown(int keycode) {
|
||||
if(keycode == Input.Keys.Q) {
|
||||
CommandStream.registerCommand(testCommand);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean keyUp(int keycode) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean keyTyped(char character) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean touchDown(int screenX, int screenY, int pointer, int button) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean touchUp(int screenX, int screenY, int pointer, int button) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean touchDragged(int screenX, int screenY, int pointer) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mouseMoved(int screenX, int screenY) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean scrolled(int amount) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
16
core/src/com/darkrp2d/input/commands/Command.java
Normal file
16
core/src/com/darkrp2d/input/commands/Command.java
Normal file
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.darkrp2d.input.commands;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author gulum
|
||||
*/
|
||||
public interface Command {
|
||||
|
||||
public void execute();
|
||||
|
||||
}
|
||||
20
core/src/com/darkrp2d/input/commands/TestCommand.java
Normal file
20
core/src/com/darkrp2d/input/commands/TestCommand.java
Normal file
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.darkrp2d.input.commands;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author gulum
|
||||
*/
|
||||
public class TestCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
System.out.println("Just an Command test!");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
64
core/src/com/darkrp2d/menu/MenuScreen.java
Normal file
64
core/src/com/darkrp2d/menu/MenuScreen.java
Normal file
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.darkrp2d.menu;
|
||||
|
||||
import com.badlogic.gdx.Game;
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.Screen;
|
||||
import com.badlogic.gdx.graphics.GL20;
|
||||
import com.badlogic.gdx.graphics.g2d.GlyphLayout;
|
||||
import com.darkrp2d.DarkRP2D;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author gulum
|
||||
*/
|
||||
public class MenuScreen implements Screen{
|
||||
|
||||
private DarkRP2D game;
|
||||
private GlyphLayout layout;
|
||||
|
||||
public MenuScreen(DarkRP2D game) {
|
||||
this.game = game;
|
||||
layout = new GlyphLayout(game.font, "Hello World");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(float f) {
|
||||
Gdx.gl.glClearColor(.1f, .12f, .16f, 1);
|
||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
||||
game.batch.begin();
|
||||
game.font.draw(game.batch, layout, 100, 100);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resize(int width, int height) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pause() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resume() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hide() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
}
|
||||
|
||||
}
|
||||
19
core/src/com/darkrp2d/preference/PreferenceConstants.java
Normal file
19
core/src/com/darkrp2d/preference/PreferenceConstants.java
Normal file
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.darkrp2d.preference;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author gulum
|
||||
*/
|
||||
public final class PreferenceConstants {
|
||||
|
||||
public static final String PREFS_FULLSCREEN = "Fullscreen";
|
||||
|
||||
private PreferenceConstants() {
|
||||
throw new AssertionError();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user