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

#16
Whilst it in no way excuses my overlooking this as a solution to my problem, it's none the less interesting to note that the word 'constant' is not mentioned once in the entire glBasic help file. If GLOBAL, LOCAL and STATIC have pages, surely CONSTANT deserves an honourable mention, if only for completeness when you press F1 over the keyword declaration.
#17
Of course. Seems so obvious when you see it like that. So much for trying to be smart and use types. lol.

If I'd just thought of using well named constants as my named references, I'd have had perfectly readable code for getting and setting my variables no matter how complex my array, my code would be 10 times shorter, and I wouldn't be faced with a large rewrite now. Doh.
#18
I totally never thought of that! My real world example is a somewhat more nested data arrangement (imagine if strength, constitution and dexterity themselves had multiple members, say, currentValue and maxValue), but I *think* it'll be scaleable once I get my head round it all :)

Thanks for that.
#19
Can I reference the members of a type based upon the order of membership? ie, it's ID.

In other words...

Assume I have a type set up like:

Code (glbasic) Select


GLOBAL allCharacterStats[] AS tCharacterStats

TYPE tCharacterStats
strength
dexterity
constitution
ENDTYPE


and I want to use a one-size-fits all function when these members are updated, something like :

Code (glbasic) Select

FUNCTION userEditsStat:statBeingEdited

IF addButtonPressed = TRUE
inc allCharacterStats[0].statBeingEdited, 1  // no, you cant really do this. that's the point!
ENDIF

ENDFUNCTION



my point is, right now, I have to do something like:

Code (glbasic) Select

SELECT statBeingEdited
CASE 0
inc allCharacterStats[0].strength, 1
CASE 1
inc allCharacterStats[0].dexterity, 1
CASE 2
inc allCharacterStats[0].constitution, 1
ENDSELECT



... which means I duplicate a lot of code. Obviously my real life example is MUCH more complex than this, and while type members give me far more readable code, not being able to reference them by index, I'm duplicating so much code it's getting unwieldy.

So, is there a way to reference the members by ID that I'm missing?

If not, it would be a REALLY welcome addition. I would think they must be internally referenced by an ID of their dimension in an array anyway, no? So it would surely not be too hard to implement?
#20
surely splitstr? just put any possible punctuation and a space as the seperators

e.g.

Code (glbasic) Select

sentence$ = "The quick brown fox jumped over the lazy dogs back. Adding some punctuation etc!, just to demonstrate..."

count = SPLITSTR(sentence$, words$[], " ,.!")

ypos = 0
FOR word = 0 TO LEN(words$[])-1
PRINT words$[word],0,ypos
INC ypos, 20
NEXT

SHOWSCREEN

KEYWAIT


edit: oh. beaten to it!
#21
Quote from: MrTAToad on 2010-Aug-28
That is odd - on my Windows 7 x64 directly copying doesn't change the case of the SUB names - cant find anything to cause it (not even the re-formatting options).  I did find one person who had the same trouble when copying text from OpenOffice, and it appears that the web browser was modifying the formatting of characters.  Would be worth test to see, if you type in SUB TEST: if test is converted to lower-case.

ON_QUIT is working
ON_PAUSE is working
ON_RESUME is working

There are several things to note :

  • At the moment, they only work in RELEASE mode
  • On Windows, STDERR/STDOUT only works in console mode.  DEBUG cant be used as the SUB's only work in release mode

So, to test them I put an END in the ON_PAUSE subroutine - so as soon as the program is minimised it ended straight away.
Then I moved the END into ON_RESUME and watched the program end as soon as a window was restored.

Hopefully these ON_RESUME/ON_PAUSE will be working in debug mode later on.

Doesn't work for me. Even when I type it in (which was the first thing I tried). I'm well aware they only work in release mode and that there's no way to debug them. Not that inability to debug matters when they never fire for me anyway, after the editor magically converts them back to lower case for me.
#22
Whilst it might work for Mike, it does not work for me at all. In fact, GLBasic is actually now in a worse state than ever on my 64bit Windows Vista machine after installing 8.085. If I paste Kitty's exact test code from the post above, the editor actively changes ALL the subs GLB_ON_QUIT, GLB_ON_PAUSE, GLB_ON_RESUME to lower case, and none of them ever fire now.

I originally updated to 8.085 from the editor, but when that caused this failure, I downloaded it fresh and installed on a new drive from scratch, after archiving my old glbasic install. [Edit: mainly, I didn't realise that the sdk on the main download link is still 8.078, so I still had to update internally when I installed it fresh]

Same result either way. So for me, at least, GLBasic is now even more broken, and I can't code the update to our apps at all!
#23
It's not just that there are some issues with multi-tasking. GLBasic apps crash on exit on any multi-tasking capable device, and don't get to execute GLB_ON_QUIT. If you have an old device, it seems to just fall back to OS3 methods, GLB_ON_QUIT is called, and the app exits without error. So as long as you're not developing for iPhone 3GS, iPhone 4, or a 3g iPod Touch, you're fine.

Sorry. I'm done now. I really don't want to derail your thread (indeed, if anyone wants to reply, please do it in my thread about it), but I couldn't leave it at "there are some issues with multitasking on new iOS" because that isn't it at all. The original issue is that GLBasic is incompatible with multi-tasking capable devices. That is still the case with or without the newly implemented attempt at supporting OS4 multi-tasking. Which don't work anyway, as far as I can tell.

I've reported all this extensively over three threads and many hours of testing, but it's apparently just falling on deaf or unconcerned ears... or I'm just not communicating in a language anyone here understands. Either way, I'm wasting lots of my time, and not getting anywhere but frustrated.

So anyway, y'all will be relieved to hear I'm leaving the forums and this little community alone now. Maybe I'll check back in a few months and see if GLBasic is working yet so I can give my customers an update so their apps don't crash.

Ok. carry on.
#24
Quote from: Kitty Hello on 2010-Aug-25
set the gPaused flag only in GLB_ON_PAUSE and GLB_ON_RESUME.

Ok. Moving gPaused flag setting to GLB_ON_RESUME works with that code (in which case I don't understand why the FIRST code I posted didn't work!), BUT the app STILL crashes on a normal exit without visiting GLB_ON_QUIT, producing the 'background GPU access' violation.

EDIT: However, it actually DOESNT work when applied to our games. The exact same method. I have a conditional statement round my main loop, I set a paused flag in GLB_ON_PAUSE and unset it in GLB_ON_RESUME, I have EXACTLY the same 'touch to continue' code as the test code, aaaaand it starts from the beginning when resumed. Exactly the same method. I'm not posting my game code, because if it's THAT hard to implement a pause and resume using the same method in two different apps, then frankly there's a problem with GLBasic, not with my code.

I give up. We're getting nowhere with this and I've wasted hours and hours trying to get something that works and tried to be as helpful as possible, posting pages and pages of my findings here, doing testing that no one else here apparently is able to or cares about (I don't really know why other GLBasic iPhone app developers aren't concerned that their apps are crashing, but it seems I'm the only one...) ... and then get asked if I'm sure I'm using a multi-tasking device!

Even if GLBasic doesn't support resume I'd just be happy to be able to update my games so they don't crash... but the fact is still the same as it was in my first post over a week ago:

ALL GLBASIC APPS CRASH ON EXIT. Or put another way: GLBasic is incompatible with iOS4.

I'd say the fact that GLBasic apps are even passing approval is sheer luck, given that they all commit the cardinal sin of writing to screen while a background task. Well, unless you have an old device that doesn't support multi-tasking at all, in which case you're just fine. But 50% or so of my customers have an issue, and it's not like there's anything I can do anything about it.

I really have no option but to stop using GLBasic for development until it is compatible with OS4. Sorry, but this is just hopeless.
#25
Quote from: Kitty Hello on 2010-Aug-25
set the gPaused flag only in GLB_ON_PAUSE and GLB_ON_RESUME. Very strange. It worked nicely on my device.
... darn I lost the test code I was using.

I was under the impression you didn't have a multi-tasking device to test on? Yes. This code works on a non multi-tasking iPod or iPhone. But then our games don't all crash on a non multi-tasking device either.

On any that do support it, they crash.
#26
I guess you're not understanding me. Your new subs do not appear to prevent the issue that GLBasic apps crash, even when used to detect the state changes, even when used as described.

This code (your code, albeit i added a counter so you could see it 'do' something) does not work on a multitask device. At least, the app crashes and restarts from the beginning on resume. Even though I've implemented your subs, exactly as you recommended. xcode says that you tried to write to gpu while a background task. Thing is, this is exactly how it behaved before you even implemented them.

Code (glbasic) Select

AUTOPAUSE TRUE
GLOBAL gPause=FALSE
GLOBAL a%

game:
IF gPause
   DisplayPauseMessage();
   SHOWSCREEN                        // as I understand it, if gPause is true, it just halts part way through execution of this? Except iPhones still crash.
   MOUSEWAIT
   gPause = FALSE     // ok, this wasn't in your code... but I assume this is what you expect me to do, or it never exits the pause state to resume?
ELSE
   UpdateGame()
   DrawGame()
   SHOWSCREEN
ENDIF
GOTO game


FUNCTION DisplayPauseMessage:
PRINT "I am paused",0,0
PRINT "Touch to continue",0,20
ENDFUNCTION

FUNCTION UpdateGame:
INC a%
ENDFUNCTION

FUNCTION DrawGame:
PRINT a%,0,0
SHOWSCREEN
ENDFUNCTION


SUB GLB_ON_PAUSE:
gPause=TRUE
ENDSUB

SUB GLB_ON_RESUME:

ENDSUB


#27
Just to confirm for clarity, since there's several different conversations going on at once in the V8 thread, that despite the implementation of GLB_ON_PAUSE and GLB_ON_RESUME in v8.078, the originally described issue still exists. That is, a GLBasic app crashes after trying to write to screen while a background task when on an iPod or iPhone that supports multi-tasking. This happens even on a normal exit, not just when put to the multi-tasking bar.

Tested using Gernots own example code and the same described implementation used to update our existing apps.
#28
Announcements / Re: V8 beta
2010-Aug-25
We're testing on a 3rd gen iPod Touch 32gb but also have access to an iPhone 3GS. If it didn't support multi-tasking, we couldnt be testing putting apps to the multi-task bar and resuming them!
#29
Announcements / Re: V8 beta
2010-Aug-25
Well, yes, except that doesnt work on a multi-tasking iPhone. Just tried it. It doesn't display the contents of my DisplayPauseMessage(), or wait for the keywait/mousewait, and the program executes from the beginning again (I just increment a variable and printed it, so it's pretty obvious to see if it continues from where it left off on resume or whether it restarts the whole app).

Which is pretty much what the symptoms were before GLB_ON_RESUME and GLB_ON_PAUSE were implemented.

Oh, and still gives the same 'Background GPU access not permitted' error if connected to xcode debugger.

EDIT: oh wait. that's because on the iPhone you HAVE to have AUTOPAUSE TRUE set for it to work, whereas on the PC, it works exactly the same without AUTOPAUSE set as it does with

EDIT2: Oh. No, still doesn't work. I'm not even going to try and describe the symptoms because it's different every time I run it. But most of the time, the app still crashes out completely per my original bug report
#30
Announcements / Re: V8 beta
2010-Aug-25
Quote from: Kitty Hello on 2010-Aug-25
Did that clear things?

Not really, to be honest. I may just be being thick.

Given the example I posted above, how can I make a version of that basic framework that will work on my windows machine for development that will also work on an iphone? Ie, if I'm paused, 'do nothing', when I'm resumed... resume.

Or are you saying that for the purpose of development, I now need to have evaluations and code based on platform, then strip all the windows specific stuff out for final iphone deployment?

I guess all I'm really asking for is a working cross platform example of how to use these subs. Because everything I've tried so far just crashes.