More questions about Android and GLB.

Previous topic - Next topic

Hatonastick

1) How do I set screen orientation?  Not too fussed about other peoples devices yet, but trying to work out how to get mine into Landscape mode at the moment. Ugh... Reading comprehension FTW...

2) How do I input text?  Do we have access to Androids on-screen keyboard or do you have to come up with your own workaround?

3) Do we have access to native buttons or do we make our own system?  I'm guessing we just draw something on screen and detect whether a mouse/touch clicked within its coordinates.

4) With pre-processor commands is there an entry for Android in the platforms section?  Might just be missing from the help.  Anyway am hoping to make this MUD server compile for more than one platform with as little mucking about as possible so am going to be using such commands a lot.  Mostly because I don't want to spend more time on this project than I have to as I've got games I want to make. :)

5) Is CATCH/FINISH etc. similar to the following C:
Code (glbasic) Select

  atexit(StopEngine);
  signal(SIGINT, SignalCapture);
  signal(SIGTERM, SignalCapture);
   
void SignalCapture(int signum)
{
  switch (signum) {
    case SIGINT:
      signal(SIGINT, SignalCapture);
      exit(EXIT_SUCCESS);
      break;
    case SIGTERM:
      exit(EXIT_SUCCESS);
      break;
  }
}


Basically the above allows you to capture certain exceptions and then do certain things before the program exits.  eg. control-C being used to kill a running program.

Warning: I'm going to use this thread a lot to ask questions as I go about making my first Android application, so I apologise for being annoying in advance. :)
Mat. 5: 14 - 16

Android: Toshiba Thrive Tablet (3.2), Samsung Galaxy Tab 2 (4.1.2).
Netbook: Samsung N150+ Netbook (Win 7 32-bit + Ubuntu 11.10).
Desktop: Intel i5 Desktop with NVIDIA GeForce GTX 460 (Win 8.1 64-bit).

Darmakwolf

Hello Hatonastick - you've got quite a few questions here. Are you new to GLBasic itself? If so - honestly - you should start with some basic stuff for the desktop computer. Granted - you don't need to change *much* to make it "run" on Android; you should still become familiar with the language by testing a platform which is not still technically being tested. GLBasic is still a little strange on Android devices - I've tried several, all with differing issues. (It's mostly Android's massive segmentation issues...) That aside:

2. I use an on-screen keyboard routine. You can write your own really easily and have it slide across the screen and take input like any other keyboard. Honestly most mobile games do not ask for textual input very often, so it's not really that much of an issue to make a simple system. In iOS, people have found ways to call the actual keyboard and get input from it by using inline C.

3. It will be best to use custom graphics for buttons, especially because it themes the program a lot better. Just use MS Paint and make some simple buttons as placeholders to set up the layout.

4. I don't really understand what you're saying here. You compile for Android by using the compile - multi-platform menu and selecting Android. You can find out several operating system specific tidbits by using platforminfo. (This is described in the help file.) The only major porting issue most people run into is the difference in screen resolutions and aspect ratios. e.g. if you make an iOS game in 480x320, most android screens are wider in landscape mode (mine is, at least.) Either way, the preprocessor can be accessed by the ? symbol. For instance: ?IFDEF ISWINDOWS has the preprocessor see if ISWINDOWS is defined. Hope I've helped somewhat - feel free to ask more!





Kitty Hello

1. There's no question 1? No, I'm not new to GLBasic?
2. Use your own. There's many attempts. The easiest one is in Samples/COMMON/DDgui.gbas and is called DDgui_Input$()
3. With a graphics-only solution you are ready for x-platform. Native stuff always requires lots of testing
4. What you select from the platforms-dropdown box in uppercase is defined for this platform, so
?IF DEFINED(ANDROID)
5. TRY/CATCH _is_ something like you described, BUT! I think the Android SDK compiler does not understand it. Try, but I have the slight idea in mind that something was missing.

Hatonastick

#3
Quote from: Kitty Hello on 2011-Oct-29
1. There's no question 1? No, I'm not new to GLBasic?
2. Use your own. There's many attempts. The easiest one is in Samples/COMMON/DDgui.gbas and is called DDgui_Input$()
3. With a graphics-only solution you are ready for x-platform. Native stuff always requires lots of testing
4. What you select from the platforms-dropdown box in uppercase is defined for this platform, so
?IF DEFINED(ANDROID)
5. TRY/CATCH _is_ something like you described, BUT! I think the Android SDK compiler does not understand it. Try, but I have the slight idea in mind that something was missing.
1.  Yeah basically I answered it myself by (SHOCK! HORROR!) reading the help file.  Sorry the old brain isn't firing on all cylinders lately.  I'm trying to get back into programming to make myself use it and get myself thinking again.  Oh and no I'm not new to GLBasic (just vague :P) as you know mate. :)

2. Ok.  I might check that out and see how it goes.  I'm not fussed if I have to write my own, just didn't want to reinvent the wheel, especially as it will be a lot of coding for something I wont need often.  Edit: Actually I think that might be all the keyboard I'll need.  Just going to need text input for a few minor things.  Edit: Just compiled the DGUI example for Android, was really quite neat. :)

3. Yup, not a problem.  Again, buttons aren't hard to make or code for.

4. Ok thanks.  Didn't realise that.  I think I used the wrong syntax by the looks of it.  That and I failed to change the selection in the drop down box when I compiled for Win32 instead of Android.

5. Thanks for the heads-up.  Will try it and see.
Mat. 5: 14 - 16

Android: Toshiba Thrive Tablet (3.2), Samsung Galaxy Tab 2 (4.1.2).
Netbook: Samsung N150+ Netbook (Win 7 32-bit + Ubuntu 11.10).
Desktop: Intel i5 Desktop with NVIDIA GeForce GTX 460 (Win 8.1 64-bit).

okee

Re: 2,  ampos has a nice keyboard/input routine in 2D Snippets
http://www.glbasic.com/forum/index.php?topic=6905.0
Android: Samsung Galaxy S2 -  ZTE Blade (Orange San Francisco) - Ainol Novo 7 Aurora 2
IOS: 2 x Ipod Touch (1G)

Hatonastick

#5
Wow... Thanks for that link Okee.  Ampos did a brilliant job on that one!

Edit:  On a side note I compiled (what is left of) my old Time Pilot clone for Android today.  The ZTE V9 really struggled with it!  I think it was having trouble handling the starfield.  This is an extremely low-end device though, with a massive (ok not really) 600MHz processor. :)
Mat. 5: 14 - 16

Android: Toshiba Thrive Tablet (3.2), Samsung Galaxy Tab 2 (4.1.2).
Netbook: Samsung N150+ Netbook (Win 7 32-bit + Ubuntu 11.10).
Desktop: Intel i5 Desktop with NVIDIA GeForce GTX 460 (Win 8.1 64-bit).