Code Monkey home page Code Monkey logo

nme's Introduction

Build Status

Native Media Engine

A proven backend for native iOS, Android, Windows, Mac and Linux

Installation

  1. Install Haxe

  2. Install NME

haxelib install hxcpp
haxelib install nme
haxelib run nme setup

To install a specific version

  1. Go to the releases page
  2. Download a version, for example nme-6.3.24.zip
  3. haxelib install ~/Downloads/nme-6.3.24.zip

Building applications

Create your own application, or clone a sample:

nme clone BunnyMark -v
cd BunnyMark

Build and test your application with the different backends:

nme cpp
nme cppia
nme jsprime
nme neko
nme android

nme update ios
 -> Build + run from XCode

Note: nme is a shortcut to haxelib run nme

Learning NME

Browse the sample projects. Every sample project contains the .hx Haxe sources and the .nmml config file to build the example.

Android

  • NDK(r20) Recommended
  • haxelib run nme build android builds all APKs
  • haxelib run nme test android only builds the APK required for the running devices architecture

nme's People

Contributors

aaulia avatar andyli avatar beeblerox avatar bendmorris avatar codeservice avatar crayfellow avatar davidedc avatar djcsdy avatar elsassph avatar grumpytoad avatar hasufel avatar hughsando avatar ibilon avatar jgranick avatar jskuse avatar justsee avatar lifton avatar limikael avatar madrazo avatar man2 avatar nulld avatar profelis avatar reitzensteinm avatar robdangerous avatar ruby0x1 avatar soywiz avatar swerdnik avatar thomasuster avatar tynril avatar wighawag 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

nme's Issues

CoverageToAlpha

Hi guys !

@hughsando
@jgranick

in order to enable CoverageToAlpha to emulate alpha test, I need :
antialiasing = 1 to perform what I think it says, which is

GL.MULTI_SAMPLE=true
and
GL_SAMPLE_BUFFERS = 1

currently, Multi sample is always true but there is no sample buffer when antialias = 1 .

because with no sample buffer, coverage computation is not enableable from api (although there is always one sample buffer...)

this modification allows the gpu to perform fragment eviction based on coverage rather and then bypass alphablending to discard fragments. It basically allows to render opaque fragment wayyyyy faster.

Thanks !

install error

$ haxelib run nme setup
You already have hxcpp version 3.0.2 installed
ln: /usr/bin/nme: File exists

so what can i do? Now I can install nme 4.

now work, I remove haxe and nme, and try again.

--no-traces compile flag and android

when adding to an .nmml file, compilation for android fails with error: ./src/neash/display/Stage.cpp:1060: error: 'haxe::Log_obj' has not been declared

see neash.display.Stage.hx line 352

ios asset loading issue

On iOS only:

This below will not make the assets accessible with nme.Assets.getText() (it will return null):

    <assets path="app" rename="" include="*" />

However this will work:

    <assets from="app/" embed="true" >
        <asset name="my-app.html" />
        <asset name="styles/my-app.css" />
        <asset name="styles/themes/default.css" />
(...)
    </assets>

The same doesn't happen on Android (first case works on android).

iOS random crash

Hi guys,
I'm currently stuck on a annoying random crash who happens really oftenly in release mode, and is very very rare in debug mode.

The stack is the following:

#0 0x00d7e552 in val_field at /Users/johann.martinache/Desktop/massive/hxcpp/src/hx/CFFI.cpp:689

#1 0x00310514 in external_handler(nme::Event&, void*) at /Users/johann.martinache/Desktop/haxelib2/nme/5,1,8/project/src/common/ExternalInterface.cpp:1285

#2 0x002fb5aa in nme::Stage::HandleEvent(nme::Event&) at /Users/johann.martinache/Desktop/haxelib2/nme/5,1,8/project/src/common/Display.cpp:1879

#3 0x002a9548 in IOSStage::OnPoll() at /Users/johann.martinache/Desktop/haxelib2/nme/5,1,8/project/src/iPhone/UIStageView.mm:2887

#4 0x002a88b2 in -[NMEAppDelegate mainLoop] at /Users/johann.martinache/Desktop/haxelib2/nme/5,1,8/project/src/iPhone/UIStageView.mm:3621

#5 0x304c7c22 in __NSThreadPerformPerform ()

#6 0x2faa9fe6 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ ()

#7 0x2faa9534 in __CFRunLoopDoSources0 ()

#8 0x2faa7c9e in __CFRunLoopRun ()

#9 0x2fa127a8 in CFRunLoopRunSpecific ()

#10 0x2fa1258a in CFRunLoopRunInMode ()

#11 0x002a888e in -[NMEAppDelegate mainLoop] at /Users/johann.martinache/Desktop/haxelib2/nme/5,1,8/project/src/iPhone/UIStageView.mm:3619

#12 0x304c7c22 in __NSThreadPerformPerform ()

#13 0x2faa9fe6 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ ()

#14 0x2faa9534 in __CFRunLoopDoSources0 ()

#15 0x2faa7c9e in __CFRunLoopRun ()

#16 0x2fa127a8 in CFRunLoopRunSpecific ()

#17 0x2fa1258a in CFRunLoopRunInMode ()

#18 0x002a888e in -[NMEAppDelegate mainLoop] at /Users/johann.martinache/Desktop/haxelib2/nme/5,1,8/project/src/iPhone/UIStageView.mm:3619

#19 0x304c7c22 in __NSThreadPerformPerform ()

#20 0x2faa9fe6 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ ()

#21 0x2faa9534 in __CFRunLoopDoSources0 ()

#22 0x2faa7c9e in __CFRunLoopRun ()

#23 0x2fa127a8 in CFRunLoopRunSpecific ()

#24 0x2fa1258a in CFRunLoopRunInMode ()

#25 0x3496f6d2 in GSEventRunModal ()

#26 0x32371890 in UIApplicationMain ()

#27 0x002a916e in nme::CreateMainFrame(void (*)(nme::Frame*), int, int, unsigned int, char const*, nme::Surface*) at /Users/johann.martinache/Desktop/haxelib2/nme/5,1,8/project/src/iPhone/UIStageView.mm:3808

#28 0x0030ffd4 in nme_create_main_frame(_value**, int) at /Users/johann.martinache/Desktop/haxelib2/nme/5,1,8/project/src/common/ExternalInterface.cpp:1186

#29 0x00d96978 in ExternalPrimitive::__Run(Array<Dynamic> const&) at /Users/johann.martinache/Desktop/massive/hxcpp/src/hx/Lib.cpp:152

#30 0x00db0dc4 in Dynamic::operator()(Dynamic const&, Dynamic const&, Dynamic const&, Dynamic const&, Dynamic const&, Dynamic const&) at /Users/johann.martinache/Desktop/massive/hxcpp/include/hx/DynamicImpl.h:542

#31 0x00c39728 in openfl::Lib_obj::create(Dynamic, int, int, hx::Null<double>, hx::Null<int>, hx::Null<int>, String, hx::ObjectPtr<openfl::display::BitmapData_obj>, hx::ObjectPtr<Class_obj>) at /Users/johann.martinache/Desktop/massive/storefront-companion/bin/release/ios/bin/ios/Massivision Native Player/haxe/build/Debug-iphoneos/./src/openfl/Lib.cpp:318

#32 0x00d77bca in ApplicationMain_obj::main() at /Users/johann.martinache/Desktop/massive/storefront-companion/bin/release/ios/bin/ios/Massivision Native Player/haxe/build/Debug-iphoneos/./src/ApplicationMain.cpp:172

#33 0x00d7ba8e in __hxcpp_lib_main at /Users/johann.martinache/Desktop/massive/storefront-companion/bin/release/ios/bin/ios/Massivision Native Player/haxe/build/Debug-iphoneos/./src/__lib__.cpp:12

#34 0x00da461a in hxRunLibrary at /Users/johann.martinache/Desktop/massive/hxcpp/src/hx/RunLibs.cpp:29

`#35 0x0028ee7e in main at /Users/johann.martinache/Desktop/massive/storefront-companion/bin/release/ios/bin/ios/Massivision Native Player/Classes/Main.mm:129``

If you could help on that one, it would be awesome !!

Thanks

ByteArray.hx do not have writeObject and readObject method?

ByteArray.hx do not have writeObject and readObject method?

because I want to sent bytearray from flash to neko ,
I want to implement nme ByteArray to convert bytes to Bytearray .
but nme missing that method ...readObject ,writeObject
any help ?

iOS auto rotate onresize

On iOS (6.1) event Lib.current.stage.addEventListener(Event.RESIZE, resize); triggers only once when I am rotating device. It was ok before, not sure why its not working now ....

This code not working too:
Lib.current.stage.shouldRotateInterface = function (orientation:Int):Bool
{
return true;
}
public static method not accessible for cpp compilation

Can't build from source?

/common/FreeType.cpp(9) : fatal error C1083: Cannot open include file: 'ft2build.h': No such file or directory

Software rendering fixes from lime - gone!

There were several important software rendering fixes that Josh and I made to lime. These have been lost with the merge back into nme.

Fix low-quality software tile rasterization issues
openfl/lime@cda7b69

Fix software fallback on some older/more minimal graphic cards
openfl/lime@7ab0953

It looks like Hugh (@hughsando) rewrote the software bilinear interpolation, which is great, but in doing so broke the nearest neighbor rasterization again. Hugh, did you intentionally leave out these fixes (I don't claim they were perfectly implemented) or is this an oversight?

Masking in TileSheets

I'm building a game and we're pretty invested in TileSheets. We really need TileSheet masking.

I tried editing OpenGLContext.cpp using information from this stackoverflow post but was unable to get things working.
http://stackoverflow.com/questions/5097145/opengl-mask-with-multiple-textures

image

I don't care too much about the workflow, you guys will probably have the best understanding on what's most appropriate. I'd be okay with something as high level as...
drawTiles(graphics, tileData, flags | Tilesheet.IS_MASK);
where the first tile is treated as the mask and all remaining tiles are masked.

Or as low level as specifying the glBlendFuncSeparate xor glBlendFunc per tileData.

iOS keyboard - fix @" " hack

Instead of using @" " as the default input, we should be passing in a String from the display call for the textfield (on a request_soft_keyboard). This way, backspace (on the keyboard) works correctly, and we can also allow for AutoCapitalization options (instead of None).

When doing so, also need to add an additional parameter to backspace when it deletes a whole word, so when [string length] == 0, must trigger the mTextfield's length worth of backspace stroke events.

Textfield autoSize not being honored.

Setting the width of a text field and setting text.autoSize = TextFieldAutoSize.CENTER is not centering text.

Sample code:
package;

import flash.display.Sprite;
import flash.text.TextField;
import flash.text.TextFieldAutoSize;

class Main extends Sprite {

public function new () {

    super ();

    var txt: TextField = new TextField();
    txt.text = "hello world";
    txt.width = stage.stageWidth;
    txt.autoSize = TextFieldAutoSize.CENTER;
    addChild(txt);

}

}

Running it in flash the text is center screen, building it for native you'll see the text left justified. Similar result with TextFieldAutoSize.RIGHT.

Error: Library nme version dev is not installed

Attempting to run run.n with neko2 (ie haxelib run nme) results in:

Error: Library nme version dev is not installed

I am also very confused by the tags of this repository. There are no tags for the releases past 3.5.4 which was 6 months ago, though the latest release on haxelib is 4.0.2 (which btw needs to be updated as it is broken from the flash.Vector)

HTTP PUT is broken

In CURL.cpp:

   size_t ReadFunc( void *ptr, size_t size, size_t nmemb)
   {
      size_t bytes = size * nmemb;
      if (mBufferRemaining<=bytes)
         bytes = mBufferRemaining;

      memcpy(ptr,mBufferPos,bytes);
      mBufferPos += bytes;
      mBufferRemaining -= bytes;

      return bytes;
   }

   static size_t SReadFunc( void *ptr, size_t size, size_t nmemb, void *userdata)
   {
      return ((CURLLoader *)userdata)->ReadFunc(ptr,size,nmemb);
   }

   void SetPutBuffer(const unsigned char *inBuffer, size_t inLen)
   {
      mPutBuffer = new unsigned char[inLen];
      mBufferRemaining = 0;
      mBufferPos = mPutBuffer;
      memcpy(mPutBuffer,inBuffer,inLen);
      curl_easy_setopt(mHandle, CURLOPT_READFUNCTION, SReadFunc);
      curl_easy_setopt(mHandle, CURLOPT_INFILESIZE, inLen);
   }

The function SetPutBuffer should be changed to this:

   void SetPutBuffer(const unsigned char *inBuffer, size_t inLen)
   {
      mPutBuffer = new unsigned char[inLen];
      mBufferRemaining = inLen;    // <-- change from 0 to inLen
      mBufferPos = mPutBuffer;
      memcpy(mPutBuffer,inBuffer,inLen);
      curl_easy_setopt(mHandle, CURLOPT_READFUNCTION, SReadFunc);
      curl_easy_setopt(mHandle, CURLOPT_INFILESIZE, inLen);
   }

Otherwise, libcurl is told to expect a transfer of inLen bytes, but the read function returns 0 (EOF) on its first call. This causes servers to behave oddly (hangs, 504 gateway timeouts, etc.).

browser.media.Video extends DisplayObject instead of Sprite

Compiling an NME project using browser.media.Video fails as it extends get_graphics, which is not defined in browser.display.DisplayObject.

Updating browser.media.Video so it extends browser.display.Sprite (where get_graphics is defined) fixes the issue.

error compiling jeash.display.DisplayObjectConatiner

those lines throw an error in jeash.display.DisplayObjectContainer a line 155

if debug

    for (child in jeashChildren)
        if (child == object) {
            throw "Internal error: child already existed at index " + i;
        }
    }

end

seems like missing a bracket and a unknown "i"

Font color parsing

Firstly I was pleasantly surprised to see that basic html styling works on TextFields in OpenFL, either I'd missed that or it's new ๐Ÿ‘

Small issue on Android, however, where the parsed values seem to be misaligned (if that's the right word for it.. probably not)

I suspect it's either a TinyXML issue in TIXML_SSCANF, or something in ColorToWide. Here's a screenshot in iOS simulator vs Android device:

https://dl.dropboxusercontent.com/u/6286350/text-color-ios.png
https://dl.dropboxusercontent.com/u/6286350/text-color-android.jpg

class Test
{
    public static function main()
    {
        var field = new flash.text.TextField();
        var format = new flash.text.TextFormat();
        format.size = 40;
        field.defaultTextFormat = format;
        field.autoSize = flash.text.TextFieldAutoSize.LEFT;
        field.htmlText = '<font color="#FF0000">red</font>, <font color="#00FF00">green</font>, and <font color="#0000FF">blue</font>';
        flash.Lib.current.addChild(field);
    }
}

Probably not high on the priority list, but recording here for posterity :)

[MT][h3d][Android] H3d no longer runs

Hi !

On lime 1.4.0 on android ( works on windows ?! )

Starting from recent releases, I have this when I start my project on h3d (was working before NME merge :
E/NME ( 6707): Warning bad resource 0x7e603ca8(0x7a21d82c) (1 but is 1) in b
indBuffer
E/NME ( 6707): Warning bad resource 0x7c47d968(0x7a27626c) (2 but is 2) in b
indTexture
And the process ends up crashing....

1- Can you highlight what my problem is ?
2- Can you enhance the error message that is a little cryptic ?

If it is a real problem, please consider it an emergency, :-D
Sorry to bother ...

Thanks a lot !

CURL URLLoader does not support SNI, requests fail with IOError.

When making a URLLoader request to any https:// address that does not use a dedicated IP, the underlying CURL request fails with: "subjectAltName(s) do not match my.domain.com"

The same request works correctly via any modern browser and in Flash, via the SNI mechanism. (http://en.wikipedia.org/wiki/Server_Name_Indication)

Reading up a bit it seems there are 2 ways around this:

  1. Turn off host verfication in curl:
    /nme/project/src/common/CURL.cpp:102
    curl_easy_setopt(mHandle, CURLOPT_SSL_VERIFYPEER, false);
    +++ curl_easy_setopt(mHandle, CURLOPT_SSL_VERIFYHOST, false);

  2. Upgrade curl/openssl as described here (not tested):
    http://stackoverflow.com/questions/12941703/use-curl-with-sni-server-name-indication

From my limited understanding of SSL I think option (1) may create a security flaw, as it won't check the certificate against the domain name either. That being said, it would be nice to have the option of turning this on if option (2) is not feasible in the shorter term.

NME 3.4.4 Beta - Jeash mouse events

I have a sprite which I've added a bitmap to. The sprite has been set to both mouseEnabled and mouseChildren set to false but my mouse listener is still firing.

This is happening on the jeash javascript target.

Odd on screen keyboard related crash on Android

Hello, I've been seeing a handful of these errors popping up in my Developer Console. So I figured I'd make an Issue here.

Unfortunately I don't have any idea what to do to trigger it.
It has only happened to about .2% of my users, so it's not a huge deal.

java.lang.NullPointerException
at org.haxe.nme.GameActivity.showKeyboard(GameActivity.java:526)
at org.haxe.nme.NME.onTouch(Native Method)
at org.haxe.nme.MainView$10.run(MainView.java:447)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1406)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1198)

iOS keyboard crash- dictation button

Hitting the dictation button on the keyboard (iOS 6+, devices iPhone 4S +) will cause any app to crash.

Because this button must work on the keyboard, no app can be submitted to the AppStore that uses a keyboard. Otherwise, a completely custom keyboard must be used instead (as disabling the dictation button for now is also not an option in Obj C)

RFC: Compatibility issues with ByteArray

I want to improve the compatibility with ByteArray. Now I'm concerned about 3 issues (probably I will find some more).

1- jeas.utils.ByteArray does not implements ArrayAccess.
2- flash.utils.ByteArray.length has public both, setter and getter, so you can update it externally. neash one don't. And ByteArray doesn't have length in the constructor. I guess this is due to extending Bytes that already defines length? Maybe if instead of extending Bytes it will have a Bytes as a private field, it will get more compatible. I guess it is extending it because of the speed. But it would be too noticeable? Maybe with C++ inlining stuff and with the Memory class for fast operations it wouldn't be a problem.
3- deflate/inflate (http://code.google.com/p/nekonme/issues/detail?id=226). I can get rid of that too, but as that issue states it will require changes on hxcpp and nekovm too. I can create patches for three projects. I can start with hxcpp and nekovm and eventually activate these changes on NME.

Specially I'm concerned about the 2nd question. And I didn't want to change it without asking first about it.

Regards.

TextField.embedFonts doesn't work on native like Flash

In Flash when a TextField has embedFonts=true the text will scale in both horizontal and vertical directions. On native, the behavior is no different from embedFonts=false in which the text only scales by increasing font size in response to changes in scaleY

gl.getParameter( GL.MULTISAMPLE )

hi,

it returns null rather than false or true; (in my case value spied with gDebugguer is GL_TRUE )

Please also update constantes to include it. I know that histoically only webgl constants were included, but I would really like to have access to non webgl infos on cpp as there are some optimisatiosn that needs to be done or polled ( like number of multi sample buffer which is allways there in js but not in cpp.

so at least if you could give some GLExtConst.hx or somethign like that it would alow me to uncripple my code with dummy constants ;)

Thanks !

[Android] Too many contextRestored/Lost

Hi folks / @hughsando,

1- I am trying to improve contextLost handling for android for h3d. Sadly when the game boots, there is 3 successive context lost fired.

Back in the days we did not have so much contex lost when protoyping h3d. it sort of arose recently.

2- When i generate new framebuffers, it seems surfaceCreated is generate and then it trigger a context lost too (i'll try to reproduce and file a dedicated bug if confirmed)

Have someone experienced that kind of things ?

Thanks !

nme_jni_create_method - Hard to debug

Can you pelase improve the error message whence "nme_jni_create_method" because it is fairly impossibl to debug, adding the unfund symbols would be helpful.
Thanks.

Macros referencing haxe.Timer do not compile.

When trying to compile a project using a macro that references haxe.Timer, the compile fails with:

You cannot use the library 'nme' inside a macro

This is due to the custome NME Timer implementation, which loads primitive (not allowed in macros).

The fix is to simply change the conditional at the top of haxe.Timer from:

#if (!neko && !cpp)

to:

#if (macro || (!neko && !cpp))

So that the vanilla timer is used in macros.

Calling Capabilties.language to often causes local reference table overflow on android

This code:

package;


import flash.system.Capabilities;
import openfl.display.Sprite;


class Main extends Sprite {


    public function new () {

        super ();
        for (i in 0...1000) {
          trace(Capabilities.language);
        }

    }


}

ran on android (lime test android -debug) results in:

E/dalvikvm( 1494): JNI ERROR (app bug): local reference table overflow (max=512)
W/dalvikvm( 1494): JNI local reference table (0x771c4888) dump:
W/dalvikvm( 1494):   Last 10 entries (of 512):
W/dalvikvm( 1494):       511: 0x425f99b0 java.lang.String "de"
W/dalvikvm( 1494):       510: 0x425f99b0 java.lang.String "de"
W/dalvikvm( 1494):       509: 0x425f99b0 java.lang.String "de"
W/dalvikvm( 1494):       508: 0x425f99b0 java.lang.String "de"
W/dalvikvm( 1494):       507: 0x425f99b0 java.lang.String "de"
W/dalvikvm( 1494):       506: 0x425f99b0 java.lang.String "de"
W/dalvikvm( 1494):       505: 0x425f99b0 java.lang.String "de"
W/dalvikvm( 1494):       504: 0x425f99b0 java.lang.String "de"
W/dalvikvm( 1494):       503: 0x425f99b0 java.lang.String "de"
W/dalvikvm( 1494):       502: 0x425f99b0 java.lang.String "de"
W/dalvikvm( 1494):   Summary:
W/dalvikvm( 1494):         1 of java.lang.Class
W/dalvikvm( 1494):       511 of java.lang.String (1 unique instances)

Here is the backtrace:

I/DEBUG   (  171): backtrace:
I/DEBUG   (  171):     #00  pc 00021f90  /system/lib/libc.so (tgkill+12)
I/DEBUG   (  171):     #01  pc 00012fe1  /system/lib/libc.so (pthread_kill+48)
I/DEBUG   (  171):     #02  pc 000131f5  /system/lib/libc.so (raise+10)
I/DEBUG   (  171):     #03  pc 00011f2b  /system/lib/libc.so
I/DEBUG   (  171):     #04  pc 00021844  /system/lib/libc.so (abort+4)
I/DEBUG   (  171):     #05  pc 00045cc7  /system/lib/libdvm.so (dvmAbort+78)
I/DEBUG   (  171):     #06  pc 0004913f  /system/lib/libdvm.so
I/DEBUG   (  171):     #07  pc 0004a2c9  /system/lib/libdvm.so
I/DEBUG   (  171):     #08  pc 0003e198  /data/app-lib/com.example.myproject-1/liblime.so (_JNIEnv::CallStaticObjectMethod(_jclass*, _jmethodID*, ...)+56)
I/DEBUG   (  171):     #09  pc 0004bc3c  /data/app-lib/com.example.myproject-1/liblime.so (nme::CapabilitiesGetLanguage()+216)

Android SIGSEGV when trying to load a sound that doesn't exist

In project/src/common/Audio.cpp, determineFormatFromFile():

        #ifdef ANDROID
        FileInfo info = AndroidGetAssetFD(filename.c_str());
        FILE *f = fdopen(info.fd, "rb");
        fseek(f, info.offset, 0);   // SIGSEGV if f is null
        #else
        FILE *f = fopen(filename.c_str(), "rb");
        #endif

        int len = 35;
        char *bytes = (char*)calloc(len + 1, sizeof(char));

        if (f)
        {

On Android, if fdopen() returns null, the subsequent fseek() will cause a SIGSEGV.

Note the "if (f)" that appears later.

addEventListener() and hasEventListener() not working as expected (HTML5)

When targeting HTML5 using addEventListener to add an already registered listener to the same event on the same dispatcher as it was registered to, duplicates the listener.

Somehow related, once a listener has been registered hasEventListener() always returns true even if you removed the listener.

Using haxe 2.10 with NME 3.5.5 through flashdevelop 4.4.2

flash.Vector cannot access while targeting cpp

s:_flash\shared_haxe\bin\haxe-3.0.0-win\lib\nme/4,0,2/nme/display/Stage.hx:25: characters 7-19 : You cannot access the flash package while targeting cpp (for flash.Vector)

How does one resolve this? This is compiling with an hxml that references the nme source folder with -lib nme. Is this resolved magically by nmml configuration or something? Why reference flash.Vector in non flash code considering that nme is separate from the OpenFL directory structure?

iOS and Graphics

Would anyone have any idea why the following works fine in a desktop Mac OS application, but it does not seem to work at all in iOS Simulator?

import flash.display.Sprite;
import flash.events.Event;
import flash.Lib;

class Main extends Sprite {

    public function new() {
        super();
        addEventListener(Event.ADDED_TO_STAGE, init);
    }

    public function init(_) {
        graphics.beginFill(0x555555);
        graphics.drawRect(0, 0, 100, 100);
        graphics.endFill();
    }

    public static function main () {
        var test = new Main();
        Lib.current.addChild(test);
    }
}

package.xml

<?xml version="1.0" encoding="utf-8"?>
<project>
  <app  title="test project" file="Main" main="Main" package="com.drkibitz.test" version="1.0.0" company="testcompany" />

  <window background="#343434" fps="60" />
  <window  width="500" height="500" if="desktop" />
  <window orientation="portrait" resizable="false" if="mobile" />

  <set name="BUILD_DIR" value="Export" />
  <classpath name="Source" />
  <assets path="Assets" rename="assets" include="*" exclude="nme.svg" />

  <haxelib name="nme" />

  <ndll name="std" />
  <ndll name="nme" haxelib="nme" />

  <icon name="Assets/nme.svg" />
</project>

Incorrect rendering of non-convex polygons in flash.display.Graphics

It seems to me that OpenFL isn't correctly filling the interiors of some non-convex polygons (drawn using flash.display.Graphics). I'm appending a simple example here. When I run it with the latest lime toolchain, I clearly see that the stroke and fill of the shape don't match up. The shape should look like two pentagons glued together. But the filled region loses one of the indentations.

package;

import flash.display.Sprite;

class Main extends Sprite {
    static private var coords = [
        54.0512197394158, -39.2705098312484,
        25.5195242505612, -30,
        7.885966681787, -54.2705098312484,
        -20.6457288070676, -63.5410196624969,
        -20.6457288070676, -93.5410196624968,
        7.885966681787, -102.811529493745,
        25.5195242505612, -78.5410196624969,
        54.0512197394158, -69.2705098312484 ];

    public function new () {
        super ();

        var s = new Sprite();
        var g = s.graphics;

        g.lineStyle( 1.0, 0x000000, 1.0 );
        g.beginFill( 0xa0e0e0, 1.0 );

        g.moveTo( coords[0], coords[1] );
        var idx = 2;
        while( idx < coords.length ) {
            g.lineTo( coords[idx], coords[idx+1] );
            idx += 2;
        }

        g.endFill();

        s.x = 400;
        s.y = 400;
        addChild( s );
    }
}

glUniform4fv in cpp targets doesn't work as expected

The function in case of 32-bit float Array uploads only one element, when it should be all the elements inside array.
http://www.opengl.org/sdk/docs/man/xhtml/glUniform.xml

glUniform4fv(val_int(inLocation),1,f); ->
glUniform4fv(val_int(inLocation), sizeof(f) / 4,f);
Or
glUniform4fv(val_int(inLocation), sizeof(f) / 16,f);

Because I don't know whether the "sizeof" counts bytes of floats.
Without this fix "Vertex constant batching" is impossible to implement in OpenFL.

Incorrect hardware rendering of thick lines

When line thickness is set high enough, it seems that some edges in a path get rendered tapered, rather than constant width. This behaviour definitely manifests itself in ios (under the simulator) and neko. But I think it's related to hardware rendering -- cacheAsBitmap seems to alleviate the problem.

Sample code:


import flash.display.Sprite;

class Main extends Sprite {
    public function new () {
        super ();
        // cacheAsBitmap = true;

        var s = new Sprite();
        var g = s.graphics;

        g.lineStyle( 20.0, 0x000000, 1.0 );

        g.moveTo( 100, 100 );
        g.lineTo( 500, 100 );
        g.lineTo( 500, 500 );
        g.lineTo( 300, 300 );
        g.lineTo( 100, 500 );
        g.lineTo( 100, 100 );

        addChild( s );
    }
}```

SDL2 & Mac OS Retina

This may have been the case all the time, but I just noticed this now after testing the SDL2 implementation. Notice the pixelation, and this only occurs on openfl windows:

screen shot 2013-09-17 at 11 04 51 am

chaining framebuffer creation/deletion

hi,

On my current version, if i chain texture creation/deletion, at one point the gl driver serves texture but at one point they are pink/black....

if i chain framebuffercreation/deletion, at one point the gl driver simply crashes.

I don't know if there are tests on the nme/lime codebase but I think there should be some and these issue should be addressed
... or maybe it is already fixed and my codebase is too old :)

If you could put up some validation test (or point me to it) it would be so cool :)

Thanks !

TextField Issues When Scaling (Cannot Keep Text Aligned)

When scaling a stage that contains TextFields, the TextFields do not stay aligned as they would on the Flash platform.

Please have a look at this test project that exhibits this issue:
https://github.com/JandyCo/TextScaleTest

Instructions

  • Run the project with: lime test flash
    • Resize the stage.
    • The textbox stays centered in the gray box.
  • Run the project with: lime test neko
    • Resize the stage
    • The textbox does not stay aligned properly
    • The background (textbox.background) does not update properly until the textbox is clicked.
    • Even after clicking the background, the bg doesn't fit exactly.

Segmentation fault when drawing a circle

I'm experiencing a segfault when my program calls drawCircle. This fault occurs when my target is Linux/neko. If I target Linux/cpp, it doesn't.

I have patched NME's source code with the following patch in order to display debug messages.

diff --git a/nme/display/Graphics.hx b/nme/display/Graphics.hx
index 46416bf..7ccd43c 100644
--- a/nme/display/Graphics.hx
+++ b/nme/display/Graphics.hx
@@ -15,10 +15,24 @@ class Graphics
    public static inline var TILE_BLEND_NORMAL   = 0x00000000;
    public static inline var TILE_BLEND_ADD      = 0x00010000;
    //public static inline var TILE_BLEND_SUBTRACT = 0x00020000;
-   /** @private */ private var nmeHandle:Dynamic;
+   /** @private */ private var nmeHandle(get,set):Dynamic;
+   /** @private */ private var m_nmeHandle:Dynamic;
+   private function get_nmeHandle():Dynamic {
+      trace("== get_nmeHandle", m_nmeHandle);
+      return m_nmeHandle;
+   }
+   private function set_nmeHandle(v:Dynamic):Dynamic {
+      trace(">> set_nmeHandle", v);
+      m_nmeHandle = v;
+      trace("<< set_nmeHandle");
+      return m_nmeHandle;
+   }
+
    public function new(inHandle:Dynamic) 
    {
+      trace(">> Graphics::new", inHandle);
       nmeHandle = inHandle;
+      trace("<< Graphics::new");
    }

    public function arcTo(inCX:Float, inCY:Float, inX:Float, inY:Float) 
@@ -59,12 +73,18 @@ class Graphics

    public function drawCircle(inX:Float, inY:Float, inRadius:Float) 
    {
+trace(">> drawCircle");
+trace("== drawCircle::nme_gfx_draw_ellipse", nme_gfx_draw_ellipse, nmeHandle);
       nme_gfx_draw_ellipse(nmeHandle, inX - inRadius, inY - inRadius, inRadius * 2, inRadius * 2);
+trace("<< drawCircle");
    }

    public function drawEllipse(inX:Float, inY:Float, inWidth:Float, inHeight:Float) 
    {
+trace(">> drawEllipse");
+trace("== drawEllipse::nme_gfx_draw_ellipse", nme_gfx_draw_ellipse);
       nme_gfx_draw_ellipse(nmeHandle, inX, inY, inWidth, inHeight);
+trace("<< drawEllipse");
    }

    public function drawGraphicsData(graphicsData:Array<IGraphicsData>):Void 
diff --git a/project/common/ExternalInterface.cpp b/project/common/ExternalInterface.cpp
index 35c5d9b..c9dbb5b 100644
--- a/project/common/ExternalInterface.cpp
+++ b/project/common/ExternalInterface.cpp
@@ -1960,8 +1960,10 @@ DEFINE_PRIM(nme_external_interface_register_callbacks,0);
 value nme_gfx_clear(value inGfx)
 {
    Graphics *gfx;
+   printf(">> nme_gfx_clear\n");
    if (AbstractToObject(inGfx,gfx))
       gfx->clear();
+   printf("<< nme_gfx_clear\n");
    return alloc_null();
 }
 DEFINE_PRIM(nme_gfx_clear,1);
@@ -2147,10 +2149,13 @@ DEFINE_PRIM(nme_gfx_arc_to,5);
 value nme_gfx_draw_ellipse(value inGfx,value inX, value inY, value inWidth, value inHeight)
 {
    Graphics *gfx;
+   printf(">> nme_gfx_draw_ellipse\n");
    if (AbstractToObject(inGfx,gfx))
    {
+      printf(">> nme_gfx_draw_ellipse::gfx: 0x%08x\n", (unsigned long)gfx);
       gfx->drawEllipse( val_number(inX), val_number(inY), val_number(inWidth), val_number(inHeight) );
    }
+   printf("<< nme_gfx_draw_ellipse\n");
    return alloc_null();
 }
 DEFINE_PRIM(nme_gfx_draw_ellipse,5);

Here is a part of my program (BaseShape.hx):

class BaseShape extends Sprite
{
        public var id : Int;
        public var color : Color;

        private function new() {
                super();

                id = 0;
                color = RGB( 0, 0, 0 );
        }

        public function redraw() {
        }

        public function beginFill( color : Color ) : Void {
                switch( color ) {
                        case RGB( r, g, b ):
                                graphics.beginFill( ((r & 0xff) << 16) | ((g & 0xff) << 8) | ((b & 0xff) << 0) );
                        case RGBA( r, g, b, a ):
                                graphics.beginFill( ((r & 0xff) << 16) | ((g & 0xff) << 8) | ((b & 0xff) << 0), a );
                }
        }
}

class Circle extends BaseShape {
        public var radius : Float;

        public function new() {
                super();

                radius = 0;
        }

        public override function redraw() {
                trace( ">> Circle::redraw" );
                trace( "== Circle::redraw::clear" );
                graphics.clear();
                trace( "== Circle::redraw::beginFill( " + color + " )" );
                beginFill( color );
                trace( "== Circle::redraw::drawCircle( 0, 0, " + radius + " )" );
                graphics.drawCircle( 0, 0, radius );
                trace( "<< Circle::redraw" );
        }
}

This is the output of my program:

BaseShape.hx:43: >> Circle::redraw
BaseShape.hx:44: == Circle::redraw::clear
Graphics.hx:33: >> Graphics::new,#abstract
Graphics.hx:25: >> set_nmeHandle,#abstract
Graphics.hx:27: << set_nmeHandle
Graphics.hx:35: << Graphics::new
Graphics.hx:21: == get_nmeHandle,#abstract
>> nme_gfx_clear
<< nme_gfx_clear
BaseShape.hx:46: == Circle::redraw::beginFill( RGB(255,128,0) )
Graphics.hx:21: == get_nmeHandle,#abstract
BaseShape.hx:48: == Circle::redraw::drawCircle( 0, 0, 20 )
Graphics.hx:76: >> drawCircle
Graphics.hx:21: == get_nmeHandle,#abstract
Graphics.hx:77: == drawCircle::nme_gfx_draw_ellipse,#function:5,#abstract
Graphics.hx:21: == get_nmeHandle,#abstract
zsh: segmentation fault  ( cd bin/linux/neko/bin && ./thrall; )

It looks like nme.display.Graphics.nme_gfx_draw_ellipse is loaded, but that the call fails.
When nme.display.Graphics.nme_gfx_clear is called, we can see the debug traces.
The last trace is the getter call of nmeHandle, just before nme.display.Graphics.nme_gfx_draw_ellipse would be called.

Can someone explain me what is happening here?

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.