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

Topics - Moebius

#1
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.
#2
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:
QuoteIn 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
TYPE MyType
var%
ENDTYPE

LOCAL Array[] AS MyType

SORTARRAY Array[], ADDRESSOF(SortFunc)


FUNCTION SortFunc:  BYREF A AS MyType, BYREF B AS MyType

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

ENDFUNCTION
#3
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%

SOCK_INIT()

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:
//---------------------------------------

SOCK_CLOSE(ClientS%)
ClientS% = SOCK_UDPOPEN(11112)

//---------------------------------------




LOCAL Msg$

WHILE NOT KEY(1)


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

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

WHILE KEY(57); WEND

ENDIF

// 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)

SOCK_SHUTDOWN
SOCK_INIT()

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

ENDIF

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

SHOWSCREEN

WEND



END


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.
#4
...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...
ENDFUNCTION

ENDTYPE

// 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

KEYWAIT
END


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...
#5
Using GLB V 10.013, this:
Code (glbasic) Select
STARTDATA MyData:
ENDDATA

causes the compiler to report a "syntax error" at the STARTDATA line for me...
Does the same thing happen for anyone else?
#6
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?
#7
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...
#8
Hello everyone,

Looking into options for using the native keyboard in iOS, I stumbled across this: http://iphonedevelopment.blogspot.com/2009/02/alert-view-with-prompt.html
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.
#9
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.
#10
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.
#11
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.
#12
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?
#13
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?
Thanks.
#14
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
TYPE DECL_POINT
x%
y%
ENDTYPE
INLINE
DECLARE(ClientToScreen,"user32.dll",(void*, DECL_POINT*),int);
DECLARE(SetCursorPos,"user32.dll",(long x, long y),int);
ENDINLINE
//You can change 'Width' and 'Height' to constants if you wont change the project size - should be faster to do so.
GLOBAL MyPOINT AS DECL_POINT
GETSCREENSIZE MyPOINT.x, MyPOINT.y
MyPOINT.x = MyPOINT.x / 2
MyPOINT.y = MyPOINT.y / 2


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

#15
Hi,

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:
http://www.zshare.net/download/847018024a0fd621/

.ipa File:
http://www.zshare.net/download/847019964ed3f741/
#16
It seems that on the iPhone MOUSEAXIS(0), the X speed, is always 319 above what it should be!  I also note that when the program first starts up, MOUSESTATE reports that the Y position is at 319, which isn't really a problem - however, one would expect the 'mouse' position to be initialised at (0,0) not (0,319), and it seems very coincindental that the X speed would match this...
I haven't been able to test this at any higher res. than 320x480 (Portrait & Landscape) because of my older device, but it's very strange that the X speed in landscape is 1 less than the width in portrait (rotation issues?)

Also, it seems that GETMOUSECOUNT consistently returns 16.  Isn't it meant to return the current number of fingers?


Anway, just run the following to see what I mean, and try portrait and landscape:
Code (glbasic) Select
LOCAL mx%, my%, b1%, b2%

WHILE TRUE

PRINT "MOUSEAXIS:", 0, 0
FOR i = 0 TO 5
PRINT i + ":" + MOUSEAXIS(i), 10 + i * 52, 20
NEXT
PRINT "MOUSESTATE:", 0, 50
MOUSESTATE mx%, my%, b1%, b2%
PRINT "mx:" +mx, 10, 70
PRINT "my:" +my, 80, 70
PRINT "b1:" +b1, 150, 70
PRINT "b2:" +b2, 220, 70
PRINT "GETMOUSECOUNT: " + GETMOUSECOUNT(), 0, 100
SHOWSCREEN

WEND


It seems to me that something is going wrong in rotation of points or something because the problem only occurs in landscape 480x320, and suspiciously the X speed is as great as it can be for the width in portrait mode (0 - 319).  I don't understand much about what GLBasic does on the iPhone anyway, but hopefully (for me at least) this is reproduceable.
#17
Not a major problem, but if you're like me and try backspacing the line of  "   [...]   "  that indicates code folding, the editor becomes confused.  The code seems to become both folded and unfolded at the same time in an eerie superposition!  After that, trying to fold/unfold the code, undoing, or trying to edit the code folding indicator line again - i.e. doing anything that tells the editor to change the folding status of the code - will cause it to crash.
In the attached screenshot you can see that the green bar has a + on it and the [...], indicating folding, but the code is unfolded.

This is by no means a major problem, but if by chance you have some tie on your hands to waste on something as unimportant is this, please go ahead  :)

[attachment deleted by admin]
#18
Since upgrading to GLBasic V8, I've noticed that my SOCK_RECV commands hang when there is nothing to receive.  Looking into the logfile, I noted that in the 8.002 BETA release it says:
"Network: switched to blocking sockets internally. Faster on most platforms."  I've also seen another post regarding the change in bug reports.

After reading up on the difference between blocking and non-blocking sockets, my question is this:  is it possible to use non-blocking sockets in GLBasic?  I wouldn't mind using a bit of C++ to do so, but a lot of multiplayer stuff could be crippled without them.
#19
Such a function would be really useful - i.e. the IP address of the sender of the last message you used SOCK_RECV on.
#20
Off Topic / Male or Female?
2010-Sep-12
Just out of interest...