initial project

This commit is contained in:
Gulum
2017-10-13 18:55:50 +02:00
commit 9e81340ef8
19 changed files with 728 additions and 0 deletions

View 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 () {
}
}

View 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)
*/
}

View 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();
}
}

View 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;
}
}

View 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();
}

View 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!");
}
}

View 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() {
}
}

View 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();
}
}