Profile

Member Since
September 01, 2011

Search Members

  

dimanux

40
@

Badges

This user hasn't earned any badges yet.

Posts

Viewing 1 to 20 (40 Total)

Sample 13 HTTPS native URLLoader bug

Hello

I'm trying to fetch https://twitter.com as in example from NME samples directory with native (CPP) URLLoader on Windows 7. Output from logger:

Error: connection lost
Sample.hx:118: Error:
* About to connect() to twitter.com port 443 (#0)
* Trying 199.59.150.39... * Connected to twitter.com (199.59.150.39) port 443 (#0)
* Curl_axtls_close
* Closing connection #0
* Curl_axtls_close
* Curl_axtls_close
* Curl_axtls_close
* Curl_axtls_close_all
Done(0)

I'm new to SSL, but I think that we have to set CURLOPT_SSL_VERIFYHOST in 0 or 1 and make it as option of URLRequest. Thanks.

Posted on February 10, 2013 at 7:43 AM

Re: Flixel for NME

Hello, Zaphod, Sorry, it's me (diman_punk@rambler.ru).
Thanks for answer. But I means slightly different thing. For example, I have PC screen 1024x768 and fullscreen bitmap (1024x768). For mobile screen (for example, 512x384) I want to use bitmap 512x384 - which is offline scaled version of first bitmap. But all game code works in 1024x768 coordinate system, so to create FlxGame I pass 1024x768 sizes and 0.5 zoom factor. As a result of using smaller texture, it occupies only 1/4 of screen. To make it fullscreen, I need to change scale and position of FlxSprite. Maybe is there automatic system like cocos2d content scale factor?

Posted on August 20, 2012 at 4:11 AM

Re: nmex:Extensions of NME for IOS/Android game development

Hello, watsnow!

Thanks for great extension smiling I'll try it in current project.

1. It seems like a bug leading to memory leak in value nmex_set_event_handle function from ExternalInterface.cpp: each time we create NXObject instance this function allocates AutoGCRoot to nmexEventHandle without deallocating.
2. Maybe error in terms of function name in InAppPurchase.hx: destory or destroy?
3. Also there is event IN_APP_PURCHASE_CANNEL - maybe it would be IN_APP_PURCHASE_CANCEL? or what does it mean? smiling
4. And what about Android inAppPurchase? Do you have any plans to make it?

Posted on January 10, 2012 at 11:18 AM

Re: fatal error C1061, CPP windows target

Few bugfixes in NME (r1163):

1) project/opengl/OpenGLContext.cpp, lines from 664 to 667 should be:
glColor4f((float) ((col >> 16) & 0xFF) / 255.0,
(float) ((col >> 8) & 0xFF) / 255.0,
(float) (col & 0xFF) / 255.0,
(float) ((col >> 24) & 0xFF) / 255.0);
// Instead of division by 256.0

2) project/opengl/OpenGLContext.cpp, lines from 738 to 741 should be:
glColor4f((float) ((inTint >> 16) & 0xFF) / 255.0,
(float) ((inTint >> 8) & 0xFF) / 255.0,
(float) (inTint & 0xFF) / 255.0,
(float) ((inTint >> 24) & 0xFF) / 255.0);
// Instead of division by 256.0

3) project/android/JNI.cpp, lines from 87 to 88 should be:
CheckException();
env->DeleteLocalRef(name);
return result;
// delete jstring object

4) project/android/JNI.cpp, after line 568 should be:
CheckException();
env->DeleteLocalRef(name);
// delete jstring object

Posted on December 21, 2011 at 3:08 PM

Re: NME and iOS5

Joshua, I recompiled sdl-static libs, hxcpp libs (regexp, std and zlib) and NME lib for armv7 target and 5.0 SDK. Also I had used Validate Properties button of Xcode to correct project properties generated by install-tool (changes to 5.0 SDK version). That's all smiling

crayfellow, I think we could use "lipo" command tool to generate fat builds of static libs, that includes armv6 and armv7 targets. But I don't know how to make a universal build of application for both... I'm new to ios smiling

P.S. Desktop Mac OS version of NME doesn't work in Mac OS X Lion last update, because of deprecated functions using by SDL sad

Posted on December 21, 2011 at 1:45 PM

Re: NME and iOS5

Apple approved my game smiling It's in showcase forum now (http://www.haxenme.org/community/forums/showcase/treesmas/) and only for iOS 5.0 for Apple devices.

Posted on December 20, 2011 at 10:42 PM

Treesmas

Hello smiling
There is my first mobile holiday game written in haxe and NME smiling

Experience the holiday spirit!
Decorate Christmas trees with beautiful and funny ornaments, receive gifts, earn points! Get awards!
Hurry up! You have little time to dress up so many Christmas trees!

Game features:
- 3 game modes
- many beautiful ornaments and gifts
- different backgrounds
- achievements
- simple control and gameplay





Video:http://www.youtube.com/watch?v=IW2QWA84yPU...
AndroidMarket:http://market.android.com/details?id=com.gemioli.treesmas...
AppStore:http://itunes.apple.com/us/app/treesmas/id489275007...

Unfortunately, I haven't time to make the free version by holidays sad I'll post some bugfixes in NME soon.

Posted on December 20, 2011 at 10:33 PM

Re: NME and iOS5

I use Stage.shouldRotateInterface for iphone target. You are right, that for android target it is not implemented yet. This string from android template manifest uses only one fixed orientation:
::if (WIN_ORIENTATION!=""):: android:screenOrientation="::WIN_ORIENTATION::"::end::

Posted on December 16, 2011 at 11:06 AM

Re: NME and iOS5

Thanks smiling I have Witstech A81E - it's without accelerometer sad So this game hasn't accelerometer features. I wanted to support 2 orientations (landscape left and right), but app test on other phone (with sensor) has failed, because switching orientation from "landscape left" to "landscape right" includes portrait orientation during switching (it's not good, but will be solved, I hope smiling ). So game has fixed landscape orientation only.

Posted on December 16, 2011 at 10:02 AM

Re: NME and iOS5

crayfellow, yes, I hope smiling because my game is a holiday game, and it's my first AppStore game smiling
Yesterday I released it on AndroidMarket (paid version only, free version will be soon):http://market.android.com/details?id=com.gemioli.treesmas...

Posted on December 16, 2011 at 9:45 AM

Re: NME and iOS5

Yesterday I recompiled all libraries with support both armv6 and armv7, using lipo. But the app was compiled successfully only for one architecture - simultaneously for both doesn't gather. As a result I have compiled it for armv7 and have submitted it to Apple. I wait a review...

Posted on December 16, 2011 at 1:15 AM

Re: Problem installing NME manually

I have the same problem. I resolved it by typing full paths instead of ${SDK_ROOT} macro. Also OS restart gives me proposal for "nme setup android" everytime.

Posted on November 17, 2011 at 2:12 AM

Re: Trouble with nme windows/cpp target

I have the same trouble on the Windows XP machine. Can you launch ApplicationMain.exe from export/cpp/windows/obj directory? If it will work, then (if you use SVN revision of NME) you can comment line #336 in %NME_PATH%/install-tool/src/data/Icons.hx ( //InstallTool.runCommand ("", command, [ inExeName, name ]); ) and recompile run.n. This is because ReplaceVistaIcon.exe corrupts the MyApplication.exe (I don't know why).

Posted on November 12, 2011 at 5:37 AM

Re: Touch/mouse events work only on stage

Hi all,
I have implemented hits on the drawTriangles method. Here is a code, which you can add to %NME_PATH%/project/common/Hardware.cpp at line 613:
else if (draw.mPrimType == ptTriangles)
{
if (draw.mCount<3)
continue;
bool persp = arrays.mPerspectiveCorrect;
UserPoint *v = &vert[ draw.mFirst ];
for(int i=0;i<draw.mCount;i+=3)
{
UserPoint p0 = v[0];
int j = 1;
for (; j <= 3 ; ++j)
{
UserPoint p = v[(j%3) * (persp ? 2 : 1)];
if (((p.x-p0.x)*(pos.y-p0.y) - (pos.x-p0.x)*(p.y-p0.y)) < 0.0)
break;
p0 = p;
}
if (j > 3)
return true;
v+=persp ? 6 : 3;
}
}

Recompile the binaries, and test ;) It works fine for my project.
P.S. Here is pastebin url (http://pastebin.com/QidRLbHR)

Posted on November 12, 2011 at 5:24 AM

CPP target: Sprite buttonMode and useHandCursor

Hello,

Recently I tried to implement features buttonMode and useHandCursor of Sprite in CPP target, because they don't work. I can't attach a patch file, so there is an url (http://pastebin.com/dgTUnpTY). Now on buttons the hand both in Flash and in Windows is correctly directed. There can be it will help somebody smiling

Posted on November 09, 2011 at 3:54 PM

Re: Bitmaps drawing in NME Preloader

Oh, thank you, Joshua! It seems to be working now in Flash!

Posted on November 04, 2011 at 11:21 AM

Re: Bitmaps drawing in NME Preloader

Yes of course, Joshua, it works after preloading. I don't know about embedded images in Flash (I'm completely new to Flash platform smiling ) Can you write an example of this preloader in haxe or give me a link to it, please?

Posted on November 04, 2011 at 10:15 AM

Bitmaps drawing in NME Preloader

Hello,

Recently I have started to understand with the preloader in NME. I created class like NMEPreloader (from install-tool/flash/haxe/NMEPreloader) - having copied all methods and having renamed to Preloader. I have added to nmml file "". And have got first error: "export/flash/haxe/ApplicationMain.hx:20: characters 3-31 : Preloader should be NMEPreloader". To resolve it we can change line 7 in install-tool/flash/haxe/ApplicationMain.hx to "static var mPreloader: :tongue outRELOADER_NAME::;" and everything will work well (exactly how default NMEPreloader is working). So first question: is it bug? or we must create derived class from NMEPreloader?

Second thing I have tried to implement is bitmap loading in my Preloader. I simply have written line in onInit() function (the image on the specified way exists):

public function onInit()
{
var _bitmap = Assets.getBitmapData("assets/images/768/gui/loading.png");
}

And have got this error message from flash player:

ArgumentError: Error #2015: Invalid BitmapData.
at flash.display::BitmapData/ctor()
at flash.display::BitmapData()
at NME_assets_images_768_gui_loading_png()
at nme.installer::Assets$/getBitmapData()
at Preloader/onInit()
at ApplicationMain$/main()
at boot_f91c/init()
at flash::Boot/start()
at boot_f91c()

And I don't know how to fix it? Or maybe I'm doing something wrong? Help me, please smiling How to load image from assets in Preloader to show it to player?

And another small question: How about preloader class in CPP target, where we can load game images?

Thanks smiling

Posted on November 04, 2011 at 5:25 AM

Re: fatal error C1061, CPP windows target

smiling Thank you! I didn't test all features of NME yet on A81E, but I think it can be added to supported devices list.

Posted on November 03, 2011 at 5:08 PM

Re: fatal error C1061, CPP windows target

Joshua I found and resolved problem smiling I think, my A81E don't like JNI at all smiling
To fix the ReferenceTable overflow bug we need to delete jstring object in AnroidFrame.cpp like this:

ByteArray AndroidGetAssetBytes(const char *inResource)
{
JNIEnv *env = GetEnv();

jclass cls = env->FindClass("org/haxe/nme/GameActivity");
jmethodID mid = env->GetStaticMethodID(cls, "getResource", "(Ljava/lang/String;)[B");
if (mid == 0)
return 0;

jstring str = env->NewStringUTF( inResource );
jbyteArray bytes = (jbyteArray)env->CallStaticObjectMethod(cls, mid, str);
env->DeleteLocalRef(str); // FIXED: After method calling we need to delete "str", that is why ReferenceTable overflow is appeared (http://stackoverflow.com/questions/4637140/how-to-release-jstring-that-is-sent-from-native-code-back-to-java)
if (bytes==0)
{
return 0;
}

jint len = env->GetArrayLength(bytes);
ByteArray result(len);
env->GetByteArrayRegion(bytes, (jint)0, (jint)len, (jbyte*)result.Bytes());
return result;
}

And now game is running well on my A81E smiling

P.S. Also there are some minor fixes, that prevents crash of applications on Android:
project/android/System.cpp:
1.
bool ClearUserPreference(const char *inId)
{
JNIEnv *env = GetEnv();
jclass cls = env->FindClass("org/haxe/nme/GameActivity");
jmethodID mid = env->GetStaticMethodID(cls, "clearUserPreference", "(Ljava/lang/String;)V");
if (mid == 0)
return false;

jstring jInId = env->NewStringUTF( inId );
env->CallStaticVoidMethod(cls, mid, jInId ); // FIXED: Call of ObjectMethod shoud be VoidMethod
return true;
}
2.
bool SetUserPreference(const char *inId, const char *inPreference)
{
JNIEnv *env = GetEnv();
jclass cls = env->FindClass("org/haxe/nme/GameActivity");
jmethodID mid = env->GetStaticMethodID(cls, "setUserPreference", "(Ljava/lang/String;Ljava/lang/String;)V");
if (mid == 0)
return false;

jstring jInId = env->NewStringUTF( inId );
jstring jPref = env->NewStringUTF ( inPreference );
env->CallStaticVoidMethod(cls, mid, jInId, jPref );
env->DeleteLocalRef(jInId); // FIXED: I think that without deleting of jstring it could result in ReferenceTable Overflow
env->DeleteLocalRef(jPref); // But this is not tested by me because it is not invoking overflow for now
return true;
}

3.
std::string GetUserPreference(const char *inId)
{
JNIEnv *env = GetEnv();
jclass cls = env->FindClass("org/haxe/nme/GameActivity");
jmethodID mid = env->GetStaticMethodID(cls, "getUserPreference", "(Ljava/lang/String;)Ljava/lang/String;");
if (mid == 0)
{
return std::string("");
}

jstring jInId = env->NewStringUTF(inId);
printf("about to call method");
jstring jPref = (jstring) env->CallStaticObjectMethod(cls, mid, jInId);
env->DeleteLocalRef(jInId); // FIXED: the problem is the same as 2
printf("about to create preference");
const char *nativePref = env->GetStringUTFChars(jPref, 0);
std::string result(nativePref);
printf("about to release");
env->ReleaseStringUTFChars(jPref, nativePref);
printf("about to return.");
return result;
}

4.
bool LaunchBrowser(const char *inUtf8URL)
{
JNIEnv *env = GetEnv();
jclass cls = env->FindClass("org/haxe/nme/GameActivity");
jmethodID mid = env->GetStaticMethodID(cls, "launchBrowser", "(Ljava/lang/String;)V");
if (mid == 0)
return false;

jstring str = env->NewStringUTF( inUtf8URL );

env->CallStaticVoidMethod(cls, mid, str ); // FIXED: Call of ObjectMethod shoud be VoidMethod
return true;

}

Posted on November 03, 2011 at 9:28 AM
« Previous12Next »