Git Product home page Git Product logo

overlap2d-runtime-libgdx's Introduction

##overlap2d-runtime-libgdx

The overlap2d-runtime-libgdx provides functionality to load, manipulate and render scenes generated by Overlap2D Editor. To be used with libGDX projects. Thanks to roboVM this will work also on iOS.

Overlap2D runtime is based on entity component system (which libGDX supportive incarnation is Ashley)

##IMPORTANT - old runtime users

If you were using the old runtime, and have to use it for your old projects, here is the url for all old resources: http://overlap2d.com/pre-0-1-0-stuff/

##Setting Up

If you are using gradle, yo can just add this line to your dependecies:

$ compile "com.underwaterapps.overlap2druntime:overlap2d-runtime-libgdx:0.1.2-SNAPSHOT

Otherwise just download this as sources, and include in your project by any means you see comfortable.

Important Make sure you also have libGDX, and free type fonts library in your dependencies.

When creating new project, why not use libGDX setup app? Here are the instructions: http://overlap2d.com/overlap2d-is-just-one-checkbox-away-with-libgdx-official-setup-app/

When generated the project, just make sure to change the version of overlap2d runtime to 0.1.2-SNAPSHOT (this will be updated soon)

##Using Spine with your o2d runtime Spine is not included by default, instead it's kind of an external plugin. Because Spine runtime is not in maven, here is the hell you have to go throguh:

  1. Get spine runtime for it's official github, and make sure it is included in your project.

  2. Add this to your settings.gradle:

    $ include 'spine-o2d-extension' $ project(':spine-o2d-extension').projectDir = new File(settingsDir, 'overlap2d-runtime-libgdx/extensions/spine')

  3. in your build.gradle, add this:

    project(":spine-o2d-extension") {
        apply plugin: "java"
        sourceSets.main.java.srcDirs = ["src/"]

        dependencies {
            compile project(":spine-runtime-libgdx");
            compile project(":overlap2d-runtime-libgdx");
            compile fileTree(dir: 'libs', include: '*.jar')
        }
    }

Also add this to dependencies: $ compile project(":spine-o2d-extension")

Also, after initializing scene loader, add: $ sceneLoader.injectExternalItemType(new SpineItemType());

##Getting started After you are all setup, and assets are exported, here is a sample code to get things rendered

in your create method:

    viewport = new FitViewport(800, 480); // this should be the size of camera in WORLD units. make sure you check that in editor first.
		sl = new SceneLoader(); // default scene loader loads allr esources from default RM as usual.
		sl.loadScene("MainScene", viewport); // loading scene as usual

in your draw method:

    Gdx.gl.glClearColor(0, 0, 0, 1);
		Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
		sl.getEngine().update(Gdx.graphics.getDeltaTime()); // getting the ashley engine and updating it (it will render things with it's own render system)

overlap2d-runtime-libgdx's People

Contributors

alpha200 avatar azakhary avatar bionicfelps avatar emaxe avatar erodozer avatar gevorg-kopalyan avatar jeremiahreichardt avatar jtakakura avatar leruaa avatar pkayjava avatar pretzel777 avatar saqsun avatar sasun avatar simoarpe avatar underwaterhayk avatar zepplondon 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

overlap2d-runtime-libgdx's Issues

Failed when editing physics

I tried to follow this tutorial http://overlap2d.com/making-physics-based-side-scroller-project-setup-part-1/ and when I edit physics for a ball, editor freezes.

java.lang.NullPointerException
at com.uwsoft.editor.b.d.a.b.b(ItemPhysicsEditor.java:137)
at com.uwsoft.editor.b.d.b.as.clicked(ItemPhysicsDialog.java:269)
at com.badlogic.gdx.scenes.scene2d.utils.ClickListener.touchUp(ClickListener.java:89)
at com.badlogic.gdx.scenes.scene2d.InputListener.handle(InputListener.java:57)
at com.badlogic.gdx.scenes.scene2d.Stage.touchUp(Stage.java:348)
at com.badlogic.gdx.InputMultiplexer.touchUp(InputMultiplexer.java:96)
at com.badlogic.gdx.backends.lwjgl.LwjglAWTInput.processEvents(LwjglAWTInput.java:356)
at com.badlogic.gdx.backends.lwjgl.LwjglAWTCanvas.render(LwjglAWTCanvas.java:257)
at com.badlogic.gdx.backends.lwjgl.LwjglAWTCanvas$1.paintGL(LwjglAWTCanvas.java:95)
at org.lwjgl.opengl.AWTGLCanvas.paint(AWTGLCanvas.java:339)
at org.lwjgl.opengl.AWTGLCanvas.update(AWTGLCanvas.java:368)
at sun.awt.RepaintArea.updateComponent(RepaintArea.java:255)
at sun.awt.X11.XRepaintArea.updateComponent(XRepaintArea.java:60)
at sun.awt.RepaintArea.paint(RepaintArea.java:232)
at sun.awt.X11.XComponentPeer.handleEvent(XComponentPeer.java:591)
at java.awt.Component.dispatchEventImpl(Component.java:4948)
at java.awt.Component.dispatchEvent(Component.java:4698)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:740)
at java.awt.EventQueue.access$300(EventQueue.java:103)
at java.awt.EventQueue$3.run(EventQueue.java:699)
at java.awt.EventQueue$3.run(EventQueue.java:697)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
at java.awt.EventQueue$4.run(EventQueue.java:713)
at java.awt.EventQueue$4.run(EventQueue.java:711)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:710)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)

SpineActor bones and slots

Hey, as I was thinking I thought if it's possible to have a naked character with spine animation, and attach/equip other objects (helmet, vest, jeans, weapons, basket, baseball bat etc) to bone endings and on spine runtimes repo i found there's a slot.java and attachment.java and it was in SpineActor.java too (a few versions ago with Skeleton). I'd like to see a method .getSkeleton() or something in spineactor, so i can add other objects to an existing animation.

[Bug] Physics bodies inside Composite Items are not positioned relative to the composite item

Reproduction:
Drag an image into the scene
Make it a composite item
Enter the composite item
Give the image a polygon component and physics component
Move the object to 10, 10 inside the composite
Step out of the composite
Move the composite to 5, 5

Load the Scene in LibGdx with a Box2D debugRenderer
See that the physicsObject is at 10, 10 World coordinates although it should be at 15, 15
See that the textureComponent is at 15, 15 World coordinates where it belongs.

Changing processBody so that the physicsBody's Transform is set to the right place ( parentTransformPosition + transformPosition ) moves the body to the right place (15, 15) but moves the textureComponent to the wrong place (20, 20).

Add a proper License

The code repository & website lack what license the software & source are released under. While it's available freely and forkable on github this does not necessarily mean I can do anything with it. It would be helpful to indicate what the license is to let us know what we can and can't do with the source here.

Thanks

Rendering images with polygon sprite type

Hello, I am not sure if this is runtime problem, or problem with exporting scene from Overlap2D, but in my opinion it's pretty important bug.

In the first picture, you can see images in Overlap2D with their default properties, and polygon component added. Under it, there is the same scene rendered in-game, and everything is as it should be.
rendering1

In this picture, I've set Sprite Type of the blue square from SQUARE to POLYGON under Render Properties. Except the offset bug I addressed here UnderwaterApps/overlap2d#376, there is another bug that only happens in-game. As you can see, all objects have the same image now - the image from the polygon that has Sprite Type set to POLYGON. There is also some kind of line that I marked in red circle. This makes it difficult to edit terrain under my character, as all objects will get the image from the terrain.
rendering2

The font doesnt render correctly.

When rendering with the Overlap2dRenderer the letters are out of place and the font doesnt look right.
Im finding that the bug happens in my gdxlib application and in the overlap2d editor here for a pull request with the most recent libraries.

This is Arial size 20 and should say "Label".

label

Here it should say "press the screen to skip" in kenvector_future font.

skip

Several Issues regarding VO's and Actors

I am just copy pasting bugs reported by Krismu in the forums.

Bug in the MainItemVo constructor:

if(tags != null) tags = Arrays.copyOf(vo.tags, vo.tags.length);

should be replaced with:
if(vo.tags != null) tags = Arrays.copyOf(vo.tags, vo.tags.length);

And initialization of CompositeActor in processMain() should copy the item identifier to the Actor’s name, it would make multiple levels children search a lot easier. It should not have any side effect because the name is not set or used anywhere else, as far as I know.

Thanks

Issue a coding standard format to the project

Right now in the repository, tons of files are not following a consistent format. There are lines that are not indented using tabs instead of spaces, there are lines where the braces break at different locations than others.

Using the standard eclipse formatter over the entire project could help, but it'd be nice to establish a standard format to use on the project. This could be done by creating all the settings in eclipse and exporting that eclipse format to an xml file. Packaging that formatter with the project will insure everything looks fine.

feature request: Custom DrawLogic

Hi,

Could you please implement some kind of custom DrawLogic for a sprite item with a specific tag?

My end goal is to make custom player object which will be generated procedurally. Basically, it could be considered as an array of points connected with a line.

Adding such kind of item type into O2D editor and runtime could be time consuming (e.g. implement something similar to spine external extension). That's why, as a workaround, I want to use standard sprite (or other suitable) item with some specific tag but need a way to completely redefine its drawing logic to draw its points connected with a line using ShapeRenderer or BatchRenderer with custom shader.

Please, correct me if I misunderstood something and many thanks!

java.lang.ClassCastException when using proguard

I enable proguard and install app on device using the following command:
gradlew android:installRelease android:run
I have this error from adb log:
E/AndroidRuntime( 8800): java.lang.ClassCastException: com.badlogic.gdx.utils.JsonValue cannot be cast to com.uwsoft.editor.renderer.data.SceneVO E/AndroidRuntime( 8800): at com.uwsoft.editor.renderer.resources.ResourceManager.initAllResources(SourceFile:96) E/AndroidRuntime( 8800): at com.uwsoft.editor.renderer.SceneLoader.<init>(SourceFile:63) E/AndroidRuntime( 8800): at com.example.mygame.r.create(SourceFile:15) E/AndroidRuntime( 8800): at com.badlogic.gdx.backends.android.AndroidGraphics.onSurfaceChanged(SourceFile:280) E/AndroidRuntime( 8800): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1550) E/AndroidRuntime( 8800): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1278)

R.U.B.E

You should add RUBE into overlap2d, it'll be fun to be able to create physics scenes in RUBE then import it into overlap2d and add scripts to different objects.

https://www.iforce2d.net/rube/

Crash when pressing root element in elements tree

When I am trying to select root element(actually i am trying to set background for it, if it is possible) Overlap2D says: "We are so embarrassed.... run this app again".

Here is screenshot http://screencloud.net/v/uqZg

OS - Ubutu 14.04
Java: java version "1.7.0_72"
Java(TM) SE Runtime Environment (build 1.7.0_72-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.72-b04, mixed mode)

PhysicsBodyComponent.body is null

When an entity is created and added to the system, PhysicsBodyComponent.body will not be instantiated.
It only gets instantiated after a null check in PhysicsSystem::processBody(). This means that we would have to wait for 1 engine tick in order to be sure all physics objects are properly instantiated.

A fix would be to call PhysicsBodyLoader::createBody() from ComponentFactory::createPhysicsComponents(). At that point we have all the information we need to build the physicsbody if I am not mistaken.


SpineComponentFactory::createComponents(...)and CompositeComponentFactory::createComponents(...)both call

ComponentFactory::createCommonComponents(entity, vo, ...);
ComponentFactory::createPhysicsComponents(entity, vo)

practically creating the same object twice. In case we call PhysicsBodyLoader::createBody() from ComponentFactory::createPhysicsComponents() it even creates two bodies at the same spot.


Maybe also implementing float PhysicsBodyComponent.initialAngle and Vector2 PhysicsBodyComponent.initialPosition could make it easier to instantiate an object at the right position and rotation ?

Double creating of spriterAnimations

EntityFactory line 299.
for (int i = 0; i < vo.sSpriterAnimations.size(); i++) {
Entity child = createEntity(entity, vo.sSpriterAnimations.get(i)); engine.addEntity(child);
}
is duplicated.

is there any demo for spine?

in the editor i add a test spine animation, and add tags.when i int my code do this . sl.addComponentsByTagName("spine", SpineObjectComponent.class);
it went wrong with no tags.

overlap2d-runtime-libgdx doesn't work without freetype and box2D?

I'm trying to reduce apk size. I don't use box2D in my game.
Is there any possibility to exclude box2D from overlap2d-runtime-libgdx?

java.lang.ExceptionInInitializerError at com.uwsoft.editor.renderer.SceneLoader.initSceneLoader(SceneLoader.java:83)
Caused by: com.badlogic.gdx.utils.GdxRuntimeException: Couldn't load shared library 'gdx-box2d' for target: Linux, 32-bit

run error with platformer_tutorial

I download platformer_tutorial and change extensions to newer version. I use gradle 2.6 to build project. When i run desktop it output the following error:

:\Projects\libgdx\platformer_tutorial\core\src\com\uwsoft\platformer\PlatformSy
stem.java:19: error: type argument PlatformComponent is not within bounds of typ
e-variable T
    private ComponentMapper<PlatformComponent> platformComponentComponentMapper
= ComponentMapper.getFor(PlatformComponent.class);
                            ^
  where T is a type-variable:
    T extends Component declared in class ComponentMapper
Note: E:\Projects\libgdx\platformer_tutorial\core\src\com\uwsoft\platformer\Plat
formSystem.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
2 errors
1 warning
:core:compileJava FAILED

Runtime does not have shaders

In the editor, add any shader to an image and although it will compile and display fine while editing the scene, in the runtime the shader does not appear. Furthermore, retrieving the shader from the shadercomponent returns an NPE, indicating that the shaderprogram doesn't even exist.

ButtonSystem update is overrided by LayerSystem

Hi The problem is.
After I create a Button on Overlap2d tool. In code, I add ButtonComponent to Entity.
After Debug. I can see the ButtonSystem is updating the button.

               if(childZComponent.layerName.equals("normal")) {
                    childMainItemComponent.visible = true;
                }
                if(childZComponent.layerName.equals("pressed")) {
                    childMainItemComponent.visible = false;
                }

But LayerSystem is updating the button too. in method updateLayers()

if(layerMapComponent.getLayer(zindexComponent.layerName) != null) {
                mainItemComponent.visible = layerMapComponent.getLayer(zindexComponent.layerName).isVisible;
            }

I think it is because the Button I created has CompositeTransformComponent too.

And I check the Engine systems.
The update order is like this
LayerSystem -> Overlap2dRender -> ButtonSystem.

So result is ButtonSystem is override by LayerSystem before Render.

To fix this. I can update the EntitySystem property priority. but Engine does not update order by calling
systems.sort(systemComparator);

and getSystems return ImmutableArray, so I can not update order.

QuickFix:

sceneLoader.getEngine().getSystem(Overlap2dRenderer.class).priority = 1;
sceneLoader.getEngine().addSystem(new ButtonSystem());
to update the order. 

PS. English is not my strong suit. Sorry...

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.