Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 8 additions & 65 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,17 @@ sourceCompatibility = 1.8
targetCompatibility = 1.8

repositories {
mavenLocal()
mavenCentral()
jcenter()
google()
maven { url "http://repo.maven.apache.org/maven2" }
maven { url "https://oss.sonatype.org/content/repositories/releases/" }
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
}

ext {
gdxVersion = '1.9.9'
gdxVersion = '1.9.11'
}

dependencies {
Expand All @@ -25,7 +31,7 @@ dependencies {
testCompile group: 'com.badlogicgames.gdx', name: 'gdx-box2d', version:gdxVersion
testCompile group: 'com.badlogicgames.gdx', name: 'gdx-box2d-platform', version:gdxVersion, classifier:'natives-desktop'
testCompile group: 'junit', name: 'junit', version:'4.12'
testCompile group: 'com.kotcrab.vis', name: 'vis-ui', version: '1.4.0'
testCompile group: 'com.kotcrab.vis', name: 'vis-ui', version: '1.4.6'
}

sourceSets {
Expand All @@ -46,66 +52,3 @@ sourceSets {
}
}
}

task javadocJar(type: Jar) {
archiveClassifier.set('javadoc')
from javadoc
}

task sourcesJar(type: Jar) {
archiveClassifier.set('sources')
from sourceSets.main.allSource
}

artifacts {
archives javadocJar, sourcesJar
}

signing {
sign configurations.archives
}

uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }

repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: ossrhUsername, password: ossrhPassword)
}

snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
authentication(userName: ossrhUsername, password: ossrhPassword)
}

pom.project {
name 'libGdx In-Game Console'
packaging 'jar'
// optionally artifactId can be defined here
description 'libGdx In-Game Console'
url 'https://www.strongjoshua.net/projects/games/libgdx-ingame-console'

scm {
connection 'scm:git:git@github.com:StrongJoshua/libgdx-inGameConsole.git'
developerConnection 'scm:git:git@github.com:StrongJoshua/libgdx-inGameConsole.git'
url 'https://github.com/StrongJoshua/libgdx-inGameConsole'
}

licenses {
license {
name 'The Apache License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}

developers {
developer {
id 'StrongJoshua'
name 'Jan Risse'
email 'strongjoshua@hotmail.com'
}
}
}
}
}
}
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 1 addition & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#Wed Aug 16 11:11:15 EDT 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.8.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.3-all.zip
78 changes: 43 additions & 35 deletions gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 4 additions & 10 deletions gradlew.bat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 11 additions & 1 deletion src/com/strongjoshua/console/CommandExecutor.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,17 @@ protected void setConsole (Console c) {
console = c;
}

/**
/**
* Gets called when console becomes visible. Use for things like pausing the game while the console is active.
*/
protected void onShow(){}

/**
* Gets called when console becomes hidden. Use for things like unpausing and resuming the game.
*/
protected void onHide(){}

/**
* Prints the log to a local file.
*
* @param path The relative path of the local file to print to.
Expand Down
3 changes: 3 additions & 0 deletions src/com/strongjoshua/console/GUIConsole.java
Original file line number Diff line number Diff line change
Expand Up @@ -524,10 +524,13 @@ void refresh () {
private void setHidden (boolean h) {
hidden = h;
if (hidden) {
exec.onHide();
consoleWindow.setTouchable(Touchable.disabled);
stage.setKeyboardFocus(null);
stage.setScrollFocus(null);

} else {
exec.onShow();
input.setText("");
consoleWindow.setTouchable(Touchable.enabled);
if (selected) {
Expand Down
80 changes: 80 additions & 0 deletions test/tests/PauseTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
package tests;

import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input;
import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.actions.Actions;
import com.badlogic.gdx.scenes.scene2d.ui.Image;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.strongjoshua.console.CommandExecutor;
import com.strongjoshua.console.GUIConsole;

public class PauseTest extends ApplicationAdapter{
private Stage stage;
private GUIConsole console;
private Image image;
private boolean pause;

public static void main (String[] args) {
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
new LwjglApplication(new PauseTest(), config);
}

@Override
public void create(){
stage = new Stage();
Gdx.input.setInputProcessor(stage);

Skin skin = new Skin(Gdx.files.classpath("tests/test_skin/uiskin.json"));
console = new GUIConsole(skin);
console.setCommandExecutor(new MyCommandExecutor());
console.setSizePercent(40, 50);
console.setPositionPercent(100, 100);
console.setDisplayKeyID(Input.Keys.Z);

image = new Image(new Texture(Gdx.files.classpath("tests/badlogic" + "" + ".jpg")));
image.setScale(1.5f);
stage.addActor(image);
}

@Override public void render () {
Gdx.gl.glClearColor(0, 0, 0, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

if(image.getActions().size == 0)
image.addAction(Actions.sequence(Actions.fadeOut(1), Actions.fadeIn(1)));

if(!pause)
stage.act();

stage.draw();
console.draw();
}

private class MyCommandExecutor extends CommandExecutor{
@Override
protected void onShow(){
pause = true;
}

@Override
protected void onHide(){
pause = false;
}

public void setExecuteHiddenCommands (boolean enabled) {
console.setExecuteHiddenCommands(enabled);
console.log("ExecuteHiddenCommands was set to " + enabled);
}

public void setDisplayHiddenCommands (boolean enabled) {
console.setDisplayHiddenCommands(enabled);
console.log("DisplayHiddenCommands was set to " + enabled);
}
}
}