Search found 15 matches

by spacesurfer
Tue May 22, 2012 7:09 pm
Forum: Coding Questions
Topic: Delayed procedure calls (frame based)?
Replies: 9
Views: 1166

Re: Delayed procedure calls (frame based)?

the different parameters represent a problem.

If the call differend to the prototy definition, you get a stack defect ... IMA

The simplest way is, you use only one Parameter (like Threads) give only a Pointer (to a structure) to the procedure:

problem (info!), the Buffer (MyParameters) musst be ...
by spacesurfer
Tue May 22, 2012 6:33 pm
Forum: Coding Questions
Topic: Delayed procedure calls (frame based)?
Replies: 9
Views: 1166

Re: Delayed procedure calls (frame based)?

oke, you will not a realtime base, but a frame base.
And you will "define" your procedures before.

Here your code:

if you need more parameters, define it in Prototype and RegisterTask and in the "; execute task"-Line
That's it!! Thank you :-) that is exactly what I ment!!

Let us yet see if I ...
by spacesurfer
Tue May 22, 2012 5:14 pm
Forum: Coding Questions
Topic: Delayed procedure calls (frame based)?
Replies: 9
Views: 1166

Re: Delayed procedure calls (frame based)?

if you will call your procedures synchronous, you can use some like this:

CreateCall(Delay, Counts) create a element and ExamineCalls() returns the element which to call:
Your code works fine, hovewer this would be what I meant considering timings:

Structure Call
delay_frames.i
Time.i ...
by spacesurfer
Tue May 22, 2012 3:24 pm
Forum: Coding Questions
Topic: Delayed procedure calls (frame based)?
Replies: 9
Views: 1166

Re: Delayed procedure calls (frame based)?

STARGÅTE wrote:if you will call your procedures synchronous, you can use some like this:
Thank you very much. I'll have to take a bit of time to examine the code you've sent (and to think a little about it) then I'll probably have an additional question or two...
by spacesurfer
Tue May 22, 2012 2:27 pm
Forum: Coding Questions
Topic: Delayed procedure calls (frame based)?
Replies: 9
Views: 1166

Re: Delayed procedure calls (frame based)?

You can use Threads, to call a procedure with a delay
You mean to start time delay + a procedure call in a new thread? That would be a time delay. But frame delay would have to communicate with the main thread, every pass thru the main loop in the main thread would have to decrement the frame ...
by spacesurfer
Tue May 22, 2012 12:41 pm
Forum: Coding Questions
Topic: Delayed procedure calls (frame based)?
Replies: 9
Views: 1166

Delayed procedure calls (frame based)?

I am looking at this code that can be used to delay procedure calls, seems this could be (with a slight modification) very useful in a frame based games - for example after clearing the stage in some shooting game we might want to schedule the following tasks:

- generate a sequence of time delayed ...
by spacesurfer
Fri May 18, 2012 1:41 am
Forum: Coding Questions
Topic: Updating between two linked lists?
Replies: 6
Views: 1121

Re: Updating between two linked lists?

Can you include the 2nd list in the 1st list? Deleting an element in the 1st list would
destroy all elements in the sub-list too.
That would be great from that point of view. However, then we'd have lost the ability to loop thru the second list (since it wouldn't exist). It is important to have an ...
by spacesurfer
Fri May 18, 2012 1:34 am
Forum: Coding Questions
Topic: Updating between two linked lists?
Replies: 6
Views: 1121

Re: Updating between two linked lists?


The elements keep their addresses. Internally, the linked list keeps its own references for next/previous hidden from the data you interact with, and handles insertions/deletions silently for integrity within a single list. However..
That's a good news.


You have two choices. One, you can do a ...
by spacesurfer
Fri May 18, 2012 1:11 am
Forum: Coding Questions
Topic: Updating between two linked lists?
Replies: 6
Views: 1121

Re: Updating between two linked lists?


Again... its pseudo code, just to show the logic of the example. But checking List1() shouldn't take a huge amount of time to check for 1 value, I would think?
You could also do it with Maps, which are very fast as well if you wanted.

I don't know if its possible, or efficient, doing it this way ...
by spacesurfer
Thu May 17, 2012 3:58 pm
Forum: Coding Questions
Topic: Updating between two linked lists?
Replies: 6
Views: 1121

Updating between two linked lists?

I have a question rather complicated to explain and since English isn't my native language I hope I'll be able to explain it in an understandable way. It's more programming question in general - not strictly related to PureBasic and I am not sure even if it could be done.

Here's the problem:

We ...
by spacesurfer
Thu May 17, 2012 12:24 pm
Forum: Coding Questions
Topic: Toggle on KeyboardPushed?
Replies: 9
Views: 1779

Re: Toggle on KeyboardPushed?

And yes, you can use AND in those macros instead of any bitshifting, but when you use logical operators in PureBasic, it only guarantees a zero or non-zero result, so they don't recommend using them where an integer 0 or 1 is expected. But like I said, for conditonal checks like IF statements, that ...
by spacesurfer
Sun May 13, 2012 10:12 am
Forum: Coding Questions
Topic: Toggle on KeyboardPushed?
Replies: 9
Views: 1779

Re: Toggle on KeyboardPushed?

You could swap those bits. It doesn't really matter, but I think the macros would barely change, right?

I thought something like:


Macro KeyHit(ID)
(((KeyState(ID) & %01)) And ((Keystate(ID) & %10) ! %10))
EndMacro

Macro KeyPressed(ID)
((KeyState(ID) & %01))
EndMacro

Macro KeyReleased(ID ...
by spacesurfer
Sat May 12, 2012 9:07 pm
Forum: Coding Questions
Topic: Toggle on KeyboardPushed?
Replies: 9
Views: 1779

Re: Toggle on KeyboardPushed?

Another nice peace of code :-) Thank you very much!!

This version shows two more ideas you could play with:

1. Using named constants as the Key ID... For example, if you are making a game, Space might be the default Jump key. Instead of writing #PB_Key_Space throughout your program, just use ...
by spacesurfer
Sat May 12, 2012 9:12 am
Forum: Coding Questions
Topic: Toggle on KeyboardPushed?
Replies: 9
Views: 1779

Re: Toggle on KeyboardPushed?

Thank you very much for answering me. Very nice keyboard handling code!! A good idea to be able to detect all three states (hit, pressed, released).

Also, I use a slightly more efficient version now. Instead of storing current and previous states as separate variables and indexing them with ...
by spacesurfer
Fri May 11, 2012 11:45 am
Forum: Coding Questions
Topic: Toggle on KeyboardPushed?
Replies: 9
Views: 1779

Toggle on KeyboardPushed?

Is there some neater code to toggle the flag var on KeyboardPushed() inside the screen rendering loop? The problem is we have to check if the key was released before it was pushed for the next time (similarly as KeyboardReleased() checks if the key was first pushed). Here's my code to toggle the ...