GithubHelp home page GithubHelp logo

openfl / lime Goto Github PK

View Code? Open in Web Editor NEW
749.0 53.0 360.0 262.37 MB

A foundational Haxe framework for cross-platform development

Home Page: https://lime.openfl.org/

License: MIT License

Haxe 29.75% Java 2.03% C++ 8.69% C 0.46% Objective-C++ 0.06% HTML 0.10% JavaScript 53.31% Makefile 0.04% Shell 0.01% C# 0.57% CSS 4.92% Dockerfile 0.01% PowerShell 0.01% Roff 0.04%
haxe

lime's Introduction

MIT License Haxelib Version Build Status Community Discord Server

Lime

Lime is a flexible, lightweight layer for Haxe cross-platform developers.

Lime supports native, Flash and HTML5 targets with unified support for:

  • Windowing
  • Input
  • Events
  • Audio
  • Render contexts
  • Network access
  • Assets

Lime does not include a renderer, but exposes the current context:

  • Cairo
  • Canvas
  • DOM
  • Flash
  • GL

The GL context is based upon the WebGL standard, implemented for both OpenGL and OpenGL ES as needed.

Lime provides a unified audio API, but also provides access to OpenAL for advanced audio on native targets.

License

Lime is free, open-source software under the MIT license.

Installation

First install the latest version of Haxe.

Development Builds

When there are changes, Lime is built nightly. Builds are available for download here.

To install a development build, use the "haxelib local" command:

haxelib local lime-haxelib.zip

Building from Source

Clone the Lime repository, as well as the submodules:

git clone --recursive https://github.com/openfl/lime

Tell haxelib where your development copy of Lime is installed:

haxelib dev lime lime

The first time you run the "lime" command, it will attempt to build the Lime standard binary for your desktop platform as the command-line tools. To build these manually, use the following command (using "mac" or "linux" if appropriate):

haxelib install format
haxelib install hxp
lime rebuild windows

You can build additional binaries, or rebuild binaries after making changes, using "lime rebuild":

lime rebuild windows
lime rebuild linux -64 -release -clean

You can also rebuild the tools if you make changes to them:

lime rebuild tools

On a Windows machine, you should have Microsoft Visual Studio C++ (Express is just fine) installed. You will need Xcode on a Mac. To build on a Linux machine, you may need the following packages (or similar):

sudo apt-get install libgl1-mesa-dev libglu1-mesa-dev g++ g++-multilib gcc-multilib libasound2-dev libx11-dev libxext-dev libxi-dev libxrandr-dev libxinerama-dev

To switch away from a source build, use:

haxelib dev lime

Sample

You can build a sample Lime project with the following commands:

lime create HelloWorld
cd HelloWorld
lime test neko

You can also list other projects that are available using "lime create".

Targets

Lime currently supports the following targets:

lime test windows
lime test mac
lime test linux
lime test android
lime test ios
lime test html5
lime test flash
lime test air
lime test neko
lime test hl

Desktop builds are currently designed to be built on the same host OS

lime's People

Contributors

apprentice-alchemist avatar atom-b avatar chatziko avatar dimensionscape avatar fbricker avatar gama11 avatar gunnbr avatar hasufel avatar ibilon avatar james4k avatar jarbot avatar jgranick avatar joshtynjala avatar justin-espedal avatar kasparsj avatar larsiusprime avatar loudoweb avatar m0rkeulv avatar madrazo avatar majigsaw77 avatar matttuttle avatar mrcdk avatar player-03 avatar ruby0x1 avatar shaharms avatar starburst997 avatar tanis2000 avatar tobil4sk avatar tommyx12 avatar vizanto 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lime's Issues

Unresolved symbols for emscripten target

Ran into this problem on a previous project, then tried it in the default OpenFL project template. After compiling the OpenFL libraries for emscripten and upon compilation of the main js file, I get the following warnings:

screen shot 2013-12-20 at 2 03 06 pm

...which turn into errors in the js console:

screen shot 2013-12-20 at 2 05 21 pm

Any ideas? Would appreciate any help!

Continue cleanup of C++ code

Everyone has their own opinion about code style, and what leads to the best workflow, but as a matter of standards, I think it would be best to refactor the C++ project code (over time) to confirm to a single class, with its own header, per file. This additional structure may make it harder to perform sweeping changes within the codebase, but it should make it simpler to maintain, and hopefully lead to less mistakes, and cleaner/clearer pull requests.

Tried to rebuild tools and failed

Hi,

Maybe I'm doing something wrong, but where is lime.ndll?
I trie to rebuild tools and got following errors:

zerg@rush ~/src $ openfl rebuild tools
Warning: Source path "/usr/lib/haxe/lib/lime/git/ndll/Windows/lime.ndll" does not exist
Warning: Source path "/usr/lib/haxe/lib/lime/git/ndll/Mac/lime.ndll" does not exist
Warning: Source path "/usr/lib/haxe/lib/lime/git/ndll/Mac64/lime.ndll" does not exist

If I tried to test project I got:

zerg@rush ~/src/openfl-extension/T $ openfl test android -debug
Called from flash/utils/ByteArray.hx line 717
Called from flash/Lib.hx line 233
Called from flash/Lib.hx line 308
Called from flash/Lib.hx line 180
Called from /usr/lib/haxe/std/neko/Lib.hx line 30
Uncaught exception - load.c(237) : Failed to load library : lime.ndll (lime.ndll: cannot open shared object file: No such file or directory)

haxelib run openfl setup also not work:

zerg@rush ~/src $ haxelib run openfl setup
Called from flash/utils/ByteArray.hx line 717
Called from flash/Lib.hx line 233
Called from flash/Lib.hx line 308
Called from flash/Lib.hx line 180
Called from /usr/lib/haxe/std/neko/Lib.hx line 30
Uncaught exception - load.c(237) : Failed to load library : lime.ndll (lime.ndll: cannot open shared object file: No such file or directory)

Dynamic sound not working properly on native targets.

To demonstrate the problem, I have created this example project https://github.com/PaulGene/PitchShiftingSound

Flash: everything works as expected.

Windows: Works most of the time but sometimes SampleDataEvent.SAMPLE_DATA stops being fired when lime_sound_channel_needs_data(__handle); returns false at https://github.com/openfl/openfl-native/blob/master/flash/media/SoundChannel.hx#L114

Antroid: SampleDataEvent.SAMPLE_DATA gets fired about 3 times then we have the same problem as Windows, lime_sound_channel_needs_data(__handle); returns false at https://github.com/openfl/openfl-native/blob/master/flash/media/SoundChannel.hx#L114

iOS: lime_sound_channel_create_dynamic(request.data, soundTransform); always returns null at https://github.com/openfl/openfl-native/blob/master/flash/media/Sound.hx#L186

Evolve the joystick API

I believe we should have a higher level gamepad API, that works above the existing joystick events.

Rather than subscribing to be notified when a device hits a certain key, this API should allow for profiles in order to translate events into buttons, and (ideally) should allow polling, if you wish to see which controllers are connected, listen to specific controllers only, at any point in time, check the state of a particular controller, etc.

Partially this will require implementation in Lime, and will also require new APIs to manage it either at a Lime level or in OpenFL.

Antialiasing causing crash on Intel GMA graphics cards

I've been getting reports of my game crashing on startup on lower end Intel cards. After some investigation this turns out to be due to the fact that I'm using MSAA.

These cards do not support AA at all, so not having it there isn't a big deal. But, as far as I can tell there's no way for me to fix this short of distributing two different versions of the game executable.

The ideal behavior here would be falling back to a surface without AA if it's not supported. Having a runtime argument to supply to the program to disable AA would probably be easier to implement, but not as practical for end users.

I'll look into adding the fallback myself, but I'm creating this Issue just to have a place to discuss it.

TextFields and Drawing API causing crashes on nvida cards under windows

I have discovered a rare but reproducible issue that seems to relate to TextFields. I had testers experiencing crashy behaviour from my game once they'd played for a while and after much digging I found the issue and wrote this small test to reproduce it:

https://gist.github.com/grapefrukt/8409627

Basically, by drawing enough rectangles (in this test >489) the game will crash inside nvoglnt.dll (I only have access to XP computers with nvidia graphics). If I comment out the line creating the TextField, it will run well past 10.000 rectangles. Padding the TextField with more characters will make it crash sooner.

The debugger claims the error is thrown on this line: https://github.com/openfl/lime/blob/master/project/src/renderer/opengl/OpenGLContext.cpp?source=c#L541

So, it's reasonable to suspect something goes wrong with that nearby glDrawArrays call.

XP is an old OS, but it's still used by a large number of users, so I feel this might be worth looking into. Especially since everything else works so well.

I can also provide crash dumps of this error if need be.

Make a build server for Lime/OpenFL

Using our Linux-based VPS, we are able to make builds for most platforms, and export ZIP packages for haxelib automatically, but we still need to build the Windows and Mac binaries manually and upload them to the server to kickstart the process.

We should have a build server that can integrate the Linux, Windows and Mac components of the build process (or possibly implement cross builds in order to build, say, Windows from Linux) and connect this to commit hooks so that we can automatically create builds as the projects change.

This would be useful for exposing regular development builds, and for supporting the environment we need for automating the creation of all-in-one platform installers.

Ideally this system would not require a monthly cost, and have a minimum level of maintenance to keep it working, but these are negotiable as ultimately its the result that matters most. We could integrate on the existing server, but have not decided on a good system.

Hidden mouse cursor reappears when toggling fullscreen/windowed (OSX)

If you hide the cursor with flash.ui.Mouse.hide(), then toggle fullscreen/windowed, the cursor will reappear. If you try to hide it again at this point, nothing happens and it stays visible.

Probably due to the cached member "mShowCursor" of SDL2Stage not being updated:

SDL2Stage.cpp:

   void ShowCursor(bool inShow)
   {
      if (inShow!=mShowCursor)
      {
         mShowCursor = inShow;
         SetCursor( mCurrentCursor );
      }
   }

The workaround is to jog mShowCursor by showing it, then hiding it again on resize:

    private function stage_onResize(e:Event):Void
    {
        flash.ui.Mouse.show();
        flash.ui.Mouse.hide();
    }

Support user-programmable shaders for managed surfaces (OpenFL)

Recent changes have changed the way that shaders are generated, instead of being hard-coded based on a few factors, there is now dynamic shader generation, based upon what is needed for a specific surface.

In addition to the internal behavior of the managed surfaces within Lime (which OpenFL uses), we would like to add support for user-programmable shaders, for custom rendering.

Write more documentation

It should be clear how Lime fits together, how to begin using Lime from the source, as well as how to develop with Lime as a user.

First priority is to enhance the documentation around "how things work" as well as how to use the tools. Then, over time, documentation should evolve as the direct Lime API (wrapper API) develops.

Documentation should be kept under https://github.com/openfl/lime/wiki.

Port android java extention to lime from NME

I'm trying to port my android java extention to lime from nme
i got on app output
E/lime ( 7025): lime_jni_create_method - failed
E/lime ( 7025): lime_jni_create_method - failed
Here is link to extention
https://github.com/zaynyatyi/tinymic
It worked fine with openfl 1.1.1 and nme
i just changed imports in java file to
import org.haxe.lime.GameActivity;
import org.haxe.lime.HaxeObject;

Add mouse locking

We were previously blocked on adding good mouse blocking (I believe) due to poor support in SDL 1, but in SDL 2 I believe we should be able to implement support. This should be useful for immersive or first-person games.

I'm not sure yet what the higher level API for this should look like, but we can at least support it at the lower level, and ensure it works properly. I think SDL 2.0.0 had some minor issues with this, but perhaps in the newer builds it is resolved

"lime test" successfully builds but fails to run projects with a space in the name

Making a simple Hello World test.

>lime test flash
'Hello' is not recognized as an internal or external command,
operable program or batch file.

What's interesting to me is that it DOES build the project successfully, so at least for part of the process it is handling names with spaces just fine. It is only the final step where it stops working.

I tried flash, neko, and windows as targets. All built successfully, and all failed to run after.

Rendering inconsistency between flash and native when using rotation and scrollRect

When displaying the following texture:
cover

Using the following code:

var bitmapData = Assets.getBitmapData("img/cover.png");
var bitmap = new Bitmap(bitmapData);
addChild(bitmap);
bitmap.x = 100;
bitmap.y = 100;
bitmap.rotation = 30;
bitmap.scrollRect = new Rectangle(64, 64, 128, 128);

The output looks different between Flash and Windows native:
flash output
native output

I would say the Flash output is the expected behaviour.

Improve support for unicode

In SDL 2, the keyboard event and text input were divided into separate events, with good reason:

In order to properly handle input for unicode, you cannot expect one character to map to one key stroke. Currently, keyboard input is being handled, then being manually translated to ASCII. We need to support the unicode text input, and connect this to the managed TextField classes.

Under this scenario, if you listen only for events from the keyboard, you will get the key code, as well as a (best guess) translation to ASCII, but if you want to handle true input, you use a TextField element and that will be able to tell you when glyphs are being inputted/removed.

In addition to this, other aspects of the API may need to be analyzed for wchar (versus char) style support

Improve pre-multiplied alpha

Recent changes within Lime allow for pre-multiplied alpha, per surface, but due to graphic and blending improvements, we would like to look at what would be required to support pre-multiplied alpha for a complete title.

This may require some toggling of shaders to blend/fade properly, as well as changes to make sure that BitmapData-style APIs are able to set/read pixels properly, even if the surface is pre-multiplied.

Lime Sample "SimpleOpenGL" fails on html5 (using version 0.9.2)

Here is the error:

lime test html5
Source/Main.hx:143: characters 2-86 : lime.gl.GLUniformLocation should be Int
Source/Main.hx:143: characters 2-86 : js.html.webgl.UniformLocation should be Int
Source/Main.hx:144: characters 2-84 : lime.gl.GLUniformLocation should be Int
Source/Main.hx:144: characters 2-84 : js.html.webgl.UniformLocation should be Int
Source/Main.hx:145: characters 2-65 : lime.gl.GLUniformLocation should be Int
Source/Main.hx:145: characters 2-65 : js.html.webgl.UniformLocation should be Int
Source/Main.hx:155: characters 34-39 : lime.utils.ByteArray should be haxe.io.Bytes
Source/Main.hx:155: characters 34-39 : lime.utils.html5.ByteArray should be haxe.io.Bytes
Source/Main.hx:155: characters 34-39 : For function argument 'b'
Source/Main.hx:198: characters 22-45 : Int should be lime.gl.GLUniformLocation
Source/Main.hx:198: characters 22-45 : Int should be js.html.webgl.UniformLocation
Source/Main.hx:198: characters 22-45 : For function argument 'location'
Source/Main.hx:199: characters 22-44 : Int should be lime.gl.GLUniformLocation
Source/Main.hx:199: characters 22-44 : Int should be js.html.webgl.UniformLocation
Source/Main.hx:199: characters 22-44 : For function argument 'location'
Source/Main.hx:200: characters 16-28 : Int should be lime.gl.GLUniformLocation
Source/Main.hx:200: characters 16-28 : Int should be js.html.webgl.UniformLocation
Source/Main.hx:200: characters 16-28 : For function argument 'location'

I could fixed most of them by specifying lime.gl.GLUniformLocation instead of Int in the declaration of the variable

But the following error remained :

Source/Main.hx:155: characters 34-39 : lime.utils.ByteArray should be haxe.io.Bytes
Source/Main.hx:155: characters 34-39 : lime.utils.html5.ByteArray should be haxe.io.Bytes
Source/Main.hx:155: characters 34-39 : For function argument 'b'

Any Lime Sample for Flash target (not using OpenGL ) ?

I notice there is no sample app for flash.
As I would like to investigate a way to target flash/js/cpp without using the Display list API, maybe by making a WebGL like API on top of stage3d API. a sample app for flash could be a good starting point, if it is possible ?
Thanks

Analyze performance of OpenAL on Android

We are currently using the "openal-soft-1.13" branch of https://github.com/apportable/openal-soft for the Android target. Due to reports of issues on the Android target, specifically, I think it would be sensible to look at whether a different OpenAL implementation for Android would help.

Perhaps the master branch, or possibly using int instead of float values (as the repository can be compiled for that optimization) may improve performance here.

As a fallback, we could consider going back to Android Java APIs for Sound, but due to headaches/restrictions we suffered there, it would definitely be ideal if OpenAL could be evolved to work more appropriately.

Duplicate GameActivity definition lime/openfl-native

It seems that android templates (and I'm guessing others) are duplicated between lime and openfl-native.

I would be certainly clearer (and safer?) to remove them from openfl-native ASAP, unless there's a very good reason for that I don't see?

THanks
Thomas
Motion-Twin

Revisit resolution mode switching

In SDL 2.0.0, switching display modes was too unreliable to support. The current implementation uses the "full desktop" mode of fullscreen, which does not change the mode of the user's display, but instead stretches to the desktop resolution, and hides other applications.

If SDL 2.0.1/2.0.2+ improves this, I think we should reconsider support.

When you specify a window size, and do not specify fullscreen in the project parameters, the application should start windowed, at a sensible location, with the correct size.

When the user toggles fullscreen (such as Alt+Enter) then it should enter fullscreen, using the full display resolution by default. Ideally, the developer should then be able to choose a different resolution at this time. When the user (or application) toggles off of fullscreen, back to windowed mode, it should return to the same location, at the same size it was before (respecting if the window was relocated or resized)

With the above parameters, we could not get mode switching working properly, but perhaps newer SDL versions have improved upon this. This behavior must also be consistent between Windows, Mac and Linux.

It is for this reason that #4 has remained open (with my apologies to Rob), since after thorough testing, this seemed impossible without fixes in SDL. Perhaps, by now, this has happened.

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.