Git Product home page Git Product logo

mini2dx's Introduction

mini2Dx

Continuous Integration

A high-level game development API for LibGDX inspired by Slick

Goals

The main objective of mini2Dx is to provide a beginner-friendly, master-ready framework for rapidly prototyping and building 2D games in Java.

What's New

20th April 2019

1.9.0 has been released as another in-between version of the 1.x API and 2.0 API. It is recommended upgrading to 1.9.0 to ease the transition to 2.0 later on. As previous stated, 1.9.x will only receive bug fixes and optimisations going forward. Once 2.0 is released, 1.9.x will be 100% community-driven.

10th November 2018

1.8.0 has been released as an in-between version of the 1.x API and 2.0 API. It is recommended upgrading to 1.8.0 to ease the transition to 2.0 later on. As previous stated, 1.8.x will only receive bug fixes and optimisations going forward. Once 2.0 is released, 1.8.x will be 100% community-driven.

10th June 2018

This is repository will be focused on development of the next generation of mini2Dx - 2.0. For 1.x development, see the mini2Dx Vintage Edition repository. 1.x will receive bug fixes and optimisations during 2.0 development. Once 2.0 is released, 1.x will be 100% community-driven.

License

The project is licensed under the BSD 3-Clause License.

Assets used for UATs are licensed under Creative Commons (Kenney.nl, Alexander Ehlers, Juan Rodriguez)

However, some classes are based on LibGDX's code and are licensed under the Apache License Version 2.0 per LibGDX's license. Such classes are placed under com.badlogic.gdx packages.

Contributing

See the Contributing Page

mini2dx's People

Contributors

augustozanellato avatar born2snipe avatar caidanw avatar dsallen7 avatar gitter-badger avatar khazrak avatar peanutbother avatar przemektomczyk avatar thomasyoungson avatar tomcashman avatar viscousvortex avatar wleroux avatar zweistein2 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mini2dx's Issues

TextureRegions rendered upside down

I noticed that rendering TextureRegions via Graphics.drawTextureRegion renders them upside down, despite normal Textures rendering correctly. For instance, the following code:

    @Override
    public void initialise() {
        sheet = new Texture("player_sheet.png");
        region = new TextureRegion(sheet, 0, 0, 24, 32);
    }

    @Override
    public void render(Graphics g) {
        g.setBackgroundColor(Color.GREEN);
        g.drawTextureRegion(region, 10, 10, 24, 32);
        g.drawTexture(sheet, 40, 40);
    }

Produces the following output:

screen shot 2015-08-11 at 17 32 14

A workaround to this seems to be using negative height plus some vertical offset to make the TextureRegion render in the same location as the original image. Changing the call to this:

        g.drawTextureRegion(region, 10, 10 + 32, 24, -32);

Produces the following output:

screen shot 2015-08-11 at 17 39 00

I'm looking into how to set up the core libraries in my computer to see if I can patch this behaviour and send back a pull request to this project. In the meantime I thought it was a good idea informing you about this bug.

LwjglApplicationConfiguration is missing

I tried to set up a maven project following the documentation here:

https://github.com/tomcashman/mini2Dx/wiki/Maven-Support-0.9.1-release

I see that the class supposed to be a part of libgdx but it isn't there. Here is my pom.xml:

    <repositories>
        <repository>
            <id>gdx-nightlies</id>
            <name>libgdx</name>
            <url>http://libgdx.badlogicgames.com/nightlies/maven</url>
        </repository>
        <repository>
            <id>mini2Dx-thirdparty</id>
            <name>mini2Dx-thirdparty</name>
            <url>http://mini2dx.org/nexus/content/repositories/thirdparty</url>
        </repository>
        <repository>
            <id>mini2Dx</id>
            <name>mini2Dx</name>
            <url>http://mini2dx.org/nexus/content/repositories/releases</url>
        </repository>
    </repositories>
    <dependencies>
        <dependency>
            <groupId>org.mini2Dx</groupId>
            <artifactId>mini2Dx-core</artifactId>
            <version>0.9.1</version>
        </dependency>
        <dependency>
            <groupId>org.mini2Dx</groupId>
            <artifactId>mini2Dx-tiled</artifactId>
            <version>0.9.1</version>
        </dependency>
        <dependency>
            <groupId>org.mini2Dx</groupId>
            <artifactId>mini2Dx-dependency-injection</artifactId>
            <version>0.9.1</version>
        </dependency>
        <dependency>
            <groupId>org.mini2Dx</groupId>
            <artifactId>mini2Dx-ecs</artifactId>
            <version>0.9.1</version>
        </dependency>
        <dependency>
            <groupId>org.mini2Dx</groupId>
            <artifactId>mini2Dx-dependency-injection-desktop</artifactId>
            <version>0.9.1</version>
        </dependency>
    </dependencies>

Intersection logic is inaccurate for certain intersections

For the following:
LineSegment 0,0 -> 128, 128
Rectangle -> 96, 0 with width and height of 32

The intersection between the LineSegment and the Rectangle returns true when it is in face false. This is caused by two problems:

The LineSegment-LineSegment intersection method needs to use Fanklin Antonio's methodology for fast detection.

The Rectangle-LineSegment intersection method needs to use LineSegment intersections with each side of the rectangle.

Update the unit tests to test for this.

Unzipping issue

Hi,

I have downloaded the zip file from here , supposed to be for Linux but when attempting to unzip from command line, unzip command throws:

Archive:  mini2Dx-project-generator-linux.zip
  End-of-central-directory signature not found.  Either this file is not
  a zipfile, or it constitutes one disk of a multi-part archive.  In the
  latter case the central directory and zipfile comment will be found on
  the last disk(s) of this archive.
unzip:  cannot find zipfile directory in one of mini2Dx-project-generator-linux.zip or
        mini2Dx-project-generator-linux.zip.zip, and cannot find mini2Dx-project-generator-linux.zip.ZIP, period.

I removed and redownloaded the file many times, always with this md5sum:

dccc3498a900b19a5aa2d57d1977b7bd  mini2Dx-project-generator-linux.zip

Any idea?

Add non-rectangle support to RegionQuad

Currently RegionQuad only supports CollisionBoxes but it should also support CollisionCircles and any polygonal collision implementation.

To do this, the following needs to occur:

  • Add near 100% test coverage to Rectangle and Circle classes (#53)
  • Add micro benchmarking to Rectangle and Circle classes to prevent performance degradation (#54)
  • Add Shape#intersects(Shape) method and implementations (#45)
  • Add Polygon implementation, tests and rendering (#45)

Update Sprite's position

You set your Sprite's start position in the initialise()-function, but how do later change the x/y-values? Like, getting the Sprite to move?

Access GameScreen variables of non active GameScreens

Is there a way to access objects of GameScreens that are not active at the moment?
If not, could you please add the method "GameScreen getGameScreen(int id)" to "org.mini2Dx.core.screen.ScreenManager"? Then it would be possible to access any inactive screen by writing

anyValue = ((OtherGameScreen)screenManager.getGameScreen( id )).getAnything()

Wrong update timer passed to Screen

In the class GameContainer you have the lines

if(delta > MAXIMUM_DELTA)
delta = MAXIMUM_DELTA;

in the method render( float delta)

The result is that the update method of the Screens get the wrong update time and the game may slow down. This makes no sense in my opinion as the game speed should be the same on all machines. I have a sample here where the update time of a Screen accumulates to 4s in 12s real time - means the game slows down 3 times.

Is there a special reason for this or would you remove this?

Add support for isometric and hexagonal Tiled maps

We currently only support orthogonal maps through the OrthogonalTileLayerRenderer.

Need to add support for isometric and hexagonal maps as per the TMX format specification. These would be implemented in IsometricTileLayerRenderer and HexagonalTileLayerRenderer classes.

Set image/texture color?

Is there a way to set image/texture color?
In slick2d I was able to just set it using g.setColor() and then draw image.
There was also another way using image.setColor(corner, r, g, b); (useful for lighting system).

No access to tile property

In .tmx files it is possible to define properties per tile. As far as I can see these properties are not accessible? I am searching for something like

TiledMap.getTileProperty(int tileid, String propertyName, String defaultValue) or
TileLayer.getTileProperty(int tileid, String propertyName, String defaultValue)

Could you add the access to the tile properties or explain how to access them if you have already implemented this?

Add few missing methods/class from slick2d

I'm trying to port two games from slick2d.
I'm missing few method /classes:
g.fillShape(shape);
(it will be faster to type than each time g.fillRect(rect.getX(),rect.getY(),rect.getWidth(),rect.getHeight());.
g.texture(); (shape with texture)
Method contains(x,y) in circle class.
And the my main problem is missing Polygon.class
In slick2d it was very useful to creating any shapes and making collision.(polygon.addPoint(x,y)....)
Is it possibile to add them?
Thanks

Generator project - build failed

I can't generate project...

Could not resolve com.battlebardgames.parcl:parcl:1.0.6.
> Could not get resource 'http://maven.mini2dx.org/content/repositories/releases/com/battlebardgames/parcl/parcl/1.0.6/parcl-1.0.6.pom'.
> Could not GET 'http://maven.mini2dx.org/content/repositories/releases/com/battlebardgames/parcl/parcl/1.0.6/parcl-1.0.6.pom'. Received status code 503 from server: Service Unavailable
BUILD FAILED.

Generator was downloaded from main project site.

Inform Screens on resize/pause/resume

On Android a resize() of the Game class is called if the screen changes the orientation and resume()/pause() is called if the game has been sent to the background. It would be great if the Screens would be informed about this by adding the methods resize(int x, int y), pause() and resume to the interface GameScreen.

Add "enter()" method in GameScreen

The "initialise()" method is only called once in the GameScreen, could you add a method like "enter()" in Slick that is called every time the screen is entered?

Tiled Collisions Example - Failure to import TiledObject, TiledCollisionFactory, etc. after update

I tried to update my mini2dx project to the latest version, in eclipse, by doing Gradle refresh all after changing the version field in the build.gradle file to 1.1.0. I then looked in my Gradle Dependencies library under core and saw mini2dx-core-1.1.0.jar has been installed, but it doesn't have the Tiled package: "org.mini2dx.tiled". Am I doing something wrong in the update process or is something wrong on your end?

Thanks,
James

Server down error 503

Animation flips Sprites by default

Originally reported on Gitter by Jack Sullivan

I noticed something a bit odd when working with org.mini2Dx.core.graphics.Animation. Specifically, since flipY is set by default on the mini2Dx Sprite class, but it is not set on Animation when one naively creates a new Animation and loads it with sprites, they all render upside down. I'd change the constructor to check whether the type parameter is a mini2Dx sprite and set the flips accordingly. Alternatively you could set the flips in addFrame when it is first called.

Couldn't load shared library 'gdx-freetype' - android

FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal("fonts/font.ttf"));

On desktop computer it works well but on android device gives error:

E/AndroidRuntime(29266): com.badlogic.gdx.utils.GdxRuntimeException: Couldn't load shared library 'gdx-freetype' for target: Linux, 32-bit

Scalling tilemaps

I want use g.scale in order to makes tilemap looking exacly the same on different resolutions.
After I set scale tilemap is not rendered fully.
I think there should be option to include graphics scale in draw tilemap calculations.

Add possibility to set alpha value for sprites

In slick there exists the possibility to set the alpha values of images with image.setAlpha(float). As there is no access to SpriteBatch in mini2Dx

  • could you add such a possibility, too?

Add performance benchmarking to collision detection classes

To help prevent performance degradation, a benchmarking framework such as JMH needs to be added and performance tests need to be implemented. In the past the most common bottlenecks occurred in the following places:

  • Shape rotations
  • Intersection tests between rotated shapes
  • Detecting collisions inside complex RegionQuads

Gdx.input.isKeyJustPressed runs twice one each click

The Gdx.input.isKeyJustPressed is used so it doesn't evaluate true for holding down a key. This works fine in libgdx 1.6.4. On Mini2DX 1.1.0 this doesn't work.

The problem is that it runs twice. This is from the log that prints out every frame (from update-method):
1
1
1
1
1
1
1
1
DOWN
2
DOWN
3
3
3
3
3
3

I'm using ScreenBasedGame.
Here is the code to reproduce the error: (put in update-method).

if(Gdx.input.isKeyJustPressed(Input.Keys.UP))
{
System.out.println("UP");
currentChoice = currentChoice - 1;
if(currentChoice < 0)
{
currentChoice = 3;
}
}
else if(Gdx.input.isKeyJustPressed(Input.Keys.DOWN))
{
System.out.println("DOWN");
currentChoice = currentChoice + 1;
if(currentChoice > 3)
{
currentChoice = 0;
}
}
System.out.println(currentChoice);

extend Graphics for use with libgdx stages - allows access to all scene2d UI elements

Could you please extend the org.mini2Dx.core.graphics.Graphics class for the use with Stages (com.badlogic.gdx.scenes.scene2d.Stage)? This would allow to use text fields, sliders and a lot of other UI elements.

I did this adding the methods

public Stage createStage( float width, float height, boolean stretch ){
Stage stage = new Stage(width, height, stretch, this.spriteBatch);
return( stage );
}

public void drawStage( Stage stage){
endRendering();
stage.draw();
}

to the Graphics class. In the Screen its then possible to create a Stage with the line
Stage stage = g.createStage(Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), false);

The render process is done then via

g.drawStage(this.stage);

-- Just an implementation idea, perhaps you have a better one but this one works fine for me.

NullPointer in ScreenManager

At the beginning the variable currentScreen is null, the methods enterGameScreen and update dont check this and execute "currentScreen.postTransitionOut(transitionOut);" and "currentScreen.preTransitionOut(transitionOut);"

Mdx.playerdata.writeToJson won't serialize com.badlogic.gdx.utils.ObjectMap;

I have a class:

public class SaveGameData {
@field
private ObjectMap<String, InGameScreen> mapDataObjectMap;
/** more code */
}

The class InGameScreen has a couple of Strings annotated with @field.

When I try Mdx.playerData.writeJson(saveGameData, path);

The map is empty (I've put data in it and tested it to be sure that it was there).
(The json shows empty objects {} )

A normal HashMap can be serialized with the same data, but doesn't deserialized .
com.badlogic.gdx.utils.reflect.ReflectionException: Could not instantiate instance of class: se.codeslasher.legend.screens.InGameScreen
at com.badlogic.gdx.utils.reflect.ClassReflection.newInstance(ClassReflection.java:70)
at org.mini2Dx.core.serialization.JsonSerializer.deserialize(JsonSerializer.java:187)
at org.mini2Dx.core.serialization.JsonSerializer.setMapField(JsonSerializer.java:344)
at org.mini2Dx.core.serialization.JsonSerializer.setField(JsonSerializer.java:269)
at org.mini2Dx.core.serialization.JsonSerializer.deserialize(JsonSerializer.java:207)
at org.mini2Dx.core.serialization.JsonSerializer.fromJson(JsonSerializer.java:45)
at org.mini2Dx.desktop.playerdata.DesktopPlayerData.readJson(DesktopPlayerData.java:103)

Maybe implement support for custom serialization?
I really like the Mdx.playerdata so I hope this can be fixed (or another way of using it)

NinePatch Support

It would be nice if Mini2DX could have a NinePatch implementation for eg. Dialogs in RPG-games.

LibGDX uses:
NinePatch
NinePatchDrawable

But it uses SpriteBatch and I want to continue only using org.mini2Dx.core.graphics.Graphics.

org.mini2Dx.core.geom: Shapes are not related

If you have a Rectangle and a Circle (and more to come as far as I understand) it is really hard to store them in one structure (e.g. List) to work with them and to check their interceptions etc.

Do you plan to keep this concept of shapes that are not related or do you plan to change this. e.g to establish a superclass/interface "Shape" where all the other shapes are inherited from with intersects() and includes(), getCenterX(), getCenterY() methods?

Inaccurate Documentation?

The tutorial says to export "gdx.jar, gdx-freetype.jar, mini2Dx-core.jar, mini2Dx-dependency-injection.jar, mini2Dx-ecs.jar and mini2Dx-tiled.jar", but they aren't listed in the Order and Export tab, I assume because they weren't added to the class path during that part of the tutorial.

Optimise Graphics class

Currently the Graphics class is unoptimised for mixed rendering of shapes and textures. To fix this, the following refactoring needs to be done in the Graphics class:

  • Separate tracking of texture and shape rendering. ShapeRenderer cannot begin() if the SpriteBatch has already done so and vice versa.
  • Remove the shape cache and render all shapes to through the ShapeRenderer
  • Ensure transformations are persisted through both the ShapeRenderer and SpriteBatch render calls

synchronized structures are not available in gwt

If the target platform is HTML5 this is realized via gwt in libgdx. gwt does not support synchronized structures (ConcurrentHashMap etc) and it is required to modify your API source code for this platform. As far as I know the synchronized structures are not required as libgdx and gwt run single threaded.

Recipe for box2d integration

I'm attempting box2d integration and wasn't able to find a recipe that worked with your update/interpolate/render scheme. Perhaps a nice addition to the wiki? Based on this article and your basic concepts wiki I have this:

@Override
public void update(float delta) {
    world.step(delta, 6, 2);
}

final Array<Body> bodies = new Array<>();
@Override
public void interpolate(float alpha) {
    world.getBodies(bodies);
    for (Body body : bodies) {
        Transform transform = body.getTransform();
        Vector2 bodyPosition = transform.getPosition();
        Vector2 position = body.getPosition();

        position.x = bodyPosition.x * alpha + position.x * (1.0f - alpha);
        position.y = bodyPosition.y * alpha + position.x * (1.0f - alpha);
        // TODO the article was also setting angle, how to do that?
    }
}

@Override
public void render(Graphics g) {
    debugRenderer.render(world, g.getProjectionMatrix());
}

But I'm not sure it's correct. Any pointers to examples of correct integration between box2d and mini2dx?

NullPointer in Circle

The variable

private Vector2 center;

in the class org.mini2Dx.core.geom.Circle
is not initialized and any access to the circle x or y results in a NullPointer.

Animations restart doesn't restart it

The Animation Class's restart-method sets the "currentFrameIndex" to 0, but the time-variable "elapsed" is not set to zero, so the Animation continues as if it wasn't restarted due to update just adding to the elapsed-variable (which controls currentFrameIndex).

To fix:
Just add
elapsed = 0;
to the restart-method.

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.