Changed to C++
3
.gitignore
vendored
@@ -1,3 +0,0 @@
|
||||
/.nb-gradle/
|
||||
/core/build/
|
||||
/desktop/build/
|
||||
@@ -1 +0,0 @@
|
||||
#Tue Oct 17 00:48:27 CEST 2017
|
||||
34
Makefile
Normal file
@@ -0,0 +1,34 @@
|
||||
CC = g++
|
||||
CFLAGS = -Wall
|
||||
EXE = DarkRP2D
|
||||
LIB_PATH =
|
||||
INC_PATH =
|
||||
LIBS =
|
||||
|
||||
SRCDIR = src
|
||||
BUILDDIR = build
|
||||
SRC = $(shell C:\\MinGW\\msys\\1.0\\bin\\find $(SRCDIR) -name *.cpp)
|
||||
OBJ = $(patsubst %.cpp, %.o, $(SRC))
|
||||
OBJ := $(subst $(SRCDIR), $(BUILDDIR), $(OBJ))
|
||||
|
||||
.PHONY: all clean build run debug
|
||||
|
||||
all: build $(EXE)
|
||||
|
||||
run: all
|
||||
$(BUILDDIR)/$(EXE)
|
||||
|
||||
$(EXE): $(OBJ)
|
||||
$(CC) $(CFLAGS) -o $(BUILDDIR)/$@ $(OBJ) -static-libgcc -static-libstdc++
|
||||
|
||||
$(OBJ): $(SRC)
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
build:
|
||||
C:\\MinGW\\msys\\1.0\\bin\\mkdir -p $(BUILDDIR)
|
||||
|
||||
clean:
|
||||
rm -rf $(BUILDDIR)
|
||||
|
||||
debug:
|
||||
@echo $(OBJ)
|
||||
|
Before Width: | Height: | Size: 671 B After Width: | Height: | Size: 671 B |
|
Before Width: | Height: | Size: 594 B After Width: | Height: | Size: 594 B |
|
Before Width: | Height: | Size: 669 B After Width: | Height: | Size: 669 B |
|
Before Width: | Height: | Size: 747 B After Width: | Height: | Size: 747 B |
|
Before Width: | Height: | Size: 952 B After Width: | Height: | Size: 952 B |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 196 B After Width: | Height: | Size: 196 B |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
70
build.gradle
@@ -1,70 +0,0 @@
|
||||
buildscript {
|
||||
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
apply plugin: "eclipse"
|
||||
apply plugin: "idea"
|
||||
|
||||
version = '1.0'
|
||||
ext {
|
||||
appName = "DarkRP2D"
|
||||
gdxVersion = '1.9.6'
|
||||
roboVMVersion = '2.3.1'
|
||||
box2DLightsVersion = '1.4'
|
||||
ashleyVersion = '1.7.0'
|
||||
aiVersion = '1.8.0'
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
|
||||
maven { url "https://oss.sonatype.org/content/repositories/releases/" }
|
||||
}
|
||||
}
|
||||
|
||||
project(":desktop") {
|
||||
apply plugin: "java"
|
||||
|
||||
|
||||
dependencies {
|
||||
compile project(":core")
|
||||
compile "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
|
||||
compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
|
||||
compile "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-desktop"
|
||||
compile "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop"
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
project(":core") {
|
||||
apply plugin: "java"
|
||||
|
||||
|
||||
dependencies {
|
||||
compile "com.badlogicgames.gdx:gdx:$gdxVersion:sources"
|
||||
compile "com.badlogicgames.gdx:gdx:$gdxVersion"
|
||||
compile "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
|
||||
compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
|
||||
compile "com.badlogicgames.box2dlights:box2dlights:$box2DLightsVersion"
|
||||
compile "com.badlogicgames.ashley:ashley:$ashleyVersion"
|
||||
compile "com.badlogicgames.gdx:gdx-ai:$aiVersion"
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
tasks.eclipse.doLast {
|
||||
delete ".project"
|
||||
}
|
||||
BIN
build/DarkRP2D.exe
Normal file
BIN
build/main.o
Normal file
|
Before Width: | Height: | Size: 67 KiB |
@@ -1,11 +0,0 @@
|
||||
apply plugin: "java"
|
||||
|
||||
sourceCompatibility = 1.6
|
||||
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
|
||||
|
||||
sourceSets.main.java.srcDirs = [ "src/" ]
|
||||
|
||||
|
||||
eclipse.project {
|
||||
name = appName + "-core"
|
||||
}
|
||||
@@ -1,135 +0,0 @@
|
||||
package com.darkrp2d;
|
||||
|
||||
import com.darkrp2d.entitySystems.RenderSystem;
|
||||
import com.badlogic.ashley.core.Engine;
|
||||
import com.badlogic.ashley.core.Family;
|
||||
|
||||
import com.badlogic.gdx.Game;
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.graphics.GL20;
|
||||
import com.badlogic.gdx.graphics.OrthographicCamera;
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont;
|
||||
import com.badlogic.gdx.graphics.g2d.GlyphLayout;
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
|
||||
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
import com.badlogic.gdx.math.Matrix4;
|
||||
import com.badlogic.gdx.physics.box2d.Box2DDebugRenderer;
|
||||
import com.badlogic.gdx.physics.box2d.World;
|
||||
import com.badlogic.gdx.utils.TimeUtils;
|
||||
|
||||
import com.darkrp2d.entities.components.TextureComponent;
|
||||
import com.darkrp2d.entities.entityListeners.DisposeListener;
|
||||
import com.darkrp2d.entitySystems.MovementSystem;
|
||||
import com.darkrp2d.input.CommandStream;
|
||||
import com.darkrp2d.input.InputHandler;
|
||||
import com.darkrp2d.input.commands.Command;
|
||||
import com.darkrp2d.physics.Box2DUtils;
|
||||
|
||||
|
||||
public class DarkRP2D extends Game {
|
||||
|
||||
public BitmapFont font;
|
||||
public SpriteBatch batch;
|
||||
public Engine engine;
|
||||
public World world;
|
||||
|
||||
private OrthographicCamera camera;
|
||||
private Box2DDebugRenderer b2dbr;
|
||||
private Matrix4 debugMatrix;
|
||||
|
||||
@Override
|
||||
public void create () {
|
||||
font = new BitmapFont();
|
||||
batch = new SpriteBatch();
|
||||
world = new World(new Vector2(0.f,0.f),true);
|
||||
engine = new Engine();
|
||||
engine.addSystem(new RenderSystem(MS_PER_UPDATE));
|
||||
engine.addSystem(new MovementSystem());
|
||||
engine.addEntityListener(Family.all(TextureComponent.class).get(), 0, new DisposeListener());
|
||||
camera = new OrthographicCamera();
|
||||
camera.setToOrtho(false, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
|
||||
b2dbr = new Box2DDebugRenderer();
|
||||
|
||||
//must be before input registration or no controllable Entity found
|
||||
engine.addEntity(com.darkrp2d.entities.Character.create(this));
|
||||
//Sets inputs
|
||||
Gdx.input.setInputProcessor(new InputHandler(this));
|
||||
}
|
||||
|
||||
//GameLoop and debug
|
||||
private float accumulator = 0;
|
||||
private float skippedFrames = 0;
|
||||
private static final int UPDATES_PER_SECOND = 60;
|
||||
private static final float MS_PER_UPDATE = 1f / UPDATES_PER_SECOND;
|
||||
private static final int MAX_FRAMESKIP = 5; // Make 5 updates mostly without a render
|
||||
|
||||
@Override
|
||||
// GameLoop
|
||||
public void render () {
|
||||
accumulator += Gdx.graphics.getRawDeltaTime(); //Seconds to milliseconds
|
||||
|
||||
//Process Input
|
||||
Command currentCommand = CommandStream.pollCommand();
|
||||
if(currentCommand != null) {
|
||||
currentCommand.execute();
|
||||
}
|
||||
|
||||
skippedFrames = 0;
|
||||
|
||||
//Update Stuff
|
||||
while(accumulator >= MS_PER_UPDATE && skippedFrames <= MAX_FRAMESKIP) {
|
||||
accumulator -= MS_PER_UPDATE;
|
||||
update(MS_PER_UPDATE);
|
||||
skippedFrames++;
|
||||
}
|
||||
|
||||
trueRender(accumulator / MS_PER_UPDATE);
|
||||
}
|
||||
|
||||
public void update(float deltaTime) {
|
||||
world.step(deltaTime, 6, 2);
|
||||
engine.update(deltaTime);
|
||||
}
|
||||
|
||||
public void trueRender(float delta) {
|
||||
Gdx.gl.glClearColor(0.f, 0.f, 0.f, 1.f);
|
||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
||||
|
||||
//Render current Screen
|
||||
super.render();
|
||||
|
||||
//Debug
|
||||
camera.update();
|
||||
batch.setProjectionMatrix(camera.combined);
|
||||
// Scale down the sprite batches projection matrix to box2D size
|
||||
debugMatrix = batch.getProjectionMatrix().cpy().scale(Box2DUtils.PIXEL_PER_METER,
|
||||
Box2DUtils.PIXEL_PER_METER, 0);
|
||||
b2dbr.render(world, debugMatrix);
|
||||
|
||||
//TODO: will be later moved to Gamescreen
|
||||
engine.getSystem(RenderSystem.class).render(delta, batch);
|
||||
|
||||
//some testdrawing
|
||||
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 resize (int width, int height) {
|
||||
//camera.setToOrtho(false, width, height);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose () {
|
||||
b2dbr.dispose();
|
||||
engine.removeAllEntities();
|
||||
font.dispose();
|
||||
batch.dispose();
|
||||
world.dispose();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
/*
|
||||
* 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)
|
||||
*/
|
||||
|
||||
/*
|
||||
* TODO ORDER:
|
||||
* Add character from laptop
|
||||
* box2D Character/camera movement
|
||||
* Add World
|
||||
* Add Charakter
|
||||
* Add Cars
|
||||
*/
|
||||
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
/*
|
||||
* 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.entities;
|
||||
|
||||
import com.badlogic.ashley.core.Entity;
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.graphics.Texture;
|
||||
import com.badlogic.gdx.physics.box2d.BodyDef;
|
||||
import com.badlogic.gdx.physics.box2d.FixtureDef;
|
||||
import com.badlogic.gdx.physics.box2d.PolygonShape;
|
||||
import com.darkrp2d.DarkRP2D;
|
||||
import com.darkrp2d.entities.components.ControllableComponent;
|
||||
import com.darkrp2d.entities.components.PhysicComponent;
|
||||
import com.darkrp2d.entities.components.TextureComponent;
|
||||
import com.darkrp2d.physics.Box2DUtils;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Julian
|
||||
*/
|
||||
public class Character {
|
||||
|
||||
//Singletone
|
||||
private static Entity character;
|
||||
public static Entity create(DarkRP2D game) {
|
||||
if(character == null) {
|
||||
float movementSpeed = 10.f;
|
||||
character = new Entity();
|
||||
BodyDef bodyDef = new BodyDef();
|
||||
bodyDef.type = BodyDef.BodyType.DynamicBody;
|
||||
bodyDef.position.set(0 , 0);
|
||||
|
||||
PolygonShape shape = new PolygonShape();
|
||||
shape.setAsBox(Box2DUtils.screenToWorld(32.f), Box2DUtils.screenToWorld(32.f));
|
||||
|
||||
FixtureDef fixtureDef = new FixtureDef();
|
||||
fixtureDef.shape = shape;
|
||||
fixtureDef.density = 1f;
|
||||
|
||||
character.add(new PhysicComponent(game,bodyDef, fixtureDef));
|
||||
shape.dispose();
|
||||
character.add(new TextureComponent(new Texture(Gdx.files.internal("police_officer.png"))));
|
||||
character.add(new ControllableComponent(movementSpeed));
|
||||
}
|
||||
return character;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
/*
|
||||
* 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.entities.components;
|
||||
|
||||
import com.badlogic.ashley.core.Component;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Julian
|
||||
*/
|
||||
public class ControllableComponent implements Component {
|
||||
|
||||
public boolean up = false;
|
||||
public boolean down = false;
|
||||
public boolean right = false;
|
||||
public boolean left = false;
|
||||
|
||||
public float speed;
|
||||
|
||||
public ControllableComponent(float speed) {
|
||||
this.speed = speed;
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
/*
|
||||
* 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.entities.components;
|
||||
|
||||
import com.badlogic.ashley.core.ComponentMapper;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Julian
|
||||
*/
|
||||
public class Mappers {
|
||||
|
||||
public static final ComponentMapper<PhysicComponent> physicComponentMapper = ComponentMapper.getFor(PhysicComponent.class);
|
||||
public static final ComponentMapper<TextureComponent> textureComponentMapper = ComponentMapper.getFor(TextureComponent.class);
|
||||
public static final ComponentMapper<ControllableComponent> controllableComponentMapper = ComponentMapper.getFor(ControllableComponent.class);
|
||||
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
/*
|
||||
* 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.entities.components;
|
||||
|
||||
import com.badlogic.ashley.core.Component;
|
||||
import com.badlogic.gdx.physics.box2d.Body;
|
||||
import com.badlogic.gdx.physics.box2d.BodyDef;
|
||||
import com.badlogic.gdx.physics.box2d.FixtureDef;
|
||||
import com.darkrp2d.DarkRP2D;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Julian
|
||||
*/
|
||||
public class PhysicComponent implements Component {
|
||||
public BodyDef bodyDef;
|
||||
public FixtureDef fixtureDef;
|
||||
public Body body;
|
||||
|
||||
public PhysicComponent(DarkRP2D game, BodyDef bodyDef, FixtureDef fixtureDef) {
|
||||
this.bodyDef = bodyDef;
|
||||
this.fixtureDef = fixtureDef;
|
||||
body = game.world.createBody(bodyDef);
|
||||
body.createFixture(fixtureDef);
|
||||
|
||||
}
|
||||
|
||||
public void dispose() {
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
/*
|
||||
* 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.entities.components;
|
||||
import com.badlogic.ashley.core.Component;
|
||||
import com.badlogic.gdx.graphics.Texture;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Julian
|
||||
*/
|
||||
public class TextureComponent implements Component {
|
||||
|
||||
public Texture tex;
|
||||
|
||||
public TextureComponent(Texture tex) {
|
||||
this.tex = tex;
|
||||
}
|
||||
|
||||
public void dispose() {
|
||||
tex.dispose();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
/*
|
||||
* 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.entities.entityListeners;
|
||||
|
||||
import com.badlogic.ashley.core.Entity;
|
||||
import com.badlogic.ashley.core.EntityListener;
|
||||
import com.darkrp2d.entities.components.Mappers;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Julian
|
||||
*/
|
||||
public class DisposeListener implements EntityListener {
|
||||
|
||||
@Override
|
||||
public void entityAdded(Entity entity) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void entityRemoved(Entity entity) {
|
||||
Mappers.textureComponentMapper.get(entity).dispose();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
/*
|
||||
* 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.entitySystems;
|
||||
|
||||
import com.badlogic.ashley.core.Engine;
|
||||
import com.badlogic.ashley.core.Entity;
|
||||
import com.badlogic.ashley.core.EntitySystem;
|
||||
import com.badlogic.ashley.core.Family;
|
||||
import com.badlogic.ashley.utils.ImmutableArray;
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
import com.darkrp2d.entities.components.ControllableComponent;
|
||||
import com.darkrp2d.entities.components.Mappers;
|
||||
import com.darkrp2d.entities.components.PhysicComponent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Julian
|
||||
*/
|
||||
public class MovementSystem extends EntitySystem {
|
||||
|
||||
private ImmutableArray<Entity> entities;
|
||||
|
||||
public MovementSystem() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addedToEngine(Engine engine) {
|
||||
entities = engine.getEntitiesFor(Family.all(PhysicComponent.class, ControllableComponent.class).get());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(float deltaTime) {
|
||||
for (int i = 0; i < entities.size(); ++i) {
|
||||
Entity entity = entities.get(i);
|
||||
ControllableComponent controller = Mappers.controllableComponentMapper.get(entity);
|
||||
PhysicComponent physic = Mappers.physicComponentMapper.get(entity);
|
||||
Vector2 dir = new Vector2(0,0);
|
||||
|
||||
if(controller.down) {
|
||||
dir.y += -1;
|
||||
}
|
||||
if(controller.up) {
|
||||
dir.y += 1;
|
||||
}
|
||||
if(controller.left) {
|
||||
dir.x += -1;
|
||||
}
|
||||
if(controller.right) {
|
||||
dir.x += 1;
|
||||
}
|
||||
|
||||
physic.body.setLinearVelocity(dir.nor().setLength(controller.speed));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
/*
|
||||
* 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.entitySystems;
|
||||
|
||||
import com.badlogic.ashley.core.Engine;
|
||||
import com.badlogic.ashley.core.Entity;
|
||||
import com.badlogic.ashley.core.EntitySystem;
|
||||
import com.badlogic.ashley.core.Family;
|
||||
import com.badlogic.ashley.utils.ImmutableArray;
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
|
||||
import com.darkrp2d.entities.components.Mappers;
|
||||
import com.darkrp2d.entities.components.PhysicComponent;
|
||||
import com.darkrp2d.entities.components.TextureComponent;
|
||||
import com.darkrp2d.physics.Box2DUtils;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Julian
|
||||
*/
|
||||
public class RenderSystem extends EntitySystem {
|
||||
|
||||
private ImmutableArray<Entity> entities;
|
||||
private float msPerUpdate;
|
||||
|
||||
|
||||
public RenderSystem(float msPerUpdate) {
|
||||
this.msPerUpdate = msPerUpdate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addedToEngine(Engine engine) {
|
||||
entities = engine.getEntitiesFor(Family.all(TextureComponent.class, PhysicComponent.class).get());
|
||||
}
|
||||
|
||||
public void render(float delta, SpriteBatch batch) {
|
||||
batch.begin();
|
||||
for (int i = 0; i < entities.size(); ++i) {
|
||||
Entity entity = entities.get(i);
|
||||
PhysicComponent physics = Mappers.physicComponentMapper.get(entity);
|
||||
TextureComponent texture = Mappers.textureComponentMapper.get(entity);
|
||||
|
||||
Vector2 vel = physics.body.getLinearVelocity();
|
||||
vel.scl(msPerUpdate);
|
||||
vel.scl(delta);
|
||||
|
||||
batch.draw(texture.tex, Box2DUtils.worldToScreen(physics.body.getPosition().x + vel.x) - texture.tex.getWidth() / 2, Box2DUtils.worldToScreen(physics.body.getPosition().y + vel.y) - texture.tex.getHeight()/2);
|
||||
}
|
||||
batch.end();
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
/*
|
||||
* 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();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,124 +0,0 @@
|
||||
/*
|
||||
* 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.ashley.core.Entity;
|
||||
import com.badlogic.ashley.core.Family;
|
||||
import com.badlogic.gdx.Input;
|
||||
import com.badlogic.gdx.InputProcessor;
|
||||
import com.darkrp2d.DarkRP2D;
|
||||
import com.darkrp2d.entities.components.ControllableComponent;
|
||||
import com.darkrp2d.entities.components.PhysicComponent;
|
||||
import com.darkrp2d.input.commands.*;
|
||||
import com.darkrp2d.input.commands.moveCommands.*;
|
||||
import com.darkrp2d.scenes.menu.MenuScreen;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author gulum
|
||||
*/
|
||||
public class InputHandler implements InputProcessor {
|
||||
|
||||
Command testCommand;
|
||||
Command menuCommand;
|
||||
|
||||
//MovementCommands
|
||||
Command upCommand;
|
||||
Command downCommand;
|
||||
Command leftCommand;
|
||||
Command rightCommand;
|
||||
|
||||
public InputHandler(DarkRP2D game) {
|
||||
testCommand = new TestCommand();
|
||||
this.menuCommand = new MenuCommand(game, new MenuScreen(game));
|
||||
|
||||
//Inputs auf erstes bedienbares entity
|
||||
Entity character = game.engine.getEntitiesFor(Family.all(ControllableComponent.class, PhysicComponent.class).get()).first();
|
||||
this.upCommand = new UpCommand(character);
|
||||
this.downCommand = new DownCommand(character);
|
||||
this.leftCommand = new LeftCommand(character);
|
||||
this.rightCommand = new RightCommand(character);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean keyDown(int keycode) {
|
||||
switch (keycode) {
|
||||
case Input.Keys.Q:
|
||||
CommandStream.registerCommand(testCommand);
|
||||
break;
|
||||
case Input.Keys.C:
|
||||
CommandStream.registerCommand(menuCommand);
|
||||
break;
|
||||
case Input.Keys.W:
|
||||
CommandStream.registerCommand(upCommand);
|
||||
break;
|
||||
case Input.Keys.S:
|
||||
CommandStream.registerCommand(downCommand);
|
||||
break;
|
||||
case Input.Keys.A:
|
||||
CommandStream.registerCommand(leftCommand);
|
||||
break;
|
||||
case Input.Keys.D:
|
||||
CommandStream.registerCommand(rightCommand);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean keyUp(int keycode) {
|
||||
switch (keycode) {
|
||||
case Input.Keys.W:
|
||||
CommandStream.registerCommand(upCommand);
|
||||
break;
|
||||
case Input.Keys.S:
|
||||
CommandStream.registerCommand(downCommand);
|
||||
break;
|
||||
case Input.Keys.A:
|
||||
CommandStream.registerCommand(leftCommand);
|
||||
break;
|
||||
case Input.Keys.D:
|
||||
CommandStream.registerCommand(rightCommand);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
/*
|
||||
* 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();
|
||||
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.badlogic.gdx.Game;
|
||||
import com.badlogic.gdx.Screen;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Julian
|
||||
*/
|
||||
public class MenuCommand implements Command {
|
||||
|
||||
private Game game;
|
||||
private Screen screen;
|
||||
private boolean toggle = false;
|
||||
|
||||
public MenuCommand(Game game, Screen screen) {
|
||||
this.game = game;
|
||||
this.screen = screen;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
if(!toggle) {
|
||||
toggle = true;
|
||||
game.setScreen(screen);
|
||||
} else {
|
||||
toggle = false;
|
||||
game.setScreen(null);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
/*
|
||||
* 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!");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
/*
|
||||
* 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.moveCommands;
|
||||
|
||||
import com.badlogic.ashley.core.Entity;
|
||||
import com.darkrp2d.entities.components.ControllableComponent;
|
||||
import com.darkrp2d.entities.components.Mappers;
|
||||
import com.darkrp2d.input.commands.Command;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Julian
|
||||
*/
|
||||
public class DownCommand implements Command{
|
||||
|
||||
Entity ent;
|
||||
private boolean toggle = false;
|
||||
|
||||
public DownCommand(Entity ent) {
|
||||
this.ent = ent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
ControllableComponent controller = Mappers.controllableComponentMapper.get(ent);
|
||||
if(!toggle) {
|
||||
controller.down = true;
|
||||
toggle = true;
|
||||
} else {
|
||||
controller.down = false;
|
||||
toggle = false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
/*
|
||||
* 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.moveCommands;
|
||||
|
||||
import com.badlogic.ashley.core.Entity;
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
import com.badlogic.gdx.physics.box2d.Body;
|
||||
import com.darkrp2d.entities.components.ControllableComponent;
|
||||
import com.darkrp2d.entities.components.Mappers;
|
||||
import com.darkrp2d.input.commands.Command;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Julian
|
||||
*/
|
||||
public class LeftCommand implements Command {
|
||||
|
||||
Entity ent;
|
||||
private boolean toggle = false;
|
||||
|
||||
public LeftCommand(Entity ent) {
|
||||
this.ent = ent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
ControllableComponent controller = Mappers.controllableComponentMapper.get(ent);
|
||||
if(!toggle) {
|
||||
controller.left = true;
|
||||
toggle = true;
|
||||
} else {
|
||||
controller.left = false;
|
||||
toggle = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
/*
|
||||
* 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.moveCommands;
|
||||
|
||||
import com.badlogic.ashley.core.Entity;
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
import com.badlogic.gdx.physics.box2d.Body;
|
||||
import com.darkrp2d.entities.components.ControllableComponent;
|
||||
import com.darkrp2d.entities.components.Mappers;
|
||||
import com.darkrp2d.input.commands.Command;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Julian
|
||||
*/
|
||||
public class RightCommand implements Command {
|
||||
|
||||
Entity ent;
|
||||
private boolean toggle = false;
|
||||
|
||||
public RightCommand(Entity ent) {
|
||||
this.ent = ent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
ControllableComponent controller = Mappers.controllableComponentMapper.get(ent);
|
||||
if(!toggle) {
|
||||
controller.right = true;
|
||||
toggle = true;
|
||||
} else {
|
||||
controller.right = false;
|
||||
toggle = false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
/*
|
||||
* 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.moveCommands;
|
||||
|
||||
import com.badlogic.ashley.core.Entity;
|
||||
import com.badlogic.gdx.physics.box2d.Body;
|
||||
import com.darkrp2d.entities.components.Mappers;
|
||||
import com.darkrp2d.input.commands.Command;
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
import com.darkrp2d.entities.components.ControllableComponent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Julian
|
||||
*/
|
||||
public class UpCommand implements Command {
|
||||
|
||||
Entity ent;
|
||||
private boolean toggle = false;
|
||||
|
||||
public UpCommand(Entity ent) {
|
||||
this.ent = ent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
ControllableComponent controller = Mappers.controllableComponentMapper.get(ent);
|
||||
if(!toggle) {
|
||||
controller.up = true;
|
||||
toggle = true;
|
||||
} else {
|
||||
controller.up = false;
|
||||
toggle = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
/*
|
||||
* 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.physics;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Julian
|
||||
*/
|
||||
public class Box2DUtils {
|
||||
|
||||
public static final float PIXEL_PER_METER = 32;
|
||||
|
||||
public static float screenToWorld(float value) {
|
||||
return value / PIXEL_PER_METER;
|
||||
}
|
||||
|
||||
public static float worldToScreen(float value) {
|
||||
return value * PIXEL_PER_METER;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
/*
|
||||
* 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();
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
/*
|
||||
* 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.scenes.game;
|
||||
|
||||
import com.badlogic.gdx.graphics.OrthographicCamera;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Julian
|
||||
*/
|
||||
public class Camera extends OrthographicCamera {
|
||||
|
||||
public Camera(int viewportWidth, int viewportHeight) {
|
||||
new OrthographicCamera(960,540);
|
||||
}
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
/*
|
||||
* 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.scenes.game;
|
||||
|
||||
import com.badlogic.gdx.Screen;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Julian
|
||||
*/
|
||||
public class GameScreen implements Screen {
|
||||
|
||||
//Pass server ip....
|
||||
public GameScreen(int ip) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(float delta) {
|
||||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resize(int width, int height) {
|
||||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pause() {
|
||||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resume() {
|
||||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hide() {
|
||||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
/*
|
||||
* 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.scenes.menu;
|
||||
|
||||
import com.badlogic.gdx.Screen;
|
||||
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, "Menu Opened");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(float f) {
|
||||
game.batch.begin();
|
||||
game.font.draw(game.batch, layout, 100, 100);
|
||||
game.batch.end();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resize(int width, int height) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pause() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resume() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hide() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
apply plugin: "java"
|
||||
|
||||
sourceCompatibility = 1.6
|
||||
sourceSets.main.java.srcDirs = [ "src/" ]
|
||||
|
||||
project.ext.mainClassName = "com.darkrp2d.desktop.DesktopLauncher"
|
||||
project.ext.assetsDir = new File("../core/assets");
|
||||
|
||||
task run(dependsOn: classes, type: JavaExec) {
|
||||
main = project.mainClassName
|
||||
classpath = sourceSets.main.runtimeClasspath
|
||||
standardInput = System.in
|
||||
workingDir = project.assetsDir
|
||||
ignoreExitValue = true
|
||||
}
|
||||
|
||||
task debug(dependsOn: classes, type: JavaExec) {
|
||||
main = project.mainClassName
|
||||
classpath = sourceSets.main.runtimeClasspath
|
||||
standardInput = System.in
|
||||
workingDir = project.assetsDir
|
||||
ignoreExitValue = true
|
||||
debug = true
|
||||
}
|
||||
|
||||
task dist(type: Jar) {
|
||||
from files(sourceSets.main.output.classesDir)
|
||||
from files(sourceSets.main.output.resourcesDir)
|
||||
from {configurations.compile.collect {zipTree(it)}}
|
||||
from files(project.assetsDir);
|
||||
|
||||
manifest {
|
||||
attributes 'Main-Class': project.mainClassName
|
||||
}
|
||||
}
|
||||
|
||||
dist.dependsOn classes
|
||||
|
||||
eclipse {
|
||||
project {
|
||||
name = appName + "-desktop"
|
||||
linkedResource name: 'assets', type: '2', location: 'PARENT-1-PROJECT_LOC/core/assets'
|
||||
}
|
||||
}
|
||||
|
||||
task afterEclipseImport(description: "Post processing after project generation", group: "IDE") {
|
||||
doLast {
|
||||
def classpath = new XmlParser().parse(file(".classpath"))
|
||||
new Node(classpath, "classpathentry", [ kind: 'src', path: 'assets' ]);
|
||||
def writer = new FileWriter(file(".classpath"))
|
||||
def printer = new XmlNodePrinter(new PrintWriter(writer))
|
||||
printer.setPreserveWhitespace(true)
|
||||
printer.print(classpath)
|
||||
}
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
package com.darkrp2d.desktop;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.Files;
|
||||
import com.badlogic.gdx.Preferences;
|
||||
import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
|
||||
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
|
||||
import com.darkrp2d.DarkRP2D;
|
||||
import com.darkrp2d.preference.PreferenceConstants;
|
||||
|
||||
public class DesktopLauncher {
|
||||
|
||||
public static final String GAME_TITLE = "DarkRP2D";
|
||||
|
||||
public static void main (String[] arg) {
|
||||
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
|
||||
|
||||
//Default conf
|
||||
config.title = "DarkRP2D";
|
||||
config.useGL30 = false;
|
||||
config.width = 960;
|
||||
config.height = 540;
|
||||
config.addIcon("logo.png", Files.FileType.Internal);
|
||||
config.vSyncEnabled = false; // Setting to false disables vertical sync
|
||||
config.foregroundFPS = 60; // Setting to 0 disables foreground fps throttling
|
||||
config.backgroundFPS = 60; // Setting to 0 disables background fps throttling
|
||||
|
||||
loadUserPrefs(new LwjglApplication(new DarkRP2D(), config));
|
||||
}
|
||||
|
||||
private static void loadUserPrefs(LwjglApplication app) {
|
||||
Preferences optionPrefs = Gdx.app.getPreferences(GAME_TITLE);
|
||||
|
||||
if(optionPrefs.getBoolean(PreferenceConstants.PREFS_FULLSCREEN)) {
|
||||
app.getGraphics().setFullscreenMode(app.getGraphics().getDisplayMode());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
org.gradle.daemon=true
|
||||
org.gradle.jvmargs=-Xms128m -Xmx1500m
|
||||
org.gradle.configureondemand=true
|
||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
6
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,6 +0,0 @@
|
||||
#Fri Jun 09 23:06:52 EDT 2017
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-bin.zip
|
||||
172
gradlew
vendored
@@ -1,172 +0,0 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS=""
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn ( ) {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die ( ) {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
nonstop=true
|
||||
;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=$((i+1))
|
||||
done
|
||||
case $i in
|
||||
(0) set -- ;;
|
||||
(1) set -- "$args0" ;;
|
||||
(2) set -- "$args0" "$args1" ;;
|
||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Escape application args
|
||||
save ( ) {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
APP_ARGS=$(save "$@")
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
|
||||
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
||||
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
||||
cd "$(dirname "$0")"
|
||||
fi
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
84
gradlew.bat
vendored
@@ -1,84 +0,0 @@
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS=
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windows variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
@@ -1 +0,0 @@
|
||||
include 'desktop', 'core'
|
||||
11
src/main.cpp
Normal file
@@ -0,0 +1,11 @@
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main( int argc, char *argv[] )
|
||||
{
|
||||
cout << "Hello World!" << '\n';
|
||||
cin.get();
|
||||
|
||||
return 0;
|
||||
}
|
||||