How do I make and include Userlibs?

Previous topic - Next topic

Uncle

Stoopid question alert! I've searched the forum but can't seem to find much info on UserLibs.  I was wondering what exactly are Userlibs, how can I create them, and how do I include them in my project?  Are these libraries written in GLB that I can include in my project e.g. if I wrote a sprite system UserLib I could just plug it into multiple projects?  Are these libraries completely separate from the source code they are plugged into i.e. I could have the same variable name in both the main source and userlibs, but they would be treated as two separate variables? 

Cheers for looking,

Unc


trucidare

Open your Project then you userlib (gbal of other gbas) then rightclick and add to project. thats all. now you can use functions from userlibs and other source files.
MacBook Pro 2,2 GHz Core 2 Duo, 4 GB RAM, 160 GB HDD, 8600M GT
Core i3 - 3,07 GHz, 8 GB Ram, 2.5 TB HDD, Geforce GTX 260+ OC

amarliani

QuoteI was wondering what exactly are Userlibs, how can I create them, and how do I include them in my project?

Userlibs are simply GLB extension libs made by users themself. To create one, just write your code, than select "Tools/Compress file to Library" from  the GLB menu. (sorry, the menu might actually read a bit different, this is only a translation of my german menu options). Trudicare already explained how to use Userlibs in your projects.

QuoteAre these libraries written in GLB that I can include in my project e.g. if I wrote a sprite system UserLib I could just plug it into multiple projects?

Yes! Thats exactly what userlibs are intended for. 

QuoteAre these libraries completely separate from the source code they are plugged into i.e. I could have the same variable name in both the main source and userlibs, but they would be treated as two separate variables? 

The code is separated from your project, and even more interesting, even not available to any user. So you can hand over (sell?) libs without making your code readable for anyone. Variables: Ahh.. bit more complicated.  As long as your projects variables are LOCAL, yes, you can use the same names. If your project declares a GLOBAL variable with the same name, you will certainly run into problems. Therefore it would be wise to use some sort of unique naming conventions for your lib's variables, e.g. all starting with "usl_" or somthing like that.