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.

Topics - Moebius

Pages: [1] 2
GLBasic - en / DGStr::GetStrData(size)?
« on: 2012-Oct-20 »
The help file under INLINE mentions this function, but whenever I try to use it the compiler tells me that "class __GLBASIC__::DGStr has no member named 'GetStrData'".
Does the help file list the wrong name?  or what should I be using here?  Thanks.

I'm having a slight problem with using custom functions with SORTARRAY.  The example (sorting primitive types) works, but not types are used.

This is the error:
In file included from C:\Users\James\AppData\Local\Temp\glbasic\gpc_tempg.cpp:2:
C:\Users\James\AppData\Local\Temp\glbasic\gpc_temp.h:8: error: `Anything' was not declared in this scope
C:\Users\James\AppData\Local\Temp\glbasic\gpc_temp.h:8: error: `Anything' was not declared in this scope
C:\Users\James\AppData\Local\Temp\glbasic\gpc_temp.h:8: error: initializer expression list treated as compound expression

As gpc_temp.h is included in the different source files, this error is repeated a few times, but its complaining about the line of 'gpc_temp.h' that declares the sort function:
Code: (glbasic) [Select]
DGInt SortFunc(Anything A, Anything B);

Demo snippet:
Code: (glbasic) [Select]

LOCAL Array[] AS MyType



IF A.var > B.var THEN RETURN 1
IF A.var < B.var THEN RETURN -1


Hi, sorry to submit another bug report, but I've been having problems with closing and reopening sockets...  Please look to the following:
Code: (glbasic) [Select]
// 1) Try with the 'close then reopen' commented.  Everything works as expected.

// 2) Try with the 'close then reopen' uncommented.  Only broadcast messages get through.

// 3) Do the same and try pressing 'enter'.  It's as if SOCK_SHUTDOWN properly closes the sockets, and SOCK_CLOSE doesn't...

LOCAL HostS%, ClientS%


HostS% = SOCK_UDPOPEN(11111)
ClientS% = SOCK_UDPOPEN(11112)

// If the socket is closed and then reopened, only broadcast messages are received.
// Try commmenting and uncommenting this:

ClientS% = SOCK_UDPOPEN(11112)




// Press spacebar to send a broadcast and specific message:
IF KEY(57)

SOCK_UDPSEND(HostS, "Broadcast\r\n", SOCK_GETIP(""), 11112)
SOCK_UDPSEND(HostS, "Specific\r\n", SOCK_GETIP(""), 11112)



// Press enter to 'reset' networking - after this both broadcasted and specific messages get through.
// It's as if SOCK_SHUTDOWN properly unregisters all of the sockets, but SOCK_CLOSE doesn't.
IF KEY(28)


HostS% = SOCK_UDPOPEN(11111)
ClientS% = SOCK_UDPOPEN(11112)


IF SOCK_RECV(ClientS, Msg$, 16) THEN DEBUG Msg$




Basically, it appears that SOCK_CLOSE isn't properly 'unregistering' the socket - or something like that.  I first got onto this because, I've found, two different instances of the same program can use the same port for receiving messages if, and only if, the message is broadcasted.  A non-broadcasted message is received only by the program that registered the port first.
It seems to be a similar thing with sockets in one program.  If you create and then close a socket, it is as if the messages sent to that port are received by the first socket - which was closed.  The newly created socket will only receive broadcast messages.

This was really annoying and took a while to figure out, but I got around this easily by initialising the sockets just once, and so has no personal priority, but I'd might as well report it anyway.

Platform-wise, it occurs on Windows and (99% sure) OSX and iOS, but Android is completely fine.

...doesn't work if more than one 'symbol' is specified in the array's index.  The best way to describe this is with a few examples:

Code: (glbasic) [Select]
// Extended type declaration...
TYPE ExtType

Var  // One variable...

FUNCTION Dummy:  // One function...


// Create the array...
LOCAL TypeArray[] AS ExtType
DIM TypeArray[1]

// Variables for demonstration:
LOCAL a = 0, b = 0, c = 0, d

d= TypeArray[0].Dummy() // Compiles
d= TypeArray[a].Dummy() // Compiles
d= TypeArray[a + b + c].Var // Compiles

d= TypeArray[0 + 0].Dummy() // Doesn't compile
d= TypeArray[ (0 + 0) ].Dummy() // Doesn't compile
d= TypeArray[0 * 0].Dummy() // Doesn't compile
d= TypeArray[a + b].Dummy() // Doesn't compile
d= TypeArray[ (a + b) ].Dummy() // Doesn't compile


The error produced is is "call to undefined function : ExtType".  You can quite easily get around it by using a temporary variable and passing that as the index, but seeing as this problem is specifically to do with functions in extended types, perhaps there's an only smallish code issue...

Bug Reports / STARTDATA - Syntax Error?
« on: 2011-Jul-04 »
Using GLB V 10.013, this:
Code: (glbasic) [Select]
causes the compiler to report a "syntax error" at the STARTDATA line for me...
Does the same thing happen for anyone else?

In Google Chrome, my logging into the forum is not 'remembered' (i.e. logging in 'Forever' doesn't work)...
I've tried clearing my cookies, but the problem is still there.

I don't have the same problem in IE 8...

I'm not sure if anything can be done about this, but this problem only started happening recently - perhaps a forum update has caused this problem in Chrome?

I remember before that other people were having this problem.  Is the same true now?

Sometimes in Windows, my programs behave incredibly slowly (i.e. down from 60 FPS to 2 FPS!), as if they have no hardware acceleration (could this be it??)
Normally, after a restart or patiently waiting a while everything returns to normal speed...

Has this happened to anyone else?  I'm not sure if it can be considered a 'bug' if it only happens to me and is beyond the control of GLBasic...

Hello everyone,

Looking into options for using the native keyboard in iOS, I stumbled across this:
It is an alert view with an input box, exactly like the type of alert that Apple uses to prompt you for your itunes account password or similar things.

The code doesn't look relatively complicated at all, but saying that I am still utterly incapable of getting it into a state that works with a function call to display it.

It would be nice if one could get the entered text both synchronously and asynchronously, but my Objective-C knowledge in combination with my persistent trial-and-error hasn't been enough...

Anyway this would be a useful wrapper to have - an easy function for input on iOS, although it won't be in 'line' like input is on other platforms.

Thanks in advance to anywone who looks into this.

I've been trying to figure out for some time why some of my apps crash and some don't, and it seems to be down to an innocent, 'smallfont.png'.
I noticed on windows that if a 'smallfont.png' file is present in the .app folder, the program seems to load this at startup and set it as the default font.  Hence, it is very useful for testing purposes as I can easily replace GLBasic's default font with something more readable.
Trying this on iOS, it fails.  I'll post the output from GDB soon but from memory sometimes it is a lot of gibberish about messages, other times it says something about 'libpng-gf' failing (which is understandable), followed by SIGABRT which from what I understand is something about aborting the application.

Anyway is it possible to resolve this issue?  It's annoying that such a handy way to change the font, particularly for testing and debugging purposes, would cause such problems.

Making use of Trucidare's awesome iBluetooth wrapper, I noticed that in the IDE, the following line:
Code: (glbasic) [Select]
IMPORT "C" const char* GLB_iBT_Recv()'Creates' a new function in the IDE called "char*" rather than GLB_iBT_Recv().
Similarly this is recognised as importing 'int':
Code: (glbasic) [Select]
IMPORT "C" long int hello()
There doesn't seem to be any problems when compiling, but somewhere in its code the IDE needs to recognise that the last 'word' is the function rather than the next word after the first type-specifying keyword.

The word completion in the GLB IDE is very useful, but it because annoying to have to press Ctrl-T to bring it up every time.  Would it be possible to have an option to open the word complete box automatically?  Not a major request, but I feel it's probably an underused feature, and it would be nice to allow it to come up automatically like in other IDEs.

IDE/Syntax / Global variables in INLINE?
« on: 2011-Jan-14 »
Would it be possible to allow INLINE code to declare global variables?  It would be good if having "GLOBAL int myvar;" would cause GLB to move the declaration outside of any functions, allowing us to declare global variables of any type in inline code.  Is this okay to implement?

EDIT:  Killed measly request...

EDIT:  Updated request:
Currently we have shorthand functions for various operations (e.g. INC, DEC, POW, MOD), but nothing for multiplying and dividing.  Could we have functions like 'MUL' and 'DIV' to complete the operator set?

The following operators are available in C++:
+=, -=, *=, /=, %=, >>=, <<=, &=, ^=, |=

Could they be allowed through by GPC?  They can be useful in code, and are supported natively in C++, so from what I know the precompiler won't have to do any conversion.

Anyway, could these be 'included' in the allowed syntax?

Hi everyone,

When I try to compile the code at the bottom of the post, the compiler reports that both inline functions were 'not declared in this scope'.  I have no idea as to how I can avoid this, and I thought that I've followed the tutorial in the FAQ perfectly...

Anyway, of course I can avoid this by calling the declared functions in the main program, but according to the tutorial, one should be able to call declared functions inside GLB functions without scope errors.

I have two queries:
- Can the scope issues be avoided WITHOUT doing something like calling the declared functions in the main code or declaring them at the start of the function?
- Will redeclaring the functions every time 'MoveMouseMiddle()' (i.e. sticking the declarations at the start of the function) cause the program to reload those DLL functions every time?

Thanks in advance  :nw:

Code: (glbasic) [Select]
DECLARE(ClientToScreen,"user32.dll",(void*, DECL_POINT*),int);
DECLARE(SetCursorPos,"user32.dll",(long x, long y),int);
//You can change 'Width' and 'Height' to constants if you wont change the project size - should be faster to do so.
MyPOINT.x = MyPOINT.x / 2
MyPOINT.y = MyPOINT.y / 2

FUNCTION MoveCursorMiddle:
ClientToScreen(GLBASIC_HWND(), &MyPOINT);
SetCursorPos(MyPOINT.x, MyPOINT.y);

Beta Tests / Polyvector Background Speed Test
« on: 2011-Jan-03 »

I would like to use some sort of a multilayered parallax background in my projects, and I need to see how much various iDevices can support.
I only have one, so if any of you have the time could you please run this test app?  I've uploaded the XCode project and a '.ipa' file (archived app).

If you do run it, you can use your finger to 'move around' if you like, and then, after waiting 10 seconds or so for the FPS counter to stabilise (due to my terrible code), please post what it says and the device you used.

Thanks in advance to anyone who can be bothered  :nw:

XCode Project:

.ipa File:

Pages: [1] 2