Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

PureGDK / New features in PureGDK with PureBasic

Author
Message
Mistrel
Retired Moderator
18
Years of Service
User Offline
Joined: 9th Nov 2005
Location:
Posted: 11th Oct 2009 02:31 Edited at: 15th Oct 2010 06:35
Arrays in UDTs

PureGDK uses "structures", an advanced form of DarkBasic Professional's UDTs. Arrays in structures are natively supported by PureBasic. You can even have an structure array of arrays of structures!



Return a UDT from a function

PureBasic supports passing structures by address. This allows a single procedure to return multiple values and even entire structures!



Global variable declarations no longer have to be 'executed' for initialization to happen

Compiler macros in PureBasic can be used to handle situations where globals and other variables have not yet been declared. For example, you can do an "If not yet declared then do this".



The ability to pass UDT data from an array to a function

PureBasic supports arrays as function parameters. You can also pass other data structures like lists and hash maps too!



Distinct "ElseIf" statement

The "ElseIf" keyword is natively supported by PureBasic.



Ability to do complex statements on 'ExitFunction'/'EndFunction'

PureBasic can return the value of complex expressions from functions with ease.



Optional parameters

Why write three functions when you only need one? What about default parameters? PureBasic can do all of this.



Option explicit mode

Enable or disable the explicit mode with a single command. When enabled, all the variables which are not explicitly declared with Define, Global, Protected or Static are not accepted and the compiler will raise an error. This can be extremely useful for preventing typo bugs.



Vectors and matrices are basic types

Never have to use a vector or matrix "ID" again! PureGDK supports vector and matrix datatypes as structures. This means that you can access any part of this data and they can be written to and read from disk.



Methods in UDTs (Advanced)

PureBasic supports storing methods within interfaces similar to classes in object-oriented programming.



Pass by address/pass by reference

In PureBasic all arrays, lists, and hashmaps are passed by reference. Everything else, like in C, can be passed by address to achieve the same effect.

Inheriting Fields From Another Structure

Structures can also inherit fields from another structure by using the optional "Extends" keyword.



Structure Unions

Structure unions are a way of conserving memory by forcing groups of variables within a structure to share the same memory address.



Linked Lists and Hash Maps

Linked Lists are similar to arrays in that they are able to refer to lots of data using one name. They are however different to arrays in that they don’t use an index to assign and retrieve data.



Sorting Arrays And Linked Lists

Arrays and linked lists are great for storing all sorts of data and these data structures can easily be traversed to quickly retrieve that data. Sometimes though you may need to reorganize the data contained within an array or linked list, so it is sorted alphabetically or numerically.



Sorting structured arrays and linked lists

This is slightly more complicated as it uses a slightly more complicated sort command; "SortStructuredArray()".



Visual Designer

The PureBasic Visual Designer (designer for graphical user interfaces) has been created for the PureBasic programming language and is of course developed in PureBasic. It will become more and more powerful and will support advanced features like dialogs, gadget editing from PureBasic source file etc.



Custom Gadgets

With PureBasic you're not limited to only the gadgets that come with the software. With all of the powerful tools at your disposal you can even create your own!



Native support for the Win32 API

With native support for the Windows Win32 API making advanced operating system calls has never been easier! Consider this example which lists all resolutions supported by the user's monitor that is of the same frequency and aspect ratio:



RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 13th Oct 2009 19:07 Edited at: 13th Oct 2009 19:08
It looks like you went over to the "DBPro Critisisms" thread and basically incorperated everything people said DBP was missing. Awesome job Mistrel. Im extremely excited about the enhanced UDT's and methods. Something I've always wanted to see in DBP.

Its going to be a bit of a pain to convert my project over to PureBasic's syntax (not that its hard, just a lot of code to switch over), but by the sounds of things it will be well worth it in the end after everything Ill be gaining.
Mistrel
Retired Moderator
18
Years of Service
User Offline
Joined: 9th Nov 2005
Location:
Posted: 13th Oct 2009 20:50 Edited at: 13th Oct 2009 20:52
I've converted a lot of DBP code to PureGDK and I can tell you it's not as difficult as you imagine. The only real "gotchas" are that PureGDK changes the order of some function parameters. The way I deal with that is by checking for runtime errors and then comparing the DBP function with the the PureGDK manual.

Once you get the hang of PureBasic syntax, conversion will be a breeze.

aonyn
14
Years of Service
User Offline
Joined: 16th Oct 2009
Location:
Posted: 17th Oct 2009 02:12
I made the switch to PureBasic last December IIRC, and added PureGDK soon after.

I was previously using DarkBasic Pro and BlueGUI, and switched to PureBasic after using the trial, and found it was far more powerful and easy for general application programming.

No Regrets!!!!

Thanks Mistrel for creating PureGDK, as it combines the best of purebasic and darkbasic into one environment.

I am looking forward to the coming update for PB 4.4 and DB 7.4(5?)

Also, I agree, as I have gone through the process numerous times myself, translating projects from DB to PB is a fairly straightforward and easy process.

regards,
Dave
aonyn
14
Years of Service
User Offline
Joined: 16th Oct 2009
Location:
Posted: 17th Oct 2009 09:08
Sorry for the triple post, I was here earlier, and the post was not showing, so I thought the forum was not working correctly, and tried a few times.

Now the post shows 3 times.
Mods, please delete the duplicates.
Thraxas
Retired Moderator
18
Years of Service
User Offline
Joined: 8th Feb 2006
Location: The Avenging Axe, Turai
Posted: 17th Oct 2009 10:53
No problems aonyn. You're not the first person to do it and I'm sure you won't be the last

aonyn
14
Years of Service
User Offline
Joined: 16th Oct 2009
Location:
Posted: 17th Oct 2009 12:36
Thanks Thraxas
aerostudios
14
Years of Service
User Offline
Joined: 20th May 2009
Location: Oklahoma City OK (USA)
Posted: 15th Jan 2010 22:15 Edited at: 15th Jan 2010 22:15
Mistrel,

I took a look at trying to convert the DarkCLOUDS.DLL to the PureGDK. In reviewing the AdvancedTerrain example, it doesn't appear that DarkCLOUDS is going to be an easy conversion. There are numerous Simul*.DLLs also involved that seem to make up that plugin. Any chance we could see you or someone else get that going? That is the only plugin from my DBPro that I am unable to use with the PureGDK.

Russell B. Davis/aerostudios
Mistrel
Retired Moderator
18
Years of Service
User Offline
Joined: 9th Nov 2005
Location:
Posted: 4th Feb 2011 20:11
DarkClouds should be working now with PureGDK 2.0. If your plugins are setup properly then DarkClouds should work out-of-the-box. There is an example project included in the examples/projects/purebasic/src/plugins/dark-clouds directory.

The easiest way to get your plugins working is to install and license them with DarkBasic Professional before installing PureGDK.

J T Huges
14
Years of Service
User Offline
Joined: 24th Oct 2009
Location: O-HI-O. USA.
Posted: 3rd May 2011 03:08
Hey Mistrel,
I have been reading the beginners guide book and the PureGDK along with the updates and add-ons, I found this to be very interesting.
Checking out the examples are really good.
I've been working and learning DBP for a while now and founding out about this is something I am going to learn and add on.

thank you, keep up the good work.

Live Long -N- Rock'n Space Cowboys
Mistrel
Retired Moderator
18
Years of Service
User Offline
Joined: 9th Nov 2005
Location:
Posted: 3rd May 2011 05:45
Keep an eye out on this forum. I hope to get the next beta out soon.

Login to post a reply

Server time is: 2024-03-29 10:41:54
Your offset time is: 2024-03-29 10:41:54