Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Topics - aroldo

Hello GLBASIC community,I just want to invite you to try my 8080 Arcade Emulator and see my my new app for iOS and Android DEFENDER 1
Gernot and GLBasic developer team,

What are the plans for the future of GLBasic?

Last year you presented some screen shots about the new GUI of what could be the new GLBasic IDE (Integrated Development Environment).
Since that time things happened (hard disk crash) that had delayed or changed the enhancement of this great development tool.

I would like to know if you can publish a road map, a list of features that we can look for.

I have been analyzing other development platforms Shiva, Corona, Monkey and Unity, I like Unity but the cost does not justify the investment.
I am studding a lot and I am building my own physics library, so having the road map I can plan better the time I am investing on GLB.

Thank you,
Is it possible to have optional parameters in FUNCTIONS?

For instance in the example below z may be optional.

Code (glbasic) Select
FUNCTION object: x, y, z (as optional)
This sounds silly but how can I usee the RND function to generate a random number between -1 and 1? Instead of 0-1?
I am trying to return a type from a function inside the Type, I am getting this error:
Quote*** Configuration: WIN32 ***
GPC - GLBasic Precompiler V.9.829 SN:b4f5b7db - 3D, NET
"Vectors1-10.gbas"(207) error : wrong argument type :

The compiler points to the last line in the code saying the error is there.

I get this error on both GLB and V11.
Searching the forum I found this post from Slydog that say we can return a type,
here is my code.

Code (glbasic) Select

This is what I trying to accoumplish, the code below is in JAVASCRIPT
Code (glbasic) Select
PVector mouse = new PVector(mouseX,mouseY);
PVector dir = PVector.sub(mouse,location);

I am using the Type as a class.
Code (glbasic) Select
TYPE TObject
FUNCTION set: x, y
self.x = x
self.y = y
FUNCTION add: v AS TObject
    self.x = self.x + v.x
    self.y = self.y + v.y
    FUNCTION subv: v AS TObject
    self.x = self.x - v.x
    self.y = self.y - v.y
    FUNCTION subv2: v1 AS TObject, v2 AS TObject
    v1.x = v1.x - v2.x
    v1.y = v1.y - v2.y

GLBasic Team,

It is the time to contribute and give something back to this developer community. (GLBasic Rocks!) :nw:

First of all I have to say that I am not the best programmer as many in this forum, I have been working with GLB for over 2 years and I keep learning.

A while ago I needed a particle system to simulate an explosion in my game Brick Buster for iOS and WebOS devices.
It should work well on Android but I don't have the devices to test therefore I did not launch it in the Goggle Play market.
(Any volunteers to test it are welcome  :enc:)

There are two attachments, a picture of the test program and the entire GLB Project!!!

The Test Program

When you run the test program you will see the fireworks and a menu with 5 choices.
Just hover the mouse over the option you want and click to increase or change the value of the particle system.
The test program allows you to control the particle system variables as follows:
Particles - this controls the number of particles in the system, from 64 to 1024.
Life - The duration of each particle, from 0.5 to 10.5.
Mode - Explode the particles or Implode the particles.
Dot Size - Is the size of each particle. from 1 to 5
The test program simulates fireworks on the screen and you can turn on and turn off the sound.
Sound -Turns the sound on and off
I also included in the test program the following functions:
Mouse control
Text formatting and mouse hover, both will automatically adjust to any screen size.

Using the Particle System
In your program you first call the allocParticle() to instanciate the particle system.
Then you call drawparticles() to draw then in the particle array object.
Last you call moveparticles() from your update function.
The particle Type object has the following variables:
Code (glbasic) Select
TYPE  Tparticle
colors=0 //points to array of colors

This particle system has 2 features: Explode and Implode.

Gernot can you pin this post to the Code Snippets? :good:

Play with it and I hope you enjoy :D
GLBasic - en / iOS 7 Beta
Hello GLB Community,

Today I had a chance to test the iOS 7 Beta on the iPhone 4S.
So far all my GLBBasic apps ran without any problem.

As far as the iOS 7 Beta there are some small bugs, but overall it it a nice OS.
The new iOS 7 SDK has ne APIs and will allow pier -pier WiFi communications, that's what the new Air Drop uses

One thing I notice is that the new multitasking features reminds me of the WebOS because it is similar, you can flip throught the applications and then remove then like the cards in WebOS.
More info here:
This example from the GLB Help file does not work.

When I compile it gives the following error:
Code (glbasic) Select
C:\Users\ACARVA~1\AppData\Local\Temp\glbasic\gpc_temp0.cpp: In function `int __GLBASIC__::__MainGameSub_()':
C:\Users\ACARVA~1\AppData\Local\Temp\glbasic\gpc_temp0.cpp:65: error: invalid initialization of non-const reference of type '__GLBASIC__::DGNatArray&' from a temporary of type 'int'
C:/Program Files (x86)/GLBasic_v11/Compiler/platform/Include/glb.h:1370: error: in passing argument 1 of `DGNat __GLBASIC__::MEM2SPRITE(__GLBASIC__::DGNatArray&, DGNat, DGNat, DGNat)'
*** FATAL ERROR - Please post this output in the forum

Does any body know what is wrong?

Code (glbasic) Select
LOCAL w%, h%, pix%[]
IF LOADSPRITEMEM("test.png", w%, h%, pix%[])
   MEM2SPRITE(0, w%, h%, pix%[])

I am trying some code from DaCarSoft from the spanish forum

I Created a GLB project and included iOSKeyBoadTest.gbas and the

when I compile I get the following errors from the linker:

Code: GLBasic [Select]
gpc_temp0.o:gpc_temp0.cpp:(.text+0x1f6): undefined reference to `_iOSMessageBox'
gpc_temp0.o:gpc_temp0.cpp:(.text+0x59a): undefined reference to `_GetiOSMessageBoxValues'
gpc_temp0.o:gpc_temp0.cpp:(.text+0x6ed): undefined reference to `_iOSMessageBox'
gpc_temp0.o:gpc_temp0.cpp:(.text+0x8ef): undefined reference to `_GetiOSMessageBoxValues'
*** FATAL ERROR - Please post this output in the forum

The  iOSKeyBoadTest.gbas includes this code:

Code (glbasic) Select

IMPORT "C" void iOSMessageBox(const char*,const char*, const char*, const char*)
IMPORT "C" const char* GetiOSMessageBoxValues()


// El nuevo símbolo de separación para los parámetros a pasar a la función es la "tubería", antes era $, en mi código anterior...
iOSMessageBox("Título","Mensaje" + CHR$(0xD) + CHR$(0xD) + CHR$(0xD) + CHR$(0xD), "Esto es una prueba  ü Ñ |:P", "Aceptar|Cancelar")

LOCAL InstanteComienzo% = GETTIMERALL()

        SLEEP 500
        WHILE ABS(GETTIMERALL() - InstanteComienzo%) < 500

        MENSAJE$ = GetiOSMessageBoxValues()

PRINT MENSAJE$, 100, 100


iOSMessageBox("Título","Mensaje" + CHR$(0xD) + CHR$(0xD), "Esto es otra prueba", "Aceptar|Cancelar")

InstanteComienzo% = GETTIMERALL()

        SLEEP 500
        WHILE ABS(GETTIMERALL() - InstanteComienzo%) < 500

        MENSAJE$ = GetiOSMessageBoxValues()

PRINT MENSAJE$, 100, 100


and the this:

Code (glbasic) Select
#if defined (TARGET_OS_IPHONE)


//#import <UIKit/UIAlert.h>    // No es necesario duplicar la importación hecha con anterioridad

@interface GLBasicMessageBoxer: NSObject <UIAlertViewDelegate>
    // Declaración de los punteros para los elementos comunes
    UITextField* txtObject;
    NSMutableArray* resObjects;
    NSString* resValues;
    NSString* pTitle,* pMessage,* pLabels,* pButtons;

@implementation GLBasicMessageBoxer

// Llamada necesaria para llamar al código que muestra el Alert en el proceso principal
- (void)showAlertCaller:(NSString*)cTitle andMessage:(NSString*)cMessage andLabels:(NSString*)cLabels andButtons:(NSString*)cButtons
    // Introducción de los valores pasados como parámetro punteros accesibles por "showAlert"
    pTitle = [[NSString alloc] initWithString:cTitle];
    pMessage = [[NSString alloc] initWithString:cMessage];
    pLabels = [[NSString alloc] initWithString:cLabels];
    pButtons = [[NSString alloc] initWithString:cButtons];
    // Llamada a "showAlert" enviándola al proceso principal
    [self performSelectorOnMainThread:@selector(showAlert) withObject:nil waitUntilDone:NO];
- (void)showAlert
        // Creación de la vista para el Alert
    UIAlertView* alert = [[UIAlertView alloc] init];
        alert.title = pTitle;
        alert.message = pMessage;
        alert.delegate = self;
    // Anulación de la asignación de la función de cancelar al botón con índice 0
    alert.cancelButtonIndex = -1;
        // Creación de la matriz de botones introduciendo valores según los parámetros pasados separados por "|"
        NSArray* aButtons = [pButtons componentsSeparatedByString:@"|"];
    // Creación de cada botón a partir de cada valor de la matriz
        for (NSString* iObject in aButtons){
                [alert addButtonWithTitle:iObject];
        // Creación de la matriz de controles de texto introduciendo valores según los parámetros pasados separados por "|"
        if (pLabels != @"") {
                double iPos = 70.0;
                NSArray* aLabels = [pLabels componentsSeparatedByString:@"|"];
        resObjects = [[NSMutableArray alloc] init];
        // Creación de cada control de texto con las propiedades adecuadas asegurando que no devuelve un valor "(null)" mediante .text = @""
                for (NSString* iObject in aLabels){
                        txtObject = [[UITextField alloc] init];
                        txtObject.frame = CGRectMake(12.0, iPos, 260.0, 25.0);
            txtObject.text = @"";
                        txtObject.placeholder = iObject;
                        txtObject.backgroundColor = [UIColor whiteColor];
                        txtObject.clearButtonMode = UITextFieldViewModeWhileEditing;
                        txtObject.keyboardType = UIKeyboardTypeAlphabet;
                        txtObject.keyboardAppearance = UIKeyboardAppearanceAlert;
                        txtObject.autocapitalizationType = UITextAutocapitalizationTypeNone;
                        txtObject.autocorrectionType = UITextAutocorrectionTypeNo;
                        txtObject.borderStyle = UITextBorderStyleLine;
            // Colocación del foco si es el primer control creado para introducción de texto
                        if ([aLabels indexOfObject:iObject] == 0) {
                                [txtObject becomeFirstResponder];
                // El teclado aparece automáticamente al colocar el foco en un control de texto
            // Aumentar el valor de la variable que controla la coordenada de posición del "top" de cada control de texto
                        iPos = iPos + 30.0;
                        // Asociación de cada control a la matriz mutable
            [resObjects addObject:txtObject];
            // XCode soporta añadir controles de texto directamente a un Alert pero Apple no permite su uso directo al no estar documentado
            // Para poder imitar el comportamiento pueden agregarse "subvistas" al Alert e introducir los controles necesarios en ellas
                        [alert addSubview:txtObject];
            [txtObject release];
            txtObject = nil;
        [alert show];
        [alert release];

// Recogida del botón pulsado en la memoria mediante la propiedad "delegate" (= self) asignada en "showAlert"
- (void)alertView:(UIAlertView*)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
        resValues = [[NSString alloc] initWithFormat:@"%d", buttonIndex];

// Código que obtiene y trata los valores para construir el resultado mediante valores separados por "|"
- (void)getValues
    // Agregado a la cadena del botón pulsado de los valores de cada control de texto en el Alert
    for (UITextField* iObject in resObjects){
        // Insertar el texto recogido del control en un NSMutableString
        NSMutableString* tmpObjectValue = [[NSMutableString alloc] initWithString:iObject.text];
        // Reemplazar el caracter usado en el código como separador de valores si el usuario lo ha introducido en los controles
        [tmpObjectValue replaceOccurrencesOfString:@"|" withString:@"!" options:0 range:NSMakeRange(0, [tmpObjectValue length])];
        // Agregar el valor obtenido al contenido anterior de la memoria
        resValues = [resValues stringByAppendingFormat:@"|%@", tmpObjectValue];
        // Liberar la memoria
        [tmpObjectValue release];
        tmpObjectValue = nil;
    // Creación de otro puntero "NSData" temporal para albergar los valores obtenidos transformados para evitar errores por "encodings"
    NSData* tmpValuesEncoded = [[NSData alloc] init];
    // Conversión de la cadena obtenida a un "encoding" Windows Latin obviando los caracteres no reconocidos mediante "allowLossyConversion"
    tmpValuesEncoded = [resValues dataUsingEncoding:NSWindowsCP1252StringEncoding allowLossyConversion:YES];
    // Reintroducción de la cadena final convertida al "encoding" adecuado para que pueda devolverse desde "getValuesCaller"
    resValues = [[NSString alloc] initWithData:tmpValuesEncoded encoding:NSWindowsCP1252StringEncoding];
    // Liberar la memoria
    tmpValuesEncoded = nil;

// Obtención de los valores del botón pulsado y texto introducido en los controles recuperando los valores desde el proceso principal
- (const char*)getValuesCaller
    // Comprobación de si se ha pulsado un botón del Alert
    if (resValues != nil){
        // Llamada a "getValues" en el proceso principal
        [self performSelectorOnMainThread:@selector(getValues) withObject:nil waitUntilDone:YES];
        // Devolvemos el valor de la cadena preparada desde "getValues"
        return [resValues cStringUsingEncoding:NSWindowsCP1252StringEncoding];
        // Liberar la memoria
        [resObjects release];
        resObjects = nil;
        [resValues release];
        resValues = nil;
        [pTitle release];
        pTitle = nil;
        [pMessage release];
        pMessage = nil;
        [pLabels release];
        pLabels = nil;
        [pButtons release];
        pButtons = nil;
        [self release];
        [super dealloc];
        // Si no se ha pulsado ningún botón se devuelve una cadena vacía
        return "";


// Creación del puntero para las funciones contenidas en "GLBasicMessageBoxer" a usar cada vez que se requiera un Alert
GLBasicMessageBoxer* newAlert;

// Creación de función "externalizada" a usar desde GLBasic (los parámetros "labels" y "buttons" pueden contener varios valores separados con "$")
extern "C" void iOSMessageBox(const char* cTitle, const char* cMessage, const char* cLabels, const char* cButtons)
        newAlert = [[GLBasicMessageBoxer alloc] init];
    // Conversión de tipos "C" a "NSString" al recuperar los parámetros enviados desde GLBasic y lanzado del Alert
        [newAlert showAlertCaller:[NSString stringWithCString:cTitle encoding:NSASCIIStringEncoding] andMessage:[NSString stringWithCString:cMessage encoding:NSASCIIStringEncoding] andLabels:[NSString stringWithCString:cLabels encoding:NSASCIIStringEncoding] andButtons:[NSString stringWithCString:cButtons encoding:NSASCIIStringEncoding]];

// Creación de la función "externalizada" a usar desde GLBasic (los parámetros devueltos son valores separados con "$")
extern "C" const char* GetiOSMessageBoxValues()
    // Se recuperan en primer lugar el índice de botón pulsado y a continuación los textos introducidos en los controles generados
        return [newAlert getValuesCaller];



GLB Community,

I am developing and app for mobile devices that retrieves text and information from the web and then displays to the user.
Since the information will not fit the screen the user need to scroll up or down touching the screen of the device.
On the screen I will have images and text.

Does any one knows a sample or GLB command that can help me manage the screen scrolling?
GLB Team,

I am using LTRIM$ to remove some tags from a text string.
For some odd reason LTRIM$ or TRIM$ is removing the first character after the text it is trimming.
I tried this code in GLB V 11.261 and GLB V 10.283 the result is the same.

Here is the code used:

Code (glbasic) Select
tempmsg$ = LTRIM$(msg$ ,"<![CDATA[")

Here are the input message and the message after the trimming:

msg$: <![CDATA[The 33 directors of the 500 Festival received their Indianapolis 500 Chevrolet Camaros in a ceremony Wednesday at the Indianapolis Motor Speedway, a longtime tradition leading into the Month of May and ?The Greatest Spectacle in Racing.?]]>

tempmsg$: he 33 directors of the 500 Festival received their Indianapolis 500 Chevrolet Camaros in a ceremony Wednesday at the Indianapolis Motor Speedway, a longtime tradition leading into the Month of May and ?The Greatest Spectacle in Racing.?]]>

For now I resolve the issue using the replace$ command:

Code (glbasic) Select
tempmsg$ = REPLACE$(tempmsg$ ,"<![CDATA[","")
Hi GLBasic Community,

Another game powered by GLBasic is out!!!
I am happy to announce that my game BrickBusterHD is ready for sale at the Apple App Store!
This is my first game made with GLBasic, I originally made it for the WebOS, and I converted to GLB.

I had lots of challenges but after a lot of work and help from GLB community it is done! (Specially the people that helped with the translations)  :nw:
Some of the features are:

  • Virtual keyboard
  • Particles System
  • Universal screen re-size

This games can run on several mobile platforms because of the features above!

You can find more information here:
I came here to ask the help of the GLB community!

I need you help to translate the following text to these language:

German, Italian, French, Spanish, Japanese.

"Brick Buster is a new version of the classic Breakout game for the mobile devices.
Touch the screen to move the paddle and deflect the ball to destroy the bricks.
Get more points when you hit the butterfly that appears between phases.
Destroy bricks faster when you get 2 or 3 balls!
Challenge your friends to see who gets the high score!"

Thank you in advance!

As I am getting ready to submit my game to the Apple App Store I am testing my game on different hardwares.
This game is running well on the iPad Min, iPhone 4S running with iOS 6.1.
When I stat the app on the iPod 4th Generation, running iOS 6.1, I get a memory warnings and the application quits.

Here are the memory warnings errors:

2013-02-15 19:13:34.073 BrickBuster[236:907] Received memory warning.
-applicationDidReceiveMemoryWarning - free mem=4032 kB
2013-02-15 19:13:36.091 BrickBuster[236:907] Received memory warning.
-applicationDidReceiveMemoryWarning - free mem=2024 kB
2013-02-15 19:13:37.803 BrickBuster[236:907] Received memory warning.
-applicationDidReceiveMemoryWarning - free mem=4836 kB

Here is the entire Xcode error log

init with frame.
App wants to support retina...
Retina scaleing available: self.contentScaleFactor = 2.000000
desktop backing: 640 x 960
mainScreen: 640x960
glb_notify_screen_size 640x960
slaunch ok
-applicationDidBecomeActive    -> unpause
2013-02-15 19:13:27.501 BrickBuster[236:907] Application windows are expected to have a root view controller at the end of application launch
rbow init
Rbow::SetScreen( 1536,2048)
get accurate timer - 1st call
flip - 1st call
BGRA ext supported
Texture size limit: 2048
init fbo
OGRB init [OK]
Window mode
Create DXin
exepath=curdir= /var/mobile/Applications/F27E56F4-E05D-42C5-AA81-DF4B705A11B9/
init gettimer
clear screen
finding font...
AudioStreamBasicDescription:  2 ch,  44100 Hz, 'lpcm' (0x00000029) 32-bit little-endian float, deinterleaved
Init Finalized
loadeffect - i: 0 eff: 2400
loadeffect - i: 1 eff: 2402
loadeffect - i: 2 eff: 2404
loadeffect - i: 3 eff: 2406
loadeffect - i: 0 eff: 2408
loadeffect - i: 0 eff: 2410
loadeffect - i: 0 eff: 2412
loadeffect - i: 0 eff: 2414
loadeffect - i: 0 eff: 2416
loadeffect - i: 0 eff: 2418
loadeffect - i: 0 eff: 2420
loadeffect - i: 0 eff: 2422
2013-02-15 19:13:34.073 BrickBuster[236:907] Received memory warning.
-applicationDidReceiveMemoryWarning - free mem=4032 kB
2013-02-15 19:13:36.091 BrickBuster[236:907] Received memory warning.
-applicationDidReceiveMemoryWarning - free mem=2024 kB
2013-02-15 19:13:37.803 BrickBuster[236:907] Received memory warning.
-applicationDidReceiveMemoryWarning - free mem=4836 kB
GLBasic - en / NETWE
How can I use NET command to open a web site but not end my application?
I tried NETWEBEND it opens the browser but my app freezes.
This is on WEBOS, iOS and Windows.
Hi I am having difficulties with GLB_ON_PAUSE, GLB_ON_RESUME and GLB_ON_QUIT on iOS 6.
I am testing my code on an iPhone 4S.

I have set AUTOPAUSE TRUE in the beginning of my code.

My game starts fine the I press the "home" button and the app goes in the back ground.
When I click on my app icon, the program resumes were it stopped and them after feel seconds QUITS.
As you can see the on the Debug log below from Xcode GLB_ON_PAUSE is called and GLB_ON_RESUME is also called

I see that iOS asked the app to free memory. Can these be the reason my program is quitting  after resume?

Here is the Debug from Xcode:

Init Finalized
Loading Music: Media/sounds/intro.mp3
Status: 0
-applicationWillResignActive   -> pause
-applicationDidEnterBackground -> pause
2012-12-27 22:16:01.719 iPhone[4895:907] Received memory warning.
-applicationDidReceiveMemoryWarning - free mem=5160 kB
-applicationWillEnterForeground-> do nothing
-applicationDidBecomeActive    -> unpause
Shut down GLB
Error enqueuing new buffer: -66632
Error enqueuing new buffer: -66632
Error enqueuing new buffer: -66632
glb is shut down

Here a portion of  the code:
Code (glbasic) Select

GOSUB saveGame
debu ("QUIT")
debu ("PAUSE")
debu ("RESUMED")
FUNCTION debu: data_in$
STDOUT "[GLB]->" + data_in$ + "\n"
DEBUG "[GLB]->" + data_in$ + "\n"

Hello GLB developers.

This is a new game console that will hit the market in 2013.
It runs on Android.
Please see details on the link below.

May be GLBasic will have a compiler for it.
GLBasic - en / GLBasic V11

What is the status on V11? I remember reading on previous posts that it was scheduled to Summer 2012.
Are you planing to demo V11 on a video?
Is it possible to get a beta of V11? I am interested to see how the screen layout with buttons, text boxes and etc will work and the new IDE.

How can I disable the iOS screen timeout in GLBasic?
Did any one that included iAds and Promocodes for iOS devices?

Can you share some examples?