Git Product home page Git Product logo

gdx-lml's Introduction

 
 
 
 
 
 
 
 

Disclaimer

The libraries from this repository are no longer maintained. They are not expected to be compatible with the latest LibGDX releases.

Alternatives and forks

  • crashinvaders/gdx-lml: an updated fork of this repository maintained by @metaphore.
  • libktx/ktx: a set of Kotlin utilities covering similar features as some of the libraries including gdx-kiwi, gdx-lml or gdx-autumn. Recommended when using Kotlin.
  • tommyettinger/gdx-liftoff: forks of gdx-kiwi, gdx-lml, gdx-autumn and gdx-autumn-mvc maintained to support the gdx-liftoff application - an alternative to the official gdx-setup tool.
  • MrStahlfelge/gdx-websockets: a fork of the gdx-websockets module. A multiplatform web sockets client for LibGDX.
 
 
 
 
 
 
 
 

Maven Central

LibGDX utilities

This repository contains various LibGDX extensions covering various features such as dependency injection, GUI building, networking and general utilities.

Note

This repository originally used to host only the gdx-lml library repository. The other libraries were merged into a single Gradle setup to ease maintenance and releases.

If you came here looking for gdx-lml documentation, check this out. gdx-lml-tests project, which shows usage of all LML tags, was moved here.

Also, this repository includes example projects using the latest snapshot versions and their new features. Before including the libraries in your application, make sure that you're about to use the correct version.

Projects

gdx-kiwi

Kiwi is a Guava-inspired set of utilities for pretty much any LibGDX-based application. It makes it easier to use LibGDX collections, assets and its API in general. While there are no gdx-kiwi-specific test projects, most of examples use Kiwi utilities to handle heavy assets and collections.

gdx-lml

LML (LibGDX Markup Language) allows to parse HTML-like templates with FreeMarker-inspired macros into Scene2D actors. Since making your UI in Java can become unreadable and tedious thanks to this language's verbosity, LML can be a useful alternative. Especially since LML templates can be modified or reloaded without having to recompile the whole application. Comes with extra support for managing preferences, assets and internationalization.

gdx-lml-vis

VisUI is a superb library, extending Scene2D with additional widgets and a modern skin. LML Vis allows to parse LML templates into VisUI widgets, instead of standard Scene2D ones and extends the syntax with ways to construct the new actors. Even if you want to have a custom skin in your application, consider using this library for the improved widgets.

gdx-autumn

Autumn is a dependency injection mechanism with component scanning. Using a set of annotations and class scanners, it allows you to build your application without singletons, global variables or even direct calls to constructors. Base for gdx-autumn-mvc framework.

gdx-autumn-android

Autumn Android provides class scanner for Android applications.

gdx-autumn-fcs

Autumn FCS provides class scanner for desktop applications using lightweight fast-classpath-scanner.

gdx-autumn-gwt

Autumn GWT provides class scanner for GWT applications.

gdx-autumn-mvc

Autumn MVC is a model-view-controller framework on top of LibGDX. It uses Autumn to manage components and LML as view templates. Makes it easier to maintain assets, internationalization, preferences, music, screen transitions, and so on. While other libraries are rather general-purpose, this one forces its structure upon your application - but should be still worth it, considering the amount of things it handles for you.

gdx-websocket

LibGDX web sockets library aims to extend the default Net implementations with cross-platform client-side web sockets. Rather than being a huge framework with server-side libraries, this set of libraries offers a simple and somewhat low level, yet pretty powerful client networking API.

gdx-websocket-common

Common web sockets library contains web socket natives for desktop and Android applications using high quality nv-websocket-client library.

gdx-websocket-gwt

GWT web sockets library contains web socket natives for GWT applications.

gdx-websocket-serialization

Serialization library for LibGDX web sockets contains serialization mechanism that works on every LibGDX platform. While default object serialization (using LibGDX Json API, based on reflection) is fine for most project, some performance-critical applications might require a different solution. Since most popular and tested serialization libraries are rarely GWT-compatible, gdx-websocket comes with its own alternative - this library. Warning: JSON-based communication is much easier to use, switch to this serialization only when necessary.

Examples

See examples section to check out some simple applications using presented libraries.

Other projects

Other LibGDX-related projects include:

  • gdx-setup: an alternative to the current project generator created using LibGDX and Kotlin. Collaboration with @kotcrab.
  • ktx: utilities for LibGDX application written in Kotlin. Features a VisUI module by @kotcrab.
  • gdx-skins: aims to help beginners with setting up their GUI in LibGDX using Scene2D. Contains some free GUI themes.
  • Noise4J: a couple of simple map generators. Written with LibGDX in mind, but the code itself has no dependencies - this is a pure Java 6 library, compatible with GWT. Lightweight. Can be used in pretty much any Java project.
  • vis-ui-contrib: contains some VisUI utilities and skins that I've created and made public. Note that the project itself in maintained by @kotcrab, the creator of VisUI.

Dependencies

All libraries follow the same schema:

        compile "com.github.czyzby:lib-name:$libVersion.$gdxVersion"

lib-name is the name of the library (one of the ones listed above). libVersion follows MAJOR.MINOR schema and is the actual version of the library. gdxVersion is the version of the LibGDX library used to build the archive. For example, this is a valid LML dependency (although it might be out of date by now!): 'com.github.czyzby:gdx-lml:1.5.1.9.2'. To find out the current version ID and GWT module, check out the specific library's README file. Looking through Maven Central might also help.

Working with the sources

Clone this repository. The whole setup is Gradle-based, with very similar structure to default LibGDX projects generated with gdx-setup. Note that Gradle wrapper is not included in the root project, so you should have Gradle installed locally.

To deploy the libs, the project requires some additional "secret" properties, used for archives signing and logging to Maven Central. While most likely you will not need these functionalities, Gradle still forces you to provide these properties. A default unfilled gradle.properties file is available in the root folder, so Gradle will not complain about missing properties. However, eventually you might want to fill these in your Gradle home folder:

        signing.keyId= 
        signing.password= 
        signing.secretKeyRingFile= 

        ossrhUsername= 
        ossrhPassword= 

Note that deploying to Maven Local does not require the signing task, so if you just keep the signing properties commented out - you should be fine. Try running gradle installAll to check if deploying to Maven Local works.

Before pulling any requests, make sure your code is formatted with eclipse-formatter.xml (or its equivalent for other IDE). Note that this is not the official LibGDX code formatter, as I'm not really a huge fan of its setup.

Assuming you want to use Eclipse IDE (which is IMHO much better for managing multiple projects than IntelliJ thanks to its workspaces, working sets and whatnot), this is a simple list of stuff to do after repository cloning:

  • Make sure gradle is installed globally. This repository has no Gradle wrappers in any project, so you cannot just use ./gradlew.
  • Run gradle eclipse to generate Eclipse projects for core libraries.
  • Optional: cd examples and run gradle eclipseAll to generate Eclipse projects for all examples. Note that some tasks will fail to run; this is expected, as some examples have an Android project and require you to add local.properties file with sdk.dir property.
  • Open Eclipse IDE. Import existing projects. Make sure to turn on searching for nested ones.
  • Add eclipse-formatter.xml as Java code formatter. Make this the default formatter for the imported projects.

Useful Gradle tasks

  • gradle eclipse - generates Eclipse project structure.
  • gradle idea - generates IntelliJ project structure.
  • gradle build install - builds the libraries' archives and pushes them to Maven Local.
  • gradle installAll - same as the previous one, but the tasks are always invoked in the correct order. Use when changing libraries' versions to avoid missing artifacts errors.
  • gradle uploadArchives - pushes the archives to Maven Central. Requires proper gradle.properties with signing and logging data.
  • gradle clean - removes built archives.
  • gradle distZip - prepares a zip archive with all jars in build/distributions folder. Useful for releases.
  • gradle closeAndPromoteRepository - closes and promotes Nexus repository. Run after uploadArchives.

Additionally, in examples directory you can find a utility Gradle project. This is not the root project of example applications: they are all autonomous and can be copied outside the repository (and should still work!). Still, it contains some utility tasks that modify or test example projects en masse:

  • gradle updateVersion - copies gradle.properties from examples to all projects directories.
  • gradle eclipseAll - generates Eclipse project meta-data for all examples.
  • gradle runAll - starts each desktop application, one by one. Useful for quick testing. Some applications (web socket tests) might fail to run if their corresponding server application is not turned on - this is expected.
  • gradle cleanAll - cleans build directories of example projects.

To run a task on a specific library, proceed task name with its project ID. For example, gradle kiwi:build will build archives of Kiwi library.

gdx-lml's People

Contributors

czyzby avatar dmelikhov avatar kotcrab avatar metaphore avatar xiii-th avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gdx-lml's Issues

VisUI 1.2.4 features

  • Spinner#setTextFieldEventPolicy
  • Use new MultiSplitPane API: kotcrab/vis-ui#221
  • ListView now supports ListViewStyle for customizing scroll pane style.
  • HighlightTextArea can be used instead of custom CodeTextArea to display code snippets in example projects.

See changes.

LSS import macro

See #27. It should be possible to import .lss files through a LML macro inside a template. Another macro for clearing styles en masse would make sense as well.

Parameters for a view controllers

Sometimes it need to pass some parameters to new controllers. Like when creating dialog, pass concrete object to display etc.

My first idea was to obtain my dialog controller instance and pass parameters there. When InterfaceService#showDialog(Class) called, it operates with ViewDialogController that wraps actual class but doesn't provide access to it.

I've looked into InterfaceService code but had no luck to fund any way to solve it. Am I missing anything or there is no any way for parameterizing controllers?

VisUI 1.3.0 features

  • HorizontalCollapsibleWidget
  • FileChooser#setShowSelectionCheckboxes
  • Check if Spinner#setDisabled works out of the box. It does not, since it does not implement Disableable interface. Workaround attribute added.

See changes.

Proper schema comment parsing

Schema comment starts with <! and ends with >. LmlParser currently expects !> at the end of any comment. DTD schema comment needs to be properly parsed, taking into account the standards. See #4.

websocket terminate connection if server not sending ping

In this version, if the server has not sent packets, connection terminated.

connection terminated hear

class WebSocketInputStream 
{
...
void readBytes(byte[] buffer, int length) throws IOException, WebSocketException
    {
            ...       
            int count = read(buffer, total, length - total);
            if (count <= 0)
            {
                // The end of the stream has been reached unexpectedly.
                throw new WebSocketException(
                        WebSocketError.INSUFFICENT_DATA,
                        "The end of the stream has been reached unexpectedly.");
            }
            total += count;
        }
    }
}

It would be nice to have a boolean property terminateConnectionAfterTimeOut to control behavior
if terminateConnectionAfterTimeOut == false then connection is not ternubated

Reusable tooltips

Currently Tooltip can be attached only to a single actor, but the implementation is pretty flexible and could be used for multiple widgets, even on multiple stages. Listener tags feature ids and keep attributes which allow to share the tooltip across multiple actors and views - same functionality should be added to tooltips.

DTD for Vis

Any chance we can get content assist for Vis UI elements?

I tried generating a schema using VisLml.parser() but no Vis UI elements are included in the DTD file.

I do get the following warnings:

LML: Warning: unable to create an instance of actor mapped to 'imagetextbutton' tag name with provider: com.github.czyzby.lml.parser.impl.tag.actor.provider.ImageTextButtonLmlTagProvider@7c83dc97. Attributes list will not be complete. Is the provider properly implemented? Is a default style provided for the selected actor?
LML: Warning: unable to create an instance of actor mapped to 'imagebutton' tag name with provider: com.github.czyzby.lml.parser.impl.tag.actor.provider.ImageButtonLmlTagProvider@2f54a33d. Attributes list will not be complete. Is the provider properly implemented? Is a default style provided for the selected actor?
LML: Warning: '/*' tag might contain invalid XML characters.

[LmlVis] Listview lml tag causes NPE

1.8.1.9.4-SNAPSHOT

Simple LML template like this

<?xml version="1.0"?>
<!DOCTYPE vistable SYSTEM "../../lml.dtd">
<vistable>
    <listview/>
</vistable>

Produces exception:

Caused by: java.lang.NullPointerException
    at com.github.czyzby.lml.vis.parser.impl.tag.ListViewLmlTag.getManagedObject(ListViewLmlTag.java:65)
    at com.github.czyzby.lml.parser.impl.tag.AbstractActorLmlTag.processTagAttributes(AbstractActorLmlTag.java:124)
    at com.github.czyzby.lml.parser.impl.tag.AbstractActorLmlTag.prepareActor(AbstractActorLmlTag.java:49)
    at com.github.czyzby.lml.parser.impl.tag.AbstractActorLmlTag.<init>(AbstractActorLmlTag.java:29)
    at com.github.czyzby.lml.parser.impl.tag.actor.TableLmlTag.<init>(TableLmlTag.java:17)
    at com.github.czyzby.lml.vis.parser.impl.tag.ListViewLmlTag.<init>(ListViewLmlTag.java:45)
    at com.github.czyzby.lml.vis.parser.impl.tag.provider.ListViewLmlTagProvider.create(ListViewLmlTagProvider.java:14)
    at com.github.czyzby.lml.parser.impl.DefaultLmlParser.processRegularTag(DefaultLmlParser.java:525)
    at com.github.czyzby.lml.parser.impl.DefaultLmlParser.processTagEntity(DefaultLmlParser.java:333)
    at com.github.czyzby.lml.parser.impl.DefaultLmlParser.processTag(DefaultLmlParser.java:308)
    at com.github.czyzby.lml.parser.impl.DefaultLmlParser.parse(DefaultLmlParser.java:139)
    at com.github.czyzby.lml.parser.impl.DefaultLmlParser.parseTemplate(DefaultLmlParser.java:100)
    ... 4 more

DTD file

It would be nice to have a DTD file for the lml spec, so editors can validate and suggest proper document structure when writing lml templates.

VisUI 1.0.2 features support

  • VisWindow#setKeepWithinParent attribute.
  • FloatingGroup tag.
  • FloatingGroup support in DragPane.
  • Spinner tag.
    • int.
    • float.
    • BigDecimal.
    • Array.

VisUI 1.0.2 is likely to be released soon. gdx-lml-vis 1.6 is going to use this VisUI version, so we want to support the new features before 1.6 is made public.

LmlView without Stage

Hi,
I would like to know if there is a way to have LmlView without stage. I know LmlView interface has method getStage(), What am trying to achieve is have all ui in lml and have game screen without stage just normally drawing sprites using batch. Is there easy way todo it?

I am aware that there is LmlApplicationListener(Game) and AbstractLmlView(Screen) that can be used but AbstractLmlView has stage and LmlView interface defines getStage method.
So i was thinking if i implement my own LmlView and method getStage returns null that could do the job. But i would like some better solution then returning null or returning empty stage.
The same goes for ViewController which implements LmlView again there is method getStage but that class belongs to Autumn MVC, i would like to avoid autumn for now.

Is there possibility that getStage method gets moved from LmlView to AbstractLmlView or StageLmlView?

Thanks.

Edit.
I found solution to my question so closing the issue.

Parameterizing localization strings with arguments

Following this example from wiki @key|only|@arg I'm trying to pass argument to localized string as parameter:

<vislabel>@key|{arg}</vislabel>

But as result parser searches for key|{arg} key in bundle (and crushes when not found).

Am I missing something?

Application crash on VisLml with Turkish locale

Issue details

Application crashes completely if your Locale.getDefault() is Locale.forLanguageTag("tr");

Reproduction steps/code

https://garygregory.wordpress.com/2015/11/03/java-lowercase-conversion-turkey/

Version of LibGDX and/or relevant dependencies

Libgdx 1.9.4 +

Stacktrace

com.github.czyzby.lml.util.LmlParsingException: Error occurred during parsing near line 31 of the original file: "main-menu.lml".
REASON: Unable to parser alignment from raw data: right; no alignment value matching: right
	Due implementation of the parser, the real problematic line might SLIGHTLY vary from the given line number(s), but exception message should be clear enough to find the actual error.
	Currently parsed template part:
28 |VALID|             </vistable>
29 |VALID|         </vistable>
30 |VALID| 
31 |ERROR|         <vistable width="0.50%" height="1.00%" tablealign="right">
32 |     |             <myvistable id="main-coins-cont" onclick="main-coins-cont-click" visible="false" width="400" height="60" pad="10" tablealign="right">
33 |     |                 <visimage size="60" style="image-coin"/>
34 |     | 

Please select the affected platforms

  • [*] Android
  • [*] iOS (robovm)
  • [*] iOS (MOE)
  • [?] HTML/GWT
  • [?] Windows
  • [?] Linux
  • [*] MacOS

Viewport utilities

  • LetterboxingViewport (fit and screen viewport combination, useful for GUIs).
  • General viewports utilities class.

Creating a view without adding actors to Stage.

I like the way we can use LmlView and #createView() with actor injection. I find it a good way to centralize all the actions and actors I need in a class that are relevant to that view only, via @LmlActorand @LmlAction.

AbstractLmlView takes hold of the stage's draw, act, etc. methods, so I created a class implementing LmlViewand ActionContainerto achieve a similar behavior while keeping the control of the stage's methods.
This works great for displaying windows, dialogs or any Actors that are independent from the underlying scene:
ViewWhichExtendsMyAbstractClass view = lmlParser.createView(ViewWhichExtendsMyAbstractClass.class, template.lml);

This immediately displays the template and I get control of every actor and method if I simply define them with @LmlActor and @LmlAction inside that class.

Now, what if I want this same injection without adding the Actors to the stage? Or, in my case, what if I want to add the Actor to a Tableor a Containeralready in the Stage?

With LmlView#parseTemplate() and a separate ActionContainer I can get access to the actors via lmlParser.getActorsMappedByIds() but this gets tiring fast and does not allow me to centralize relevant LmlActionsand LmlActorsin the same class. I'm finding it much more practical to use annotations.

The question:
Is the any class besides LmlView that I can implement to get my LmlActions and LmlActors parsed without adding them to the Stage? Or some other solution I'm missing?

(Sorry for the long intro but it's in hopes that you correct me if I'm thinking the wrong way)

Autumn: Ability to remove event listeners from code

In some point I want to get more control over EventDispatcher, just like subscribe and unsubscribe from particular events right from the code.

It's useful when I instantiate objects by myself and thus they can't have injected fields and all the tricks with annotated methods. So I have to do all of that by my own code. One of those cases is related to events, what if I just want to some particular class to manage its event subscription on its own (like if this is poolable object and has init/reset methods).

EventDispatcher has ability to add listeners manually, but there is no way to remove them (boolean return value inside event method doesn't count).

What do you think, is it possible to extend EventDispatcher in that way?

And one a bit of off-topic question. In such cases, when I have no options but to inject Component instances by own code, is there any sort of Autumn context that holds all references of singleton system components (like classes annotated with Component or View), so I can easily access those instances from any place in code?

VisUI 1.2.3 features

  • ScrollableTextArea.
  • HighlightTextArea, Highlighter.
  • MultiSplitPane
  • BusyBar

Additionally to new widgets:

  • FileChooser#setSorting(FileSorting) and #setSortingOrderAscending
  • FileChooser.setSaveLastDirectory
  • FileChooser.focusFileScrollPaneOnShow
  • Spinner#setTextFieldEventPolicy (Broken in VisUI 1.2.3, TextFieldEventPolicy enum is private.)
  • MenuBar#setMenuListener

See changes.

Autumn MVC documentation

Hello, sorry this is not an issue. Not even a contribution. Just a series of questions/feedback.
But before that, congratulations and thank you for making this amazing framework. Being a Spring MVC user, i was very excited when i discovered this autumn mvc project.
While i was fascinated with tons of features autumn-mvc offers, i am left banging the walls. Because i just don't know how to use this. I have tried mvc-simple example, fiddled around with it, but that just as far i can go. I can do trivial stuff like create some actors in LML, create controllers. But that's it. When i about to start making a game, i just got stuck. For example, how can i use box2d here? How can i spawn actors into LML? How to have hero character? How to do scene2d actions?
I have read your readme files and wiki but not fruitful. In mvc-simple example, I tried to use new skin using @Skin, but then can't load with VISUI skin. How can import my own game asset (sprites). For now i rebuild VisUi raw asset and use as skin as stated here. I know what annotations/features are available, but just no idea how to use them. And i'm unsure what to put in Service layer.

tldr;
i hope its not too much if i ask some more complete game example. A simple jumper game with box2d will do. Or if box2d is too much, just some simple card game should suffice to demonstrate scene2d usage.

Thank you. Sorry for long post or sounding like complaining. Just my 2 cents.

Change macro sign to ':'

gdx-lml was inspired used @ sign for macros up to 1.5 version. Since DTD creator was introduced, LML templates now have a chance of being valid XML files - but @ is not a valid opening character for XML tags. However, : is. That is why gdx-lml and gdx-lml-vis starting from 1.6 will use : instead of @, which will break most of the existing templates.

  • Update macro sign in DefaultLmlSyntax.
  • Update docs in gdx-lml.
  • Update docs in gdx-lml-vis.
  • Update wiki and tutorials.
  • Fix tests projects: gdx-lml-tests and gdx-lml-vis-tests.
  • Fix other example projects using LML.

No way to print a dollar sign ($)?

If I try to put a $ literal in a label, it complains about action stuff. Escaping with a backslash doesn't seem to work either. I "fixed" it by setting a label's text to $ from Java every frame. It seems like it should be possible to escape it, no? HTML entities don't work either.

Event listener tags

There are several cases where you might want to add some actors to the stage after a delay, when certain condition is met (for example: a button is clicked). For now, you can solve it by attaching a standard listener, which invokes a Java method that loads another template - for example, the one containing dialog data. However, it would be really useful if you could solve this issue entirely with LML code:

<button>
  <onClick>
    <dialog> ... </dialog>
  </onClick>
</button>

In the example above, a Dialog instance would be shown on the screen when the Button is clicked, rather than immediately added to the stage.

Such tags could be added in two ways:

  • macros: data between their tags would be stored as simple string and parsed as soon as the event occurs to show the requested actors. This would require to parse the template multiple times (unless cache mechanism is added) for each event. The templates would be in a separate context: any arguments from the original file would not be accessible.
  • tags: a special group tag would have to be added. Actors would be parsed immediately along with the rest of the template and added to the specialized group, only to be stored until the event occurs. This would allow to create actors within the same context and keep local "variables" ({arguments}). Actors would be created unnecessarily if the event never occurs though, so macro solution would still be preferred if the event is expected to occur rarely.

I think both ways would have their uses and both should be available. ClickListener and ChangeListener are obvious choices, not sure if any other listeners should be added.

Create alternative gdx-setup

Since Autumn MVC is unlikely to make it to the third-party extensions and official gdx-setup does not support project templates (and isn't even written with LibGDX, which makes it awkward to extend), a separate setup tool would be nice. Especially since Dragome backend is being created and it should come with a proper setup tool.

General ideas:

  • Written in Kotlin: multiline strings and string templates will allow to easily create stuff like Gradle build files directly in code, without a separate template mechanism.
  • Based on LibGDX, ditches Swing and AWT. Isn't it ironic that a graphical applications framework uses another framework to create a graphical application that generates its projects?
  • Easier to maintain: Gradle allows to use the latest available release with +. When creating a new project, you'll most likely want to use the new versions of libraries anyway - by using +, maintainers of third party libraries will not have to update gdx-setup each time they make a release.
  • Support most features from the original gdx-setup.
  • Do not force any specific Gradle release, or include Gradle wrappers (unless asked to). Installing Gradle globally on the machine is the sensible way to go, so wrappers should be optional.
  • Include support for project templates. Instead of generating semi-empty project drawing BadLogic logo, you could use a template for ApplicationListener, ApplicationAdapter, Game, (LibGDX) AbstractApplicationListener (Kiwi), LmlApplicationListener (LML), AutumnApplication (Autumn MVC) or any other ApplicationListener implementation from external libraries. This should help setting up some more complex projects, especially for beginners, as they might lack their personal "template projects" that could be easily copied.
  • Responsive validation. Use VisUI forms to validate user input.
  • Internationalization. Use i18n bundles to make it possible to easily translate the tool.
  • Support for different JVM languages. Allow to optionally include extra JVM languages (that are pretty popular) like Kotlin, Scala or Groovy.
  • Use VisUI file chooser to add support for favorite directories. Remember basic preferences (last used package, etc.).
  • Dependency version customization. Defaults to + (latest), every library should be customizable. Keep versions in gradle.properties.

DTD ATTLIST not recognized in IntelliJ because of the comments for each attribute

In IntelliJ 16 (I haven't tested anywhere else), the dtd file attributes are not recognized (and therefore the content assist won't work) with the current format:

<!ATTLIST visslider
    <!-- CellSizeLmlAttribute -->
    size CDATA #IMPLIED
    <!-- TreeNodeLmlAttribute -->
    node CDATA #IMPLIED>

They get recognized removing the comments between attributes:

<!ATTLIST visslider
    size CDATA #IMPLIED
    node CDATA #IMPLIED>

Or creating an ATTLIST for each attribute:

<!-- CellSizeLmlAttribute -->
<!ATTLIST visslider size CDATA #IMPLIED
<!-- TreeNodeLmlAttribute -->
<!ATTLIST visslider node CDATA #IMPLIED>

This last one would make the file even bigger, but would allow the comments to persist, though I don't know if they're really necessary (for the user) inside the dtd file.

Wiki clean up

  • Update all examples.
  • Remove syntax page.
  • Adds tips and tricks.
  • Step-by-step tutorial: a simple gdx-lml-vis application.
  • Separate old tutorial into multiple parts.

Spinner doesn't fire change events on input

I've spotted that unlike other input widgets, Spinner doesn't trigger ChangeEvent when you type anything in the field. ChangeEvent get fired only if one of the increment/decrement buttons has been pressed or user hit Enter.

There is no any ability to switch that behavior.

Simple fix could look like this (IntSpinnerModel for example):

@Override
public void textChanged () {
    String text = spinner.getTextField().getText();
    if (text.equals("")) {
        current = min;
    } else if (checkInputBounds(text)) {
        current = Integer.parseInt(text);
        spinner.notifyValueChanged(true); // <--- here it is
    }
}

Clear gdx-kiwi javadocs

gdx-kiwi was one of the first projects and hasn't been ever drastically refactored - it contains simple utilities, so it never really needed any major improvements or rewrites. While there are no doc errors, it generates over 100 warnings, which flood the console on each javadoc Gradle task. This is the only project with any warnings using the default javadoc setting.

  • common package.
  • asset package.
  • collection package.
  • file package.
  • preference package.
  • reflection package.
  • scene2d package.
  • tuple package.

UEDI for LibGDX

  • uedi-api implementation using LibGDX reflection abstraction.
  • gdx-lml-uedi library - a simpler alternative to Autumn MVC.
  • gdx-lml-uedi-tests example project, showing usage of most features.
  • Unit tests of gdx-uedi.
  • At least two project templates in the new gdx-setup: basic usage and something like the advanced Autumn MVC example. (Maybe the same application, converted to UEDI.)

Unsettlingly Easy Dependency Injection is a very simple dependency injection framework with automatic component scanning. Instead of flooding the code with annotations, the user of the library has to implement one of the so-called component interfaces and that's it: instance of the class will be created and all of its empty non-transient, non-primitive fields will be filled with values from the context. Thanks to powerful factories and providers, new filled objects can be created with little or no reflection.

The best part about UEDI: it's highly non-invasive. Consider the following code:

public class SomeClass {
  AssetManager assetManager = ((MyApplication) Gdx.app.getApplicationListener()).getAssetManager();
  Texture texture;

  public SomeClass() {
    assetManager.load("images/image.png", Texture.class);
  }

  public void onLoad() {
    texture = assetManager.get("images/image.png", Texture.class);
  }

  // Game logic.
}

If you're not a fan of statics, your code might look like this. With UEDI packed with some LibGDX-specific providers, your this class might look like this:

public class SomeClass implements Singleton {
  AssetManager assetManager; // Remove if reference no longer needed.
  Texture image; // Found by name, injected when loaded by the global asset manager.

  // Game logic.
}

And that's it. UEDI does not force you to learn it's whole API: it encourages using standard LibGDX classes, but with all the loading and wiring boilerplate code removed. Use meaningful names and you're fine. You just have to remember names of a few interfaces and use Context instance from time to time.

Why? Autumn MVC is complicated. And huge. And makes GWT compilation even longer, and includes even more GWT meta-data to work correctly.

Yes, it's powerful and allows you to define custom annotations with scanner that can do anything, but it also heavily floods your code with its specific APIs. I doubt there are many Autumn MVC users out there simply because of its learning curve and the fact that I don't have enough time to create tutorials for everything. The javadocs are OK, but it's certainly not enough. It's a great tool once you learn to use it, although the fact that the author is probably its only user in the world, is not very encouraging to get to know it in the first place.

UEDI, on the other hand, should allow to convert an existing project in the matter of minutes(/hours), simply by removing all the spaghetti wiring and asset loading by letting UEDI do its job: injecting it all for you.

Goals:

  • Support as much UEDI features as possible (except for interfaces mapping, as it's unsupported by LibGDX reflection API).
  • Easy integration with LML and existing LibGDX applications in general.
  • Gentle learning curve, provided the user is already familiar with LibGDX.
  • As little reflected classes in GWT as possible.
  • Utilities for managing multiple views, loading assets, handling preferences, i18n and music.

Update gdx-lml-vis-tests

gdx-lml-tests project was recently slightly "refactored", as it gained a new skin. Along with the graphical update, some example templates were changed to show the new features of 1.6 version (optional named attributes in macros). However, gdx-lml-vis-tests uses separate example templates based on gdx-lml-tests, mainly due to differences in skin assets - some of gdx-lml-tests examples wouldn't work in gdx-lml-vis-tests (and vice versa) due to missing drawables/styles.

While gdx-lml-vis-tests project works as expected, refreshing the examples would be nice.

One has to update gdx-lml-vis-tests example templates according to the gdx-lml-tests project, while correctly preserving the names of VisUI-specific skin assets.

LSS: LML Style Sheets

LML should support simple styling sheets with CSS-like syntax, which would allow to set up default values for common, repetitive attributes in chosen tags. Simple inheritance should be supported.

Websockets: No way to set server certification for SSL

The websocket API supports "secure" connections, but more is required than that to use them. There should to be a way to set the truststore and truststore password so the client can properly connect to the server. This can be done using this for desktop:
System.setProperty("javax.net.ssl.trustStore", "cacerts"); System.setProperty("javax.net.ssl.trustStorePassword", "changeit");

But unfortunately, this only seems to work on Desktop, and not Android, html5 (gwt) and ,most likely, iOS (I haven't tested iOS yet).

Sorry this isn't really an issue, it's more of a feature suggestion. But this is a very important feature. I have been trying to implement SSL communication that supports all platforms without any luck. If you know of any way it can be done, please let me know.

"onClick" attribute for Actor Label only runs the first time.

I don't know if this is expected behavior, but I've set an onclick in some Labelsbut the linked LmlAction only runs the first time I click.
Changing the Label to a TextButton works as aspected.

The reason I'm using labels is because I'm populating a Tree and don't want the background that buttons have. Maybe I'm missing a better alternative?
I noticed you used a Table and toggle buttons on gdx-lml-tests and like the look, but wouldn't allow me to achieve the tree child collapsing and expanding behavior.

I'm trying to achieve this look as seen on VisEditor:
aa

A way to pass extra params to ActorConsumer

I wonder if there is any way to pass some extra values to ActorConsumer? Assume we want to extend OnClickLmlAttribute attribute with click position and pass it down to action code. But it appears like ActorConsumer is restricted to get only actor from 'LmlAttribute' class. Disregard other solutions for obtaining pointer position, this question is about extending ActorConsumer restrictions. This will allow to write very generic actions for actors. Any plans on it?

XML-friendly macros

I understand that macros might be too complicated to make XML friendly, but given the fact that it's so useful to separate template parts into multiple files, an <:import or <:template tag might be much common than other macros.

I wonder if it's possible to include an attribute to appease the IDE.
Currently I'm doing, for example:
<:template "views/menubar.lml" />

Which could become cleaner doing:
<:template path="views/menubar.lml" />
or
<:import template="views/menubar.lml" />

Is it possible?

SelectBoxLmlTag forces to use only strings for items

I'm trying to unify some filling code for VisSelectBox in my LML.
Like so:

<visselectbox>
    <:evaluate method="fillWithItems" id="selectBox"/>
</visselectbox>

And action looks like this:

@LmlAction("fillWithItems")
public void fillWithItems(VisSelectBox selectBox) {
    Array<Item> items= new Array<>();
    // Fill items with objects ...
    selectBox.setItems(array);
}

The problem comes from parser that calls SelectBoxLmlTag#doOnTagClose(), precisely next line:

// Forcing items update.
getSelectBox().setItems((String[]) getSelectBox().getItems().toArray(String.class));

and I get java.lang.ArrayStoreException.

I want to reference real objects and not plain strings letter. Maybe I'm wrong at something and should use another approach to fill my collection based widgets with same data?

Thanks!

Support for different units in width/height

Hello, do you have any plans to include support for custom units in the width/height or even positions of actors?
I'm implementing a game with a pixel-perfect UI viewport, with actors' sizes defined in DPs (like Android) and this would be pretty useful for me and maybe for others.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.