Looking for 2 tutorials

Everything else that doesn't fall into one of the other PB categories.
User avatar
Tenaja
Addict
Addict
Posts: 1959
Joined: Tue Nov 09, 2010 10:15 pm

Looking for 2 tutorials

Post by Tenaja »

I'm looking for two several tutorials. I've searched and haven't found any that are particularly helpful.

The first is to cover the utilization of two threads. For instance, I've got two tasks that are typically done sequentially. However, with two threads, the second task could begin as soon the first one got going. It would just need a way to check on the status of the first thread, since that would be the slowest one.

The second is to cover the basics of using the debugger. I know how to print a debug message, but I'd like to learn how to step through the code one line at a time.

...I guess a pointer tutorial would be handy too. I find the syntax a bit unorthodox. (Backslash? and you can't find it in the help file...)

Oh, yeah. Since I'm asking away; is there an example for implementing online updates for your program?

Thanks!
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6175
Joined: Sat May 17, 2003 11:31 am
Contact:

Re: Looking for 2 tutorials

Post by blueznl »

Threads:

http://www.xs4all.nl/~bluez/purebasic/p ... #7_threads

Debugger: either set a breakpoint or add calldebugger, from that point on you can step through your code.
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB - upgrade incoming...)
( The path to enlightenment and the PureBasic Survival Guide right here... )
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Re: Looking for 2 tutorials

Post by Trond »

...I guess a pointer tutorial would be handy too. I find the syntax a bit unorthodox. (Backslash? and you can't find it in the help file...)
Pointers in PB are very simple to understand, once you understand structures (which are also simple to understand).

To understand structures open the help file on the page "structures". The \ is explained there. A structure in PB is similar to a struct in C or record in pascal, except the \ character is used to access the fields/members.

Pointers are very simple to explain if you know pointers from C. If a variable name starts with a *, then that variable is a pointer (this is explained in the manual on the page "Pointers and memory access"). The * is part of the variable name, and can not be omitted ever.
If you come from a C background:
1. The variable name without specified member fields (*pointer, *mypointer, *happypointer, *etc) is never dereferenced.
2. The variable name with a specified member field (*pointer\member, *mypointer\arrowhead, *happypointer\xpos, *etc\ad_infinitum) is always dereferenced.
3. To get the address of a variable (any variable except .s), place the @ operator in front of the variable name (@*pointer (address of *pointer), @player1 (address of player1), @etc\address_of_member_field, @*pointer\address of member field pointed to by *pointer).
PureLust
Enthusiast
Enthusiast
Posts: 486
Joined: Mon Apr 16, 2007 3:57 am
Location: Germany, NRW

Re: Looking for 2 tutorials

Post by PureLust »

The Tutorial-Section of PureArea.net provides some interesting links.

The Pointer-Tutorial from Timo Harter and Stefan Mahr may be helpful (at least you can read german language). :wink:

Also the Structures and pointers section in Blueznls PureBasic-Survival-Guide may be helpful to you.
Tenaja wrote: I find the syntax a bit unorthodox. (Backslash? and you can't find it in the help file...)
Jupp, some things are quite difficult to find in the help.
But Backslash has nothing to do with Pointers. It relays to Structures, so you should have a look in the Structures-Section of the Help.
[Dynamic-Dialogs] - create complex GUIs the easy way
[DeFlicker] - easily deflicker your resizeable Windows
[WinFX] - Window Effects (incl. 'click-through' Window)
Post Reply