Menu

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

Messages - DaCarSoft

#166
Wenassss...

A ver... a ver...

Igual me estoy colando...   igual ya estoy un poco "off topic"... porque la verdad es que no he ido siguiendo el tema despacio ni he investigado las "inapp purchases" pero eso de que algo en un 3GS funcione pero no en un iPhone 4 me suena a estar relacionado con la versión del firmware y el reciente cambio en la forma de usar algunos objetos por parte de Apple...   Supongo que el código en iOS 4.2.1 o superior no funcionaría en ningún dispositivo sin retoques...

Tuve un problema parecido con mi código para utilizar el teclado de iOS con GLBasic (ver: http://www.glbasic.com/forum/index.php?topic=5747.msg46200#msg46200)

Un saludo.
-David-
#167
Hola de nuevo.

Yo estaría encantado de colaborar...   si tuviese tiempo  :P

Ahora mismo apenas tengo tiempo para GLBasic, los quehaceres y obligaciones en los que me enredo cada día me están retrasando demasiado...   en todo...

Como ya se ha comentado más arriba, el problema, como casi siempre, es el maldito tiempo...    XD

A lo que sí creo poder llegar (por ejemplo, por medio de este foro) es a colaborar comentando cualquier cosa que surja, acerca de GLBasic claro...

Opino que a veces, la media hora (o las doscientas :P) que alguien pierde delante de la pantalla buscando soluciones, pueden ayudar a que otra persona no pierda ese tiempo, si lo comenta en un foro...  así, el que ahorró tiempo puede volver a perderlo buscando otra solución distinta...

Nos "leemos"   XDDDD

     
#168
Dios...

Aún conservo como valiosas reliquias mis revistas de MicroHobby, Micromanía e Input Sinclair...
¡Qué tiempos! ¡Qué recuerdos!

Empecé programando en un Inves ZX Spectrum +, con teclado "blando" en español, al igual que su ROM traducida. Era una versión del superventas de Sinclair muy particular.

Echo de menos los pixelados juegos de antaño, en los que los Españoles éramos los mejores programadores y los más originales (¿alguien jugó al "Capitán Sevilla?), al igual que echo de menos portadas de verdad, como las de Alfonso Azpiri.

Hoy ya no se valoran aventuras como "La Abadía del Crimen" que funcionaban en tan sólo 128K de RAM o menos...

En nuestras manos (o yemas de los dedos :P) está la posibilidad de recuperar una diezmillonésima parte de aquellos maravillosos años con GLBasic y un poco de creatividad...      Si nuestros trabajos y obligaciones nos dejan...


¡Ánimo a todos!
#169
Wenas a todos.

Mmmm...   

Yo diría que el formato nativo para iOS efectivamente es el H264, pero parece ser que hay limitaciones tanto en el bitrate como en la resolución máximos para que funcione.

Digo esto sin testear nada, pero probablemente todo funcione correctamente si se codifica el vídeo con el códec y la resolución adecuada.

Yo probaría a intentar reproducir desde GLB un vídeo transcodificado con "Handbrake", desde un Mac. Yo ahora mismo ando un poco justo de tiempo...   pero... ¿alguien se anima a probarlo? XD
#170
Saludos desde Ciudad Real.

¡¡¡La verdad es que no me había fijado en que ya hay foro en español!!!


Si no llega a ser por TheHark0, igual no me doy cuenta hasta dentro de tres meses...   :P

Yo programo cuando puedo, en rachas...   "aleatorias"...     :P


Cada vez somos más, por lo que veo XD
#171
I just end of testing it.

The final version is OK, almost for me.

Some options have changed its position, and now looks like iTunes  :D


Regards!
#172
Then...  I suppose that it is needed to send to "PerformSelectorOnMainThread" the four arguments of "showAlert".

Perhaps this code may help:

http://goodliffe.blogspot.com/2011/01/ios-performselectoronmainthread-with.html

#173
Hi!

First of all, I would like to say that I appreciate the interest in the testing of this code, I think that it is possible to complete the code, and expand it (for example to rotate the view depending on the device orientation)  with the collaboration of all people   :)

I know that the code could be better, but I'm focused in solve a problem related to the addition of the textfields to the UIAlert, and I suppose that it may be the origin of some of the problems found related to the testing of the code... if you test the code in an iDevice with iOS 4.0.1 all runs fine, but if you test the code under 4.2.1, the app crashes when the "addSubview" is called...  :S

If I comment the next line the code works for me (without textboxes): 

[alert addSubview:txtValue];

obviously changing it with this:

// [alert addSubview:txtValue];


But my question is...   Why the same code runs in older iOS but don't work in the last 4.2.1 version????
Can someone confirm this???

At the other side, it is needed to "release" or destroy the objects created because (for me) the code does not work if I call to the functions a second time...   I think that I know how can I do that...    I will continue with my testing and I'll paste here the changes.

Also, may be I'm totally wrong because I don't know so much about XCode, these are the first lines of code that I try in it  :P


Good luck!!!
#174
Thanks Trucidare, I was thinking in using the ".tag" property also making some changes in the code.

I'm focused in solve some troubles with the code, it's to say:

-Under the iPad does not work (iOS 4.2.1 and GLBasic 9.006) it appears to be a problem with "addSubView" but under iPhone, iPod or iPhone 4 the code shows correctly the Alert and gives me the text value.

-I don't know how to work with non english characters.

-I don't know how to avoid the fail when you call to the Alert for a second time... (The second alert freezes when you press a first letter).


This is the code in working, yet unfinished:

for the .mm file:
Code (glbasic) Select

#if defined (TARGET_OS_IPHONE)
#import <UIKit/UIAlert.h>


@interface GLBasicMessageBoxer: NSObject <UIAlertViewDelegate>
{
UITextField* txtValue;
NSString* resButton;
}
- (void)showAlert:(NSString*)pTitle andMessage:(NSString*)pMessage andLabels:(NSString*)pLabels andButtons:(NSString*)pButtons;
- (const char*)getValue;
@end

@implementation GLBasicMessageBoxer

- (void)showAlert:(NSString*)pTitle andMessage:(NSString*)pMessage andLabels:(NSString*)pLabels andButtons:(NSString*)pButtons
{

UIAlertView* alert = [[UIAlertView alloc] init];
alert.title = pTitle;
alert.message = pMessage;
alert.delegate = self;

NSArray* aButtons = [pButtons componentsSeparatedByString:@"$"];
for (NSString* iObject in aButtons){
[alert addButtonWithTitle:iObject];
}

if (pLabels != @"") {
double iPos = 70.0;
NSArray* aLabels = [pLabels componentsSeparatedByString:@"$"];
for (NSString* iObject in aLabels){
txtValue = [[UITextField alloc] init];
txtValue.frame = CGRectMake(12.0, iPos, 260.0, 25.0);
txtValue.placeholder = iObject;
txtValue.backgroundColor = [UIColor whiteColor];
txtValue.clearButtonMode = UITextFieldViewModeWhileEditing;
txtValue.keyboardType = UIKeyboardTypeAlphabet;
txtValue.keyboardAppearance = UIKeyboardAppearanceAlert;
txtValue.autocapitalizationType = UITextAutocapitalizationTypeNone;
txtValue.autocorrectionType = UITextAutocorrectionTypeNo;
txtValue.borderStyle = UITextBorderStyleLine;

if (iPos == 70.0) {
[txtValue becomeFirstResponder];
}
iPos = iPos + 30.0;

[alert addSubview:txtValue];


}

}

[alert show];
[alert release];
}

- (void)alertView:(UIAlertView*)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
resButton = [NSString stringWithFormat:@"%d", buttonIndex];
}

- (const char*)getValue
{
if (resButton != NULL){
return [txtValue.text UTF8String];
}
else
{
return "";
}
}

@end

GLBasicMessageBoxer* newAlert;

extern "C" void iOSMessageBox(const char* pTitle, const char* pMessage, const char* pLabels, const char* pButtons)
{
newAlert = [[GLBasicMessageBoxer alloc]init];
[newAlert showAlert:[NSString stringWithUTF8String:pTitle] andMessage:[NSString stringWithUTF8String:pMessage] andLabels:[NSString stringWithUTF8String:pLabels] andButtons:[NSString stringWithUTF8String:pButtons]];
}

extern "C" const char* GetiOSMessageBoxValues()
{
return [newAlert getValue];
}

#endif


And this, the code for GLBasic:
Code (glbasic) Select

GLOBAL MESSAGE$

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

IMPORT "C" const char* GetiOSMessageBoxValues()


iOSMessageBox("TITLE","Message..." + CHR$(0xD) + CHR$(0xD), "This is a test$and this...", "OK$CANCEL")

WHILE MESSAGE$ = ""
SLEEP 500

MESSAGE$ = GetiOSMessageBoxValues()
WEND

PRINT MENSAJE$, 100, 100
SHOWSCREEN

MESSAGE$ = ""

iOSMessageBox("TITLE2","Message2..." + CHR$(0xD) + CHR$(0xD), "This is a 2nd test$and this...", "OK2$CANCEL2")

WHILE MESSAGE$ = ""
SLEEP 500

MESSAGE$ = GetiOSMessageBoxValues()
WEND

PRINT MESSAGE$, 200, 200
SHOWSCREEN




Can someone help a little?????

Regards.


#175
Hola!  =D

Con el código del primer post tal cual, cuando se llama a GetiOSMessageBoxValues, éste devuelve el valor de la variable "resString" hasta ese justo instante, pero la llamada al "alertbox" es un proceso independiente al código de GLBasic, por lo que de alguna forma hay que esperar hasta que el valor de la variable sea el adecuado. Quizá se podría insertar un bucle en el código de GetiOSMessageBoxValues en XCode, para provocar el mismo efecto de espera desde fuera del código GLBasic, pero puede ser util que sean "asíncronos" en algunas condiciones (por ejemplo, para mover el fondo de la pantalla por detras de la ventana en tu juego, mientras se sigue a la espera de la introducción total de datos por parte del usuario), algo así como unas estrellas moviéndose mientras suena la música, ya sabes.   :P

Translation:

Hello!  =D
In the code of the first post as is, when GetiOSMessageBoxValues is called, it returns the value of the "resString" variable in that precise instant. But the call to the "alertbox" is an independent thread to the GLBasic code, because of that you need to wait in any way until the value obtained is the needed. Perhaps it is possible to insert a loop in the code of GetiOSMessageBoxValues under XCode, to create the same wait effect out of the GLBasic code, but it can be handy that asynchrony under certain conditions (for example, to move the background of your game behind the alert, while it continues waiting the user to complete the total input of data). Something like stars moving while the music is playing, you know.   :P
#176
Its nothing!
And, yes, as you say, the program loops until the string is not blank, and don't take care of "cancel" button control...

This code is a sample, that need some fixes to obtain a correct and "complete" string, that is my priority :)

I have several plans for the GetiOSMessageBoxValues(), like, for example, to include parameters in the function, may be doing something like this:

iOSMessageBoxValues("Title", "Message", "LabelAtText1$LabelAtText2$LabelAtText3", "TextAtButton1$TextAtButton2$TextAtButton3")

The function, in this way, should "explode" the parameters delimited by the separator "$" and detect the number of controls of each type needed, and show these controls into de alert box at the correct position...

After, we could use something like this:

GetiOSMessageBoxValues("Text", 1)   ---> To obtain the text at the index 1

or something like this:

GetiOSMessageBoxValues("Texts")  ---> To obtain if it is possible, as the return of the function, a matrix of results with all the values from the textboxes inside the input box...

or something like this:

GetiOSMessageBoxValues("buttons") ---> To obtain the index of the pushed button, or "none" if the user has not ended...

Then we could do something like this (for example):


WHILE BUTTON$ = "none"
   SLEEP 500
   BUTTON$ = GetiOSMessageBoxValues("button")
WEND
IF BUTTON$ = "1" ....     ---> The user has pressed the button for "Cancel" the input...
   ....
ENDIF
IF BUTTON$ = "0" ....    ---> The user has pressed the button for "Send" the input...
   MESSAGE$ = GetiOSMessageBoxValues("text")
   ....
   PRINT MESSAGE$, 100, 100
   SHOWSCREEN
ENDIF

   

There could be several ways to do that...    but before, the current code should be completed to work fine...

Also may be that Trucidare or Gernot have a complete code that works, and we were redesigning the "wheel"...  :P

Anyway, thanks for your suggestions and interest, I'm sure that someone may have an easy solution to complete the code correctly and we could complete the functions in the better possible way to obtaining all data and events.
#177
Hello!

After the reading of several posts in this forums, I found that many people were searching (like me) a way to obtain data using the native iOS keyboard   :S

I was trying the untested code from Trucidare (http://pastebin.com/vLcTxCX5), but it didn't work "as is" for me   :'(

As I need a way for the user to input data (usernames mostly), I was trying and thinking harder to obtain the correct source code to show an alert box on screen, expand the native iOS keyboard and wait for the user input.

And the good news are: It works!!!!   but there are also bad news: The working is not totally OK.

Its to say: I can't obtain a string longer than 8 characters (the string appears corrupt if the user input is longer) and I can't show Spanish characters like "á" or "Ñ" in the alert messages or titles...

I'm not a newbie in programming but I'm a newbie in XCode and GLBasic, and I remember only a bit of C/C++.

Someone could help???  Gernot???  Trucidare???    =D    It is near of completion...     :P

This is the code:

in the XCode project I added the next lines to a .mm file:
Code (glbasic) Select

#if defined (TARGET_OS_IPHONE)
#import <UIKit/UIAlert.h>



@interface GLBasicMessageBoxer: NSObject <UIAlertViewDelegate>
{
UITextField* txtValue;
const char* resString;
const char* resButton;
}
- (void)showAlert:(NSString*)pTitle andMessage:(NSString*)pMessage andLabel:(NSString*)pLabel;
- (const char*)getValue;
@end

@implementation GLBasicMessageBoxer

- (void)showAlert:(NSString*)pTitle andMessage:(NSString*)pMessage andLabel:(NSString*)pLabel
{
UIAlertView* alert = [[UIAlertView alloc] init];
alert.title = pTitle;
alert.message = pMessage;
alert.delegate = self;
[alert addButtonWithTitle:@"No"];
[alert addButtonWithTitle:@"Yes"];

//[alert addTextFieldWithValue:@"" label:@"T1"];    ---> This do not pass the App Store review because it is undocumented
//[alert addTextFieldWithValue:@"" label:@"T2"];    ---> This do not pass the App Store review because it is undocumented
//txtValue = [alert textFieldAtIndex:0];   

txtValue = [[UITextField alloc] init];
txtValue.frame = CGRectMake(12.0, 70.0, 260.0, 25.0);
txtValue.placeholder = pLabel;
txtValue.backgroundColor = [UIColor whiteColor];
txtValue.clearButtonMode = UITextFieldViewModeWhileEditing;
txtValue.keyboardType = UIKeyboardTypeAlphabet;
txtValue.keyboardAppearance = UIKeyboardAppearanceAlert;
txtValue.autocapitalizationType = UITextAutocapitalizationTypeNone;
txtValue.autocorrectionType = UITextAutocorrectionTypeNo;
[txtValue becomeFirstResponder];

[alert addSubview:txtValue];

[alert show];
//[alert release];
}

- (void)alertView:(UIAlertView*)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
switch(buttonIndex)
{         
case 0:
break;         
case 1:
resButton = "1";
resString = [txtValue.text UTF8String];
break;     
}
}

- (const char*)getValue
{
if (resButton == "1"){
return resString;
}
else
{
return "";
}
}

@end

GLBasicMessageBoxer* newAlert;

extern "C" void iOSMessageBox(const char* pTitle, const char* pMessage, const char* pLabel)
{
newAlert = [[GLBasicMessageBoxer alloc]init];
[newAlert showAlert:[NSString stringWithUTF8String:pTitle] andMessage:[NSString stringWithUTF8String:pMessage] andLabel:[NSString stringWithUTF8String:pLabel]];
}

extern "C" const char* GetiOSMessageBoxValues()
{
return [newAlert getValue];
}



#endif


and from GLBasic I can use this code:
Code (glbasic) Select

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

IMPORT "C" const char* GetiOSMessageBoxValues()

iOSMessageBox("Title12345678","Text12345678" + CHR$(0xD) + CHR$(0xD), "Example")

GLOBAL MESSAGE$

WHILE MESSAGE$ = ""
SLEEP 500
MESSAGE$ = GetiOSMessageBoxValues()
WEND

PRINT MESSAGE$, 100, 100
SHOWSCREEN


My next steps would be to convert in parameters the number of buttons, text of each button, number of text boxes, content of the label of each text box... to return the index of the button pressed...   but before I need to obtain the correct string from the UITextField and use characters of languages different than english (may be some thing related to the UTF8/ASCII format or may be that I have to use roman codepages...)  :rant:

Any ideas???

Thanks in advance, hope this helps someone!
#178
GLBasic 9 was failing for me, at the first execution of "EditorE.exe".
It was showing a message box telling that mfc100.dll was missing.

I was searching the origin of the error, and I found that I needed to update the Windows Installer to 3.1 rev2, to install correctly GLBasic (it appears that the Microsoft's 2010 runtimes was failing).

I use VMware and Windows XP SP2 (I suppose that SP3 does not have this problem).

Now I can run GLBasic 9 fine.

Hope this helps someone!  ;)
#179
Hello!

This is my first post here.

Before of all, I would like to send my congratulations because of the work that makes possible GLBasic and the good answers of this community.

Now, I'm creating my own functions to work with GLBasic, and I also found that Sleep does not work in my iPad (iOS and SDK 4.2) while testing, but for me it does not work if it is inside of a loop.

I can workaround it in many ways, but reading this thread (as a newbie to GLBasic), I'm asking me now if the next code does make sense:

Code (glbasic) Select
FUNCTION Pause%: delay%
  LOCAL time_start% = GETTIMERALL()
  SLEEP delay%
  WHILE ABS(GETTIMERALL() - time_start) < delay
    HIBERNATE
  WEND
ENDFUNCTION


Thanks in advance!