Live Constant Tweaker

Live Constant Tweaker provides a GUI to tweak public static constants on the fly.

Лицензия

Лицензия

Группа

Группа

me.lachlanap.lct
Идентификатор

Идентификатор

lct
Последняя версия

Последняя версия

1.1
Дата

Дата

Тип

Тип

jar
Описание

Описание

Live Constant Tweaker
Live Constant Tweaker provides a GUI to tweak public static constants on the fly.
Ссылка на сайт

Ссылка на сайт

http://github.com/ThorinII/lct
Система контроля версий

Система контроля версий

http://github.com/ThorinII/lct

Скачать lct

Имя Файла Размер
lct-1.1.pom
lct-1.1.jar 46 KB
lct-1.1-sources.jar 22 KB
lct-1.1-javadoc.jar 213 KB
Обзор

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/me.lachlanap.lct/lct/ -->
<dependency>
    <groupId>me.lachlanap.lct</groupId>
    <artifactId>lct</artifactId>
    <version>1.1</version>
</dependency>
// https://jarcasting.com/artifacts/me.lachlanap.lct/lct/
implementation 'me.lachlanap.lct:lct:1.1'
// https://jarcasting.com/artifacts/me.lachlanap.lct/lct/
implementation ("me.lachlanap.lct:lct:1.1")
'me.lachlanap.lct:lct:jar:1.1'
<dependency org="me.lachlanap.lct" name="lct" rev="1.1">
  <artifact name="lct" type="jar" />
</dependency>
@Grapes(
@Grab(group='me.lachlanap.lct', module='lct', version='1.1')
)
libraryDependencies += "me.lachlanap.lct" % "lct" % "1.1"
[me.lachlanap.lct/lct "1.1"]

Зависимости

test (2)

Идентификатор библиотеки Тип Версия
junit : junit jar 4.10
org.mockito : mockito-core jar 1.9.5

Модули Проекта

Данный проект не имеет модулей.

lct - The Live Constant Tweaker

The Live Constant Tweaker is designed for use in game developement, to help get your numbers (eg physics constants, timers) just right. It is Java based.

This is still a work in progress - as such it shouldn't really be used for 'real' projects.

Build Status

Using Live Constant Tweaker

Add this to your Maven pom:

<dependency>
    <groupId>me.lachlanap.lct</groupId>
    <artifactId>lct</artifactId>
    <version>1.1</version>
</dependency>

or translate it into the correct format for your build system.

Expected Use

Defining constants

Define your constants as public static fields (not final - that would defeat the purpose of tweaking), and annotate them with the Constant annotation:

public static class PhysicsConstants {
  @Constant(name = "Gravity", constraints = "1,100")
  public static float GRAVITY = 9.81f;
  
  @Constant(name = "Substeps in Frame", constraints = "1,")
  public static int NUMBER_OF_SUBSTEPS = 3;
  
  @Constant(name = "Coefficient of Friction")
  public static double FRICTION_COEFFICIENT = 0.3;
}

Note there is just one Constant annotation. Currently, you specify constraints like a limited range using a String - the exact format depends on the type of the field, but for number constants use it like this: "min,max", where either min or max can be omitted. Note the constraints parameter is optional.

Using the system

Just create an instance of the me.lachlanap.lct.LCTManager class:

LCTManager lct = new LCTManager();

Then register all your constant classes:

lct.register(PhysicsConstants.class);
// more if needed...

Load any saved settings (the idea is that you tweak settings, then save them):

String file = "game-constants.properties";
try {
  lct.loadSettings(file);
} catch (IOException ioe) {
  // handle file reading errors...
}

When you want to show the settings tweaker, either create an LCTEditor and install it in a Swing GUI, or just create an LCTFrame:

// Using an LCTEditor
LCTEditor editor = new LCTEditor(lct);
// add it to a panel...

// Using an LCTFrame
LCTFrame frame = new LCTFrame(lct);
frame.setVisible(true);

When all the tweaking is done, save the settings:

String file = "game-constants.properties";
try {
  lct.saveSettings(file);
} catch (IOException ioe) {
  // handle file writing errors...
}

Версии библиотеки

Версия
1.1
1.0