Jump to content


Photo

GMExtensions - Add Java/C++ to Android!


  • Please log in to reply
54 replies to this topic

#1 halo shg

halo shg

    Programmer

  • GMC Member
  • 600 posts
  • Version:GM:Studio

Posted 06 January 2013 - 05:11 PM

GMExtensions by HaloShg
With great honour, I'm pleased to announce my most recent weekend project: GMExtensions!

What is is?
GMExtensions allows you to integrate Java (and through NDK, C/++) into your Game Maker Studio: Android applications and games!

How does it work?
Adding additional functions to Game Maker is tricky to say the least. Most functions are contained within a compile shared object (libyoyo.so) which can't easily be edited. Luckily for us, some of them aren't! The functions I take advantage of is get_string, which I chose because of its ability to receive two string parameters and return a string. By slightly modifying its actions, I can bootstrap a class loader that allows you to receive and return values to Game Maker.

Can I see an example?
Sure! Scan this QR code or click the link on your phone to download a simple test app. Requires Android and Arm7 support (most modern phones).
Posted Image


How do I install it in Game Maker?

As of now, installing it requires a little bit of editing.
  • Editing the runner
    You will need to modify a file that Game Maker compiles to allow this to work.
    First, open up Notepad (or Wordpad, or your favourite Java/text editor)
    File > Open and type
    %appdata%\GameMaker-Studio\Android\runner\src\com\yoyogames\runner\RunnerJNILib.java
    Now, make the following changes:

    Add the bottom of the imports:
    //import GMExtensions
    import gmc.GMExtensions;
    Inside the class:
    public static final String extKey = "GME_";
    Spoiler


    Scroll down (or CTRL-F to InputString). Inside the method:
    //Only interpret commands with a valid key
        	if (_default.startsWith(extKey))
        		return GMExtensions.interpret(_message, _default);	
    
    Spoiler
  • Adding the classes
    Now that you have edited the runner, you must add the classes.
    Download GMExtensions and the test class, toastTest.
    Open up start and enter:
    %appdata%\GameMaker-Studio\Android\runner\src\
    Extract the file and place the folder in \src\. Verify it is correct by insuring \src\gmc\GMExtensions.java exists. Done!
  • Interfacing from GMS
    Now, GME can be called through the get_string command. However, I do not recommend this! Instead, download my example gmz and use the scripts inside! Use the file > create executable command to run.
  • Caveats
    Unfortunately, this system isn't bulletproof. Aside from the crashes that you will cause if you pass the wrong string, there are several minor problems.

    The most major one is that it only works when you do a full compile of the apk. This means that to test it, you must compile the entire executable. There is nothing I can do about this. Hopefully this wont be the case when 1.3 extensions come out.

    Additionally, I threw this all together without prior experience with the Reflect API. I also did not code a lot of failsafing so don't be surprised if it crashes. If you are experienced in Java and would like to improve the code, go ahead by all means. Oh, and please help create extensions. :)/>/>

Enjoy!

(All the download links in case you missed them in the text)


Note to Staff:
Spoiler

  • 15

Dev: MacBook Pro Retina Display 15" w/ Win7 (Parallels) running GM Studio: Master and GM8 (GMS: ANDROID JAVA EXTENSIONS ARE HERE!)
Devices: Samsung Galaxy Note II / Samsung Galaxy S III / iPhone 4S / iPad 2 / iPod Touch 5th gen



Politics' is made up of two words, 'poli,' which is Greek for 'many,' and 'tics,' which are blood-sucking insects.


-Gore Vidal


#2 Manuel777

Manuel777

    InvaderGames

  • GMC Member
  • 3578 posts
  • Version:GM:Studio

Posted 07 January 2013 - 05:29 AM

I tried this myself, but since my knowledge of Java is too poor to create something 'cool', never got too far into it.

I also noticed that I couldt add custom functions to GameMaker like before, this stalled me because I did NOT wanted to override stuff like get_string() in order to use my functions, too clumbsy and may upset people who uses the functions.

Anyway, Its great to see you actually got it working! If someone with more Java knowledge shows up, I'd be pleased to see what they come up with!

Edit: You may want to clearify that verything will be deleted with an update of GM:S, you dont want to loose all of your stuff!

Edit2: Ok, I was playing around with this all night, really good job on getting the wrapper working, I havent had to modify anything there, very good!

I managed to do something simple like make the phone vibrate, its clumbsy, but I cant believe it works! this is how I have done it: (on the toastTest class)
public static void gme_vibrate(String time) {
		final long vibrate_time = Long.parseLong(time);
		Handler h = new Handler(ms_context.getMainLooper());
    	h.post(new Runnable() {
        	@Override
        	public void run() {
				Vibrator v = (Vibrator) ms_context.getSystemService(Context.VIBRATOR_SERVICE);
				v.vibrate(vibrate_time);
			}
    	});
	}

After adding the Vibrate permission to the manifest it works perfectly! The only downside is that it takes AGES to compile, this is a really big bummer, especially when the Java is working and you only need to change stuff on the game, but its something at last!

I was also looking into more 'complex' stuff like notifications, this CAN be implemented, but it requires some more Java/Android knowledge, I have tried it but the Reiciever class got me frustrated and I kinda deleted everything (whpopsie!), But I trust someone with more experience and patience can get it to work like a charm.

I am also interested on knowing one thing, are the GM:S sprites accessible like this? I mean, they must be accessible, but where in the whole hierarchy are they, does anyone know? this can be extremely handy!

Edited by Manuel777, 07 January 2013 - 10:57 AM.

  • 0

@MEtchegaray7

gplussignature.png

May this signature be frozen on the old GMC until the end of times. Or YoYo takes it down.


#3 halo shg

halo shg

    Programmer

  • GMC Member
  • 600 posts
  • Version:GM:Studio

Posted 07 January 2013 - 03:50 PM

I tried this myself, but since my knowledge of Java is too poor to create something 'cool', never got too far into it.

I also noticed that I couldt add custom functions to GameMaker like before, this stalled me because I did NOT wanted to override stuff like get_string() in order to use my functions, too clumbsy and may upset people who uses the functions.

Actually, it doesn't override get_string; it augments it. Simply calling get_string(str,def) will function as it always has because GME checks for the key (ie, def has to start with GME_). Additionally, get_string is meant to be used as a debug function only (according to the help file) in favour of the async get_string or custom input.

Anyway, Its great to see you actually got it working! If someone with more Java knowledge shows up, I'd be pleased to see what they come up with!

Edit: You may want to clearify that verything will be deleted with an update of GM:S, you dont want to loose all of your stuff!

Yes, it does require a knowledge of Java, but it's not very complicated because of the way I set it up.
As for deletion when it updates, I believe it will only change the runner file. That means you should only need to re-edit RunnerJNILib.java.

Edit2: Ok, I was playing around with this all night, really good job on getting the wrapper working, I havent had to modify anything there, very good!

I managed to do something simple like make the phone vibrate, its clumbsy, but I cant believe it works! this is how I have done it: (on the toastTest class)

public static void gme_vibrate(String time) {
		final long vibrate_time = Long.parseLong(time);
		Handler h = new Handler(ms_context.getMainLooper());
    	h.post(new Runnable() {
        	@Override
        	public void run() {
				Vibrator v = (Vibrator) ms_context.getSystemService(Context.VIBRATOR_SERVICE);
				v.vibrate(vibrate_time);
			}
    	});
	}

After adding the Vibrate permission to the manifest it works perfectly! The only downside is that it takes AGES to compile, this is a really big bummer, especially when the Java is working and you only need to change stuff on the game, but its something at last!

I was also looking into more 'complex' stuff like notifications, this CAN be implemented, but it requires some more Java/Android knowledge, I have tried it but the Reiciever class got me frustrated and I kinda deleted everything (whpopsie!), But I trust someone with more experience and patience can get it to work like a charm.

That's great! You're the first (second next to me) extension creator! By the way, I see you used String in the parameter. There's nothing wrong with that, and it might even be better if you're dealing with large numbers (above int's limit). However, GME will also pass the parameter as an int if that's what's provided. Anyways, great job.
I was actually going to include a larger test library (torch, vibrate, toast, UUID) but I didn't want to have to explain editing permissions, for simplicity.

I am also interested on knowing one thing, are the GM:S sprites accessible like this? I mean, they must be accessible, but where in the whole hierarchy are they, does anyone know? this can be extremely handy!

I'm interested in this too. I think they can be loaded as long as they're in the "sandbox". That means all we have to do is find the location of that and write files there. Should work I think.

Thanks for downloading and good luck!
  • 0

Dev: MacBook Pro Retina Display 15" w/ Win7 (Parallels) running GM Studio: Master and GM8 (GMS: ANDROID JAVA EXTENSIONS ARE HERE!)
Devices: Samsung Galaxy Note II / Samsung Galaxy S III / iPhone 4S / iPad 2 / iPod Touch 5th gen



Politics' is made up of two words, 'poli,' which is Greek for 'many,' and 'tics,' which are blood-sucking insects.


-Gore Vidal


#4 Manuel777

Manuel777

    InvaderGames

  • GMC Member
  • 3578 posts
  • Version:GM:Studio

Posted 07 January 2013 - 07:25 PM

Cool, the only problem I got so far is typecasting, Java is not so good at typecasting, and since you are dealing with integers only, converting them to othertypes (such as long, in my ext) is pretty difficult!

Also, could you provide a simple math example of a return function? I havent got around that yet.. :rolleyes:
  • 0

@MEtchegaray7

gplussignature.png

May this signature be frozen on the old GMC until the end of times. Or YoYo takes it down.


#5 krele

krele

    GMC Member

  • GMC Member
  • 640 posts
  • Version:GM:Studio

Posted 07 January 2013 - 07:53 PM

Funny how you made it half a year before yoyo put their ass to it =P

Great job! :)
  • 0

If I helped you, you can help me back :3

Brocoola


#6 Arusiasotto

Arusiasotto

    GMC Member

  • GMC Member
  • 760 posts
  • Version:GM:Studio

Posted 07 January 2013 - 08:23 PM

YoYo has more to work on than just Java Extensions. Still, nice to see people taking some initiative with this, cause it's really cool. Now if it could use full keycode support, that would fix the issues with xbox controllers and the OUYA.

On another note, has this had any luck with windows 8 functions?

Edited by Arusiasotto, 07 January 2013 - 08:31 PM.

  • 0

 

"It should be noted that no ethically-trained software engineer would ever consent to write a DestroyBaghdad procedure. Basic professional ethics would instead require him to write a DestroyCity procedure, to which Baghdad could be given as a parameter." - Nathaniel Borenstein

 

 

 


#7 halo shg

halo shg

    Programmer

  • GMC Member
  • 600 posts
  • Version:GM:Studio

Posted 08 January 2013 - 12:11 AM

Also, could you provide a simple math example of a return function?

public static int multiply(int value1, int value2)
	{
		return (value1 * value2);
	}
var class, method, args;
class = "gmc.toastTest"; //Use full qualifying class name (gmc.toastTest, not toastTest)
method = "multiply";
args = gme_addargs(argument0, argument1);
return gme_call(method,args,class,true);
GME does it's best to accommodate different types. If you pass a real to gme_addargs it will become an int in Java. In the end they get converted to String before being returned (because they are returned to InputString which expects a String). As long as the return value can be converted to a String you should be fine.
  • 1

Dev: MacBook Pro Retina Display 15" w/ Win7 (Parallels) running GM Studio: Master and GM8 (GMS: ANDROID JAVA EXTENSIONS ARE HERE!)
Devices: Samsung Galaxy Note II / Samsung Galaxy S III / iPhone 4S / iPad 2 / iPod Touch 5th gen



Politics' is made up of two words, 'poli,' which is Greek for 'many,' and 'tics,' which are blood-sucking insects.


-Gore Vidal


#8 jtn0514

jtn0514

    GMC Member

  • GMC Member
  • 137 posts
  • Version:GM:Studio

Posted 08 January 2013 - 03:41 AM

YoYo has more to work on than just Java Extensions. Still, nice to see people taking some initiative with this, cause it's really cool. Now if it could use full keycode support, that would fix the issues with xbox controllers and the OUYA.

On another note, has this had any luck with windows 8 functions?


Very cool stuff. Id like to see a hack to implement 360 and ouya controllers and the ouya IAP (in app payment) setup as well.

I did notice the in app payment stuff is very very similar to google play which is supported by GM:S, so it may already be compatible techincally on that front.
  • 0

#9 krele

krele

    GMC Member

  • GMC Member
  • 640 posts
  • Version:GM:Studio

Posted 08 January 2013 - 01:56 PM

Come on! This needs so much more attention Q_Q
  • 0

If I helped you, you can help me back :3

Brocoola


#10 WWAZman

WWAZman

    GMC Member

  • GMC Member
  • 1538 posts
  • Version:GM:Studio

Posted 09 January 2013 - 07:09 AM

How would one go about doing a longpress to save a sound as a ringtone / notification?
  • 0

I tried turning it off and on again.
I made definitely sure I unplugged the soldering iron when I was done.
MY Games are here: https://play.google....aXNfc291bmRzIl0.
and here: http://www.blinkinstudios.com

Dyscalculia sucks, but I keep learning piece by piece. Thanks for helping along the way!


#11 master123

master123

    GMC Member

  • GMC Member
  • 68 posts
  • Version:GM8

Posted 10 January 2013 - 11:49 AM

This is cool, but I really don't know java, but if we can get some Internet access (php) e.t.c and gps this would be cool because I want to make something for our family that will incorporate that. But for now good job!
  • 0

#12 Manuel777

Manuel777

    InvaderGames

  • GMC Member
  • 3578 posts
  • Version:GM:Studio

Posted 10 January 2013 - 04:14 PM

Did anyone else got this working besides me and halo? I am concerned that it might create a constant lag on my games, but I am not sure (cant test on this PC)

Edit: Lag was not because of this, but I would still like to see if anyone else did a different extension!

Edited by Manuel777, 14 January 2013 - 02:48 AM.

  • 0

@MEtchegaray7

gplussignature.png

May this signature be frozen on the old GMC until the end of times. Or YoYo takes it down.


#13 gundam88

gundam88

    GMC Member

  • GMC Member
  • 11 posts

Posted 14 January 2013 - 12:36 AM

openfeint like sdk working possible?
  • 0

#14 master123

master123

    GMC Member

  • GMC Member
  • 68 posts
  • Version:GM8

Posted 15 January 2013 - 11:43 AM

Manuel777 have you seen my pm? Sorry for being of topic...
  • 0

#15 Debels

Debels

    GMC Member

  • GMC Member
  • 3029 posts
  • Version:GM:Studio

Posted 25 January 2013 - 03:12 AM

If everything works as expected I will release a Bluetooth extension :)

Didn't work :/, I tried to compile the extension test and it didn't work :confused:

Its still a great extension from what I see, hope I can use it

Error:

Spoiler

Edited by Debels, 25 January 2013 - 03:15 AM.

  • 0

"Give a man a fish, and you feed him for a day; show him how to catch fish, and you feed him for a lifetime."

(Chinese axiom)


#16 Samuel Venable

Samuel Venable

    GMC Member

  • Banned Users
  • 632 posts
  • Version:GM:Studio

Posted 25 January 2013 - 10:00 PM

How the heck do I use c++, what I could've sworn was a windows only language work at all on android? This makes no sense. Can someone give and example or something?
Spoiler

#17 Arusiasotto

Arusiasotto

    GMC Member

  • GMC Member
  • 760 posts
  • Version:GM:Studio

Posted 26 January 2013 - 12:36 AM

... t-k-g, c++ is an intermediate programming language that runs on a whole lot more things than a Windows PC. Hell, my senior project used C++ and a TI PIC controller to turn a soda machine and a clock into an automated drink mixer.

Anyway, the way you would be able to use c++ withthis hackstention™ is via NDK:
http://mobile.tutspl...d/ndk-tutorial/
How it works however is beyond me, as I don't know Java.
So what you are looking at is Game Maker calls on Java during compilation, and the Java calls the C Native code, and packages it all together with a messy bow. In theory it works, in practice... anyone got it to work?
  • 0

 

"It should be noted that no ethically-trained software engineer would ever consent to write a DestroyBaghdad procedure. Basic professional ethics would instead require him to write a DestroyCity procedure, to which Baghdad could be given as a parameter." - Nathaniel Borenstein

 

 

 


#18 Manuel777

Manuel777

    InvaderGames

  • GMC Member
  • 3578 posts
  • Version:GM:Studio

Posted 26 January 2013 - 12:52 AM

Yeah it works, however I havent tried to include any other external library to the runner than the OUYA SDK.. but it does work :)

Edit: we need someone NDK-friendly to help us in here to do that, I barely know Java and NDK is waaay beyond my knowledges!

Edited by Manuel777, 26 January 2013 - 01:26 PM.

  • 0

@MEtchegaray7

gplussignature.png

May this signature be frozen on the old GMC until the end of times. Or YoYo takes it down.


#19 Samuel Venable

Samuel Venable

    GMC Member

  • Banned Users
  • 632 posts
  • Version:GM:Studio

Posted 26 January 2013 - 01:29 AM

So we can call normal game maker DLLs from this, or do have to modify the DLLs slightly so that they can be called from java? I wish there was a tutorial. I know some c++ but I don't know hardly any Java, or how to call between c++<->java... I actually have been trying to firgure this out for well over a year to make an inset play plugin work on multiple browsers. To be honest I don't care to fiddle with that anymore but I 'd still like to know how to use GME.
Spoiler

#20 keylab83

keylab83

    GMC Member

  • GMC Member
  • 3 posts
  • Version:GM:Studio

Posted 30 January 2013 - 03:06 AM

Didn't work :/, I tried to compile the extension test and it didn't work

Its still a great extension from what I see, hope I can use it

Error:

this is probably because you have copy of your original runner (or other file) in the same directory, this was my problem.
I hope this help you

Edited by keylab83, 30 January 2013 - 03:08 AM.

  • 0

#21 Debels

Debels

    GMC Member

  • GMC Member
  • 3029 posts
  • Version:GM:Studio

Posted 31 January 2013 - 12:07 AM

Ok, now it works, but now the app crashes on the Android xD
  • 0

"Give a man a fish, and you feed him for a day; show him how to catch fish, and you feed him for a lifetime."

(Chinese axiom)


#22 Fireball16

Fireball16

    Indie Developer

  • GMC Member
  • 1015 posts
  • Version:GM:Studio

Posted 02 February 2013 - 02:00 PM

Could this be used to get things like PlayTomic Analytics working on android?
  • 0

twitter128x12832.pngbrowser128x12832.pngandroid128x12832.pngskype128x12832.png


#23 Debels

Debels

    GMC Member

  • GMC Member
  • 3029 posts
  • Version:GM:Studio

Posted 04 February 2013 - 12:29 AM

Could this be used to get things like PlayTomic Analytics working on android?

Yes
  • 0

"Give a man a fish, and you feed him for a day; show him how to catch fish, and you feed him for a lifetime."

(Chinese axiom)


#24 Basti

Basti

    GMC Member

  • GMC Member
  • 30 posts

Posted 25 February 2013 - 09:42 PM

I don't have the RunnerJNILib.java file.
What now? :(
  • 0

#25 halo shg

halo shg

    Programmer

  • GMC Member
  • 600 posts
  • Version:GM:Studio

Posted 28 February 2013 - 12:50 AM

Read the instructions again. It's there, assuming you own the Android extension.
  • 0

Dev: MacBook Pro Retina Display 15" w/ Win7 (Parallels) running GM Studio: Master and GM8 (GMS: ANDROID JAVA EXTENSIONS ARE HERE!)
Devices: Samsung Galaxy Note II / Samsung Galaxy S III / iPhone 4S / iPad 2 / iPod Touch 5th gen



Politics' is made up of two words, 'poli,' which is Greek for 'many,' and 'tics,' which are blood-sucking insects.


-Gore Vidal


#26 dna48

dna48

    GMC Member

  • GMC Member
  • 22 posts
  • Version:GM:Studio

Posted 10 March 2013 - 04:24 AM

Hello,

I am trying to refresh the Image Gallery after a screen capture. The idea is to be able to save an image in android with the sd card write permission and have automatically refresh the image gallery. If i don't do that the user would need to restart his mobile to be able to see the saved, captured images.


I have been trying with :

package gmc;


import android.net.Uri;
import android.os.Handler;
import android.os.Looper;
import android.app.Activity;
import android.content.Intent;


public class RefreshImageGallery extends Activity  
{ 
	public Handler mHandler;

    private void gme_startMediaScanner(String addedPicture)
    {

         sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, Uri.parse("file://"+ addedPicture)));

    }
	
}

but I am getting a Looper error, like if it is asynchronous and it should be done using a thread

I/yoyo    ( 7485): image saved on /sdcard/imp/w0001.png
I/yoyo    ( 7485): saved screen
I/yoyo    ( 7485): InputString("gme_startMediaScanner("/sdcard/imp/w0001.png")", "GME_gmc.RefreshImageGallery")
I/yoyo    ( 7485): onPause
I/yoyo    ( 7485): Pausing the Runner
I/yoyo    ( 7485): !!!!Unable to do mSetSystemUiVisibility(0)
E/AndroidRuntime( 7485): FATAL EXCEPTION: GLThread 9
E/AndroidRuntime( 7485): java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
E/AndroidRuntime( 7485):        at android.os.Handler.<init>(Handler.java:121)
E/AndroidRuntime( 7485):        at android.app.Activity.<init>(Activity.java:713)
E/AndroidRuntime( 7485):        at gmc.RefreshImageGallery.<init>(RefreshImageGallery.java:11)
E/AndroidRuntime( 7485):        at java.lang.Class.newInstanceImpl(Native Method)
E/AndroidRuntime( 7485):        at java.lang.Class.newInstance(Class.java:1409)
E/AndroidRuntime( 7485):        at gmc.GMExtensions.interpret(GMExtensions.java:33)
E/AndroidRuntime( 7485):        at com.yoyogames.runner.RunnerJNILib.InputString(RunnerJNILib.java:1010)
E/AndroidRuntime( 7485):        at com.yoyogames.runner.RunnerJNILib.Process(Native Method)

Also it seems i would need to extend Activity and also GMExtensions and that is too much for my very limited java knowledge.

Any help appreciated.
  • 0

#27 Arusiasotto

Arusiasotto

    GMC Member

  • GMC Member
  • 760 posts
  • Version:GM:Studio

Posted 11 March 2013 - 07:45 AM

Android has a notorious issues with their gallery not refreshing. Have fun with that.
  • 0

 

"It should be noted that no ethically-trained software engineer would ever consent to write a DestroyBaghdad procedure. Basic professional ethics would instead require him to write a DestroyCity procedure, to which Baghdad could be given as a parameter." - Nathaniel Borenstein

 

 

 


#28 Manuel777

Manuel777

    InvaderGames

  • GMC Member
  • 3578 posts
  • Version:GM:Studio

Posted 11 March 2013 - 05:01 PM

Android has a notorious issues with their gallery not refreshing. Have fun with that.

Indeed.. That is all fixed when replacing the default gallery for somethin like QuickPic.
  • 0

@MEtchegaray7

gplussignature.png

May this signature be frozen on the old GMC until the end of times. Or YoYo takes it down.


#29 dna48

dna48

    GMC Member

  • GMC Member
  • 22 posts
  • Version:GM:Studio

Posted 11 March 2013 - 05:34 PM

So you recommend your fellow developer colleagues to request their users to install a third party software (other than android to see images?)

It is not that me or you as users decide to install this or that. Is about using android method to refresh image gallery after saving an image on android and not needing to reboot the mobile.
I am asking for help to do something, i am aware that there are programs that do that. That is not what i am asking.

Android Mediastore works in a way that it needs to be connected and asked for a refresh of a particular file, directory or all the sdcard. If you don't do that the mediastore won't see the new media file.
  • 0

#30 Arusiasotto

Arusiasotto

    GMC Member

  • GMC Member
  • 760 posts
  • Version:GM:Studio

Posted 12 March 2013 - 06:37 PM

Actually I recommend Google gets their head out their arses and either has the gallery scan more often or include a refresh button. The number of calls I get because someone can't find the pictures they took (with Googles camera app) gives me migraines.
  • 0

 

"It should be noted that no ethically-trained software engineer would ever consent to write a DestroyBaghdad procedure. Basic professional ethics would instead require him to write a DestroyCity procedure, to which Baghdad could be given as a parameter." - Nathaniel Borenstein

 

 

 


#31 Legendary_Agent

Legendary_Agent

    GMC Member

  • GMC Member
  • 369 posts

Posted 13 April 2013 - 03:35 AM

Hello, i never used an extension before, would this allow me to create my own object classes? or just plain classes? imagine i dont need an object to perform anything related to keyboard presses, releases, steps, alarms and all the stuff that are always processed even if you have nothing written in those events for that object, would you think that this method would allow me to get better performance by if i had lets say 100000 instances of a class accessed everystep by 1 object instance(gamemaker) rather than having 1000000 object instances (gamemaker) which are activated accessed everystep by the same object?

Im not sure if i explained myself correctly but basically im trying to find a way to make objects in gamemaker without the big performance loss of making a normal object.


Edited by Legendary_Agent, 13 April 2013 - 03:35 AM.

  • 0

#32 Legendary_Agent

Legendary_Agent

    GMC Member

  • GMC Member
  • 369 posts

Posted 14 April 2013 - 01:55 AM

I guess im way off to what this thread is all about huh? I tought that this would help me create a class, and inside that class throw some variables in it, things like ds_lists, reals and strings.


  • 0

#33 InvinCibleXz

InvinCibleXz

    GMC Member

  • New Member
  • 7 posts
  • Version:GM:Studio

Posted 23 April 2013 - 06:05 AM

I cannot download the extension.zip


  • 0

#34 halo shg

halo shg

    Programmer

  • GMC Member
  • 600 posts
  • Version:GM:Studio

Posted 24 April 2013 - 02:29 AM

The links were temporarily down due to a migration glitch as I transferred to a new VPS. If you were having trouble downloading, try again now. The links should be working properly. If not, PM or email me and I'll fix it.


  • 0

Dev: MacBook Pro Retina Display 15" w/ Win7 (Parallels) running GM Studio: Master and GM8 (GMS: ANDROID JAVA EXTENSIONS ARE HERE!)
Devices: Samsung Galaxy Note II / Samsung Galaxy S III / iPhone 4S / iPad 2 / iPod Touch 5th gen



Politics' is made up of two words, 'poli,' which is Greek for 'many,' and 'tics,' which are blood-sucking insects.


-Gore Vidal


#35 sandy

sandy

    GMC Member

  • GMC Member
  • 871 posts
  • Version:GM:Studio

Posted 20 July 2013 - 06:18 PM

does this allow you to use custom sdk like use leadbolt ad providers for android??


  • 0

#36 NYS

NYS

    GMC Member

  • GMC Member
  • 453 posts
  • Version:GM:Studio

Posted 01 August 2013 - 10:48 PM

Hey,

 

This is awesome!

 

I'm going to try and add some more functionality :)

 

NYS


Edited by NYS, 01 August 2013 - 11:01 PM.

  • 0

#37 Genaut

Genaut

    GMC Member

  • GMC Member
  • 156 posts
  • Version:GM:Studio

Posted 20 August 2013 - 09:37 PM

I try something with this :) It's a wonderful extension, but there are little messages on this thread :(

 

PD:

 

What is "ms_context", I don see nothing about him (create, initialice..)

 

 

Im having a "Unknow Source Error" on my test.

 

I have this on my .java test

	public static void gme_leadbolt_banner_start(String small){
	
	final String lb_small = small;
	
	Handler h = new Handler(ms_context.getMainLooper());
    	h.post(new Runnable() {
        	@Override
        	public void run() {
					AdController myController = new AdController(ms_context, lb_small);
					myController.loadAd();
		    	}
    	});
	}

* I have the import too

 

Well, this my obj_initiale create event:

//Cargar banner de publicidad leadbolt
gme_leadbolt_banner_start("STRINGID")

And this my script to call gme_call

//This is an example of how a function should be set up.
//Usage: gme_leadbolt_banner_start(small);
//(c) 2013 HaloShg

var class, method, arg_small, args;
class = "gmc.leadboltAds"; //Use full qualifying class name (gmc.toastTest, not toastTest)
method = "gme_leadbolt_banner_start";
arg_small = argument0;

args = gme_addargs(arg_small); //Compile all parameters into parameter string

//This function is void so it will return 'GME_VOID'. If it errors, it will return the exception.
gme_call(method,args,class,false); //false means that we are not looking to return a real.

Any idea?, I receibe this error:

I/yoyo    ( 5894): InputString("gme_leadbolt_banner_start("MY_LEADBOLT_ID")", "GME_gm
c.leadboltAds")
D/AndroidRuntime( 5894): Shutting down VM
E/AndroidRuntime( 5894): FATAL EXCEPTION: main
E/AndroidRuntime( 5894): java.lang.NullPointerException
E/AndroidRuntime( 5894):        at com.evnivddsyfgsibygzu.AdController.loadAd(Un
known Source)
E/AndroidRuntime( 5894):        at gmc.leadboltAds$1.run(leadboltAds.java:19)

Edited by Genaut, 20 August 2013 - 10:42 PM.

  • 0

#38 Manuel777

Manuel777

    InvaderGames

  • GMC Member
  • 3578 posts
  • Version:GM:Studio

Posted 20 August 2013 - 11:44 PM

MY_LEADBOLT_ID should be, well your Leadbolt ID (or key.. dunno, never used leadbolt).

 

Make sure you included the libraries in the runner/libs/ folder and that the imports are correct.. 


  • 0

@MEtchegaray7

gplussignature.png

May this signature be frozen on the old GMC until the end of times. Or YoYo takes it down.


#39 Genaut

Genaut

    GMC Member

  • GMC Member
  • 156 posts
  • Version:GM:Studio

Posted 21 August 2013 - 06:58 AM

Hi Manuel777. First, sorry for my english.

I think that I am using a incorrect constructor for my ad type, It's possible that I need a Activity reference, and not a Context reference to make this work, I have that investigate and try some codes :)

Thanks!
  • 0

#40 BlueDeath

BlueDeath

    GMC Member

  • GMC Member
  • 141 posts
  • Version:GM:Studio

Posted 30 August 2013 - 07:00 PM

This thing should be good for use chartboost? It has a jave sdk as I know


  • 0

Help us to fund the new game: https://www.indiegog...jects/adorables
Published games: https://play.google....te Rabbit Games


#41 autukill

autukill

    GMC Member

  • GMC Member
  • 144 posts
  • Version:GM:Studio

Posted 12 October 2013 - 11:54 AM

1n2s.jpg

 

YES! It's available to  the os ui, and more!


Edited by autukill, 13 October 2013 - 02:48 PM.

  • 1

#42 BlueDeath

BlueDeath

    GMC Member

  • GMC Member
  • 141 posts
  • Version:GM:Studio

Posted 17 October 2013 - 08:00 PM

Can anyone wrote a step-by-step use about that for chartboost?


  • 1

Help us to fund the new game: https://www.indiegog...jects/adorables
Published games: https://play.google....te Rabbit Games


#43 WWAZman

WWAZman

    GMC Member

  • GMC Member
  • 1538 posts
  • Version:GM:Studio

Posted 01 December 2013 - 06:02 AM

would there be a tutorial available with how to use the Microphone for a volume meter? (simple charting)


  • 0

I tried turning it off and on again.
I made definitely sure I unplugged the soldering iron when I was done.
MY Games are here: https://play.google....aXNfc291bmRzIl0.
and here: http://www.blinkinstudios.com

Dyscalculia sucks, but I keep learning piece by piece. Thanks for helping along the way!


#44 gatorchopps

gatorchopps

    GMC Member

  • GMC Member
  • 13 posts

Posted 29 January 2014 - 01:43 AM

Hello,

I am trying to refresh the Image Gallery after a screen capture. The idea is to be able to save an image in android with the sd card write permission and have automatically refresh the image gallery. If i don't do that the user would need to restart his mobile to be able to see the saved, captured images.


I have been trying with :
 


but I am getting a Looper error, like if it is asynchronous and it should be done using a thread

I/yoyo    ( 7485): image saved on /sdcard/imp/w0001.png
I/yoyo    ( 7485): saved screen
I/yoyo    ( 7485): InputString("gme_startMediaScanner("/sdcard/imp/w0001.png")", "GME_gmc.RefreshImageGallery")
I/yoyo    ( 7485): onPause
I/yoyo    ( 7485): Pausing the Runner
I/yoyo    ( 7485): !!!!Unable to do mSetSystemUiVisibility(0)
E/AndroidRuntime( 7485): FATAL EXCEPTION: GLThread 9
E/AndroidRuntime( 7485): java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
E/AndroidRuntime( 7485):        at android.os.Handler.<init>(Handler.java:121)
E/AndroidRuntime( 7485):        at android.app.Activity.<init>(Activity.java:713)
E/AndroidRuntime( 7485):        at gmc.RefreshImageGallery.<init>(RefreshImageGallery.java:11)
E/AndroidRuntime( 7485):        at java.lang.Class.newInstanceImpl(Native Method)
E/AndroidRuntime( 7485):        at java.lang.Class.newInstance(Class.java:1409)
E/AndroidRuntime( 7485):        at gmc.GMExtensions.interpret(GMExtensions.java:33)
E/AndroidRuntime( 7485):        at com.yoyogames.runner.RunnerJNILib.InputString(RunnerJNILib.java:1010)
E/AndroidRuntime( 7485):        at com.yoyogames.runner.RunnerJNILib.Process(Native Method)
Also it seems i would need to extend Activity and also GMExtensions and that is too much for my very limited java knowledge.

Any help appreciated.

 

I know this thread is kind of old but if anyones still around with some java knowledge I love some help. I've tried modifying the above code but I just don't know enough about the java and the android sdk to get anything to work. From what I understand I need some sort of listener to recive the sendbroadcast command but all I've been able to find is on click button listeners... I'm just lost. Could anyone suuply me with a example or direct me to somewhere I could read up on this? Thanks!


  • 0

#45 Debels

Debels

    GMC Member

  • GMC Member
  • 3029 posts
  • Version:GM:Studio

Posted 29 January 2014 - 02:01 AM

 

Hello,

I am trying to refresh the Image Gallery after a screen capture. The idea is to be able to save an image in android with the sd card write permission and have automatically refresh the image gallery. If i don't do that the user would need to restart his mobile to be able to see the saved, captured images.


I have been trying with :
 


but I am getting a Looper error, like if it is asynchronous and it should be done using a thread

I/yoyo    ( 7485): image saved on /sdcard/imp/w0001.png
I/yoyo    ( 7485): saved screen
I/yoyo    ( 7485): InputString("gme_startMediaScanner("/sdcard/imp/w0001.png")", "GME_gmc.RefreshImageGallery")
I/yoyo    ( 7485): onPause
I/yoyo    ( 7485): Pausing the Runner
I/yoyo    ( 7485): !!!!Unable to do mSetSystemUiVisibility(0)
E/AndroidRuntime( 7485): FATAL EXCEPTION: GLThread 9
E/AndroidRuntime( 7485): java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
E/AndroidRuntime( 7485):        at android.os.Handler.<init>(Handler.java:121)
E/AndroidRuntime( 7485):        at android.app.Activity.<init>(Activity.java:713)
E/AndroidRuntime( 7485):        at gmc.RefreshImageGallery.<init>(RefreshImageGallery.java:11)
E/AndroidRuntime( 7485):        at java.lang.Class.newInstanceImpl(Native Method)
E/AndroidRuntime( 7485):        at java.lang.Class.newInstance(Class.java:1409)
E/AndroidRuntime( 7485):        at gmc.GMExtensions.interpret(GMExtensions.java:33)
E/AndroidRuntime( 7485):        at com.yoyogames.runner.RunnerJNILib.InputString(RunnerJNILib.java:1010)
E/AndroidRuntime( 7485):        at com.yoyogames.runner.RunnerJNILib.Process(Native Method)
Also it seems i would need to extend Activity and also GMExtensions and that is too much for my very limited java knowledge.

Any help appreciated.

 

I know this thread is kind of old but if anyones still around with some java knowledge I love some help. I've tried modifying the above code but I just don't know enough about the java and the android sdk to get anything to work. From what I understand I need some sort of listener to recive the sendbroadcast command but all I've been able to find is on click button listeners... I'm just lost. Could anyone suuply me with a example or direct me to somewhere I could read up on this? Thanks!

 

This extension is basically obsolete now, since GM EA supports extensions now.


  • 1

"Give a man a fish, and you feed him for a day; show him how to catch fish, and you feed him for a lifetime."

(Chinese axiom)


#46 Manuel777

Manuel777

    InvaderGames

  • GMC Member
  • 3578 posts
  • Version:GM:Studio

Posted 29 January 2014 - 04:28 PM

GameMake Early Access, its a preview for v1.3 but as far as I tested, extensions are not working 100% (you cant return values from the Java side), so.. this is stil usefult to at least test extensions


Edited by Manuel777, 29 January 2014 - 04:28 PM.

  • 2

@MEtchegaray7

gplussignature.png

May this signature be frozen on the old GMC until the end of times. Or YoYo takes it down.


#47 BlueDeath

BlueDeath

    GMC Member

  • GMC Member
  • 141 posts
  • Version:GM:Studio

Posted 29 January 2014 - 06:58 PM

But now you are able to use e.g. chartboost with early acces?

GameMake Early Access, its a preview for v1.3 but as far as I tested, extensions are not working 100% (you cant return values from the Java side), so.. this is stil usefult to at least test extensions


  • 0

Help us to fund the new game: https://www.indiegog...jects/adorables
Published games: https://play.google....te Rabbit Games


#48 gatorchopps

gatorchopps

    GMC Member

  • GMC Member
  • 13 posts

Posted 29 January 2014 - 08:57 PM

Oh okay thanks for the update guys. I guess I'll Just keep digging around untill v1.3 is released. I'm just trying to release a app to the market and this is the last function needed haha.


  • 0

#49 kapilatairpush

kapilatairpush

    GMC Member

  • New Member
  • 2 posts
  • Version:GM:Studio

Posted 10 April 2014 - 08:54 PM

Guys, I am also developing one basic java plugin, where i just want to pass three parameter (String, Double, String). 

 

What I have tried till now: 

 

I have followed below links but could not succeed.  

 

URL: 1. http://help.yoyogame...ntries/30690273

URL: 2. http://gmc.yoyogames...howtopic=566396

 

In case of URL 1, when i run my application, it gives message in eclipse/adb log cat "Attempting to call extension function with no extensions loaded xxxx on class GenericExtension".

 

Here I have confusion that when we connect java file to extension and call our function via object then how and when our .java file get complied. We simply give the path of our "Java" directory which contain actual code and we never compile it manually. Please help me if some one can clear my confusion here.

 

In case of URL 2, Many developer has added there own function to below file. I tried this way and it lead me to same confusion that if i add a function with name "fun1" then when and how this file will be compile. Because, when i added this function to this file and try to call it via object then my script only did not allow me to run the project. Ofcourse, this function will not be available until .java file will not run. Please help me if some one can clear my confusion here.

 

file: %appdata%\GameMaker-Studio\Android\runner\src\com\yoyogames\runner\RunnerJNILib.java

 

In both the ways, my problem is .java file compilation. I have properly configured "Android SDK and NDK" path in game maker studio preference.

 

If Game Maker compile .java file automatically when we compile project (or pressing F5), then as per my compilation logs, i can say that its not compiling .java file. Please let me know how can i fix this problem.

 

 

 

 

 

 


  • 0

#50 Samuel Venable

Samuel Venable

    GMC Member

  • Banned Users
  • 632 posts
  • Version:GM:Studio

Posted 10 April 2014 - 09:40 PM

Something I'm not clear on, why is this topic still being discussed? 1.3 with official android extensions are out so who needs this anymore? It was a nice solution for people anxious to make android extensions before 1.3 but would you just look at that.

MsHcr.jpg
Spoiler