• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Legacy GM Platform specific stings, code, keys etc

Z

ZeeSvk

Guest
I have a very odd question.

Is it possible to make platform specific code?
I am learning GMS and am making a little app but i would want to build for Windows 10, Windows UP, Windows 10 Phone, Android, Linux (i dont own a Mac)

And I would want text to be platform specific f.e.
Windows, Linux would say: "Press Enter to Start"
Android and Windows Phone would say: "Tap to Start"

or I created Virtual Keys for backspace (so i can use Androids back button to quit the app). but would want to disable it on Windows and Linux.

f.e. something like unity has where you can say:

#if DEVICE_WINDOWS, DEVICE_LINUX do this code
#if DEVICE_ANDROID, DEVICE_WINDOWS_PHONE do another code

Hope i made it clear :)
Can that be done? Thank you in advance.
 
C

CROmartin

Guest
#if DEVICE_WINDOWS, DEVICE_LINUX do this code
#if DEVICE_ANDROID, DEVICE_WINDOWS_PHONE do another code
I never bought a exspansion for mobile phones so I dont know exactly what comand is it. But as I see your quote I know you are new to gamemaker(Like you did frst code few days ago,sry if I am wrong). But if you did some basic you should know for keyboard_check(ord("W"))(and other similar things), so in exspansions you get comands for other softer consoles like tuoch screen,joystic and other.I hope more expirienced fellow programers learn you abouth it.
 
Z

ZeeSvk

Guest
I never bought a exspansion for mobile phones so I dont know exactly what comand is it. But as I see your quote I know you are new to gamemaker(Like you did frst code few days ago,sry if I am wrong). But if you did some basic you should know for keyboard_check(ord("W"))(and other similar things), so in exspansions you get comands for other softer consoles like tuoch screen,joystic and other.I hope more expirienced fellow programers learn you abouth it.
i do know a bit of GM Code f.e. with keyboard_check_pressed(vkey_backspace);
I played with the free version and now i grabbed the game maker humble bundle with the modules

but i want that backspace code only to work when i push to android not windows.

or for Windows i want :: draw_text(x, y, "Press Space");
and when i push to android i want :: draw_text(x, y, "Tap Screen");

without rewriting or commenting out lines when i do builds. I was wondering if there is a function for this.
 
C

CROmartin

Guest
As I understand you, you want make make app for more platforms without separeting project? I dont know if that is posible but if it is posible to indicate which platform user is using at moment it is possible. Like this If (I dont know comand so I made it up) software = windows var interact_button = space. I hope someone who is using models will help you.
 
Z

ZeeSvk

Guest
Look at these functions (Link), specifically the os_type one.
dude thank you so much this will actually work. I did a test and it works like a charm :)

Code:
switch (os_type)
{
case os_windows:
    draw_text(640,200,"App Name (Windows Edition)");
    break;
case os_linux:
    draw_text(640,200,"App Name  (Linux Edition)");
    break;
case os_android:
    draw_text(640,200,"App Name  (Android Edition)");
    break;
case os_winphone:
    draw_text(640,200,"App Name  (Windows Phone Edition)");
    break;
case os_uwp:
    draw_text(640,200,"App Name (Windows 10 Edition)");
    break;
}
 
Top