Community Project: BlitzMax Examples in Helpfiles

BlitzMax Forums/BlitzMax Programming/Community Project: BlitzMax Examples in Helpfiles

assari(Posted 2007) [#1]
***Update July 9th,
New milestone reached.More than 60% of functions/methods now have examples.
The latest version can be downloaded from http://www.2dgamecreators.com/files/
--------------------------------
Hi,
I have created a system whereby user examples can be appended to the official document which is then produced as a compiled helpfile.

The plan is for users to contribute examples in this thread and I will transfer them into the compiled helpfile. There is a table showing which functions already have example(s) so we can concentrate on those without. See http://www.2dgamecreators.com/files/examples.htm

Current score: 30% of ~750 total functions have examples

To Contribute code to this thread, the contributor has the rights to the code and declares said code as public domain.

Depending upon number of contributions, I will endeavour to update the table and helpfile at least once a month until we reach a level of 90%.


North(Posted 2007) [#2]
Code Entry: AppSuspended
SuperStrict

SetGraphicsDriver GLMax2DDriver()
Graphics 800,600

While Not KeyHit(KEY_ESCAPE)
	Cls
	If AppSuspended() = True
		DrawText "Application Suspended!",10,10
	Else
		DrawText "Application Running...",10,10
	EndIf
	Flip
Wend



Otus(Posted 2007) [#3]
Under what copyright/licencing are you releasing the help-file?


CS_TBL(Posted 2007) [#4]
Note, that you may need to fully cover the various situations that can happen for a specific function/command, like: 2d, GUI, non-hooked and hooked, with globals, without globals, etc. In addition, examples should be as small as possible, not like having a zillion lines of code with a zillion different -difficult- things to find your way through.
Because of all this, I recommend that someone looks into the given examples to make 'em "complete" and uniform.


Dreamora(Posted 2007) [#5]
If you start dissecting it like that, it will become hell on earth for beginners to understand anything.


CS_TBL(Posted 2007) [#6]
Nah, check B+ manual: Appendix 2 'five ways to say Hello World'. That's exactly what's needed: multiple examples of the same thing, in all kinda forms and shapes. Non-GUI, GUI etc. One example might not be able to teach something, but multiple examples doing the same thing will!


assari(Posted 2007) [#7]
North: Thanks

Otus: As far as I am concerned the original docs belong to BRL, all I'm doing is compiling them. The reason for asking the code to be public domain is to allow BRL, if they so wish, to incorporate the examples into the docs directly.

CS_TBL:The contributions can cover any/all variation of the functions. The system can cope with multiple examples for the one function. I will try to do some editing but no guarantees on 'complete' & uniform :)


CS_TBL(Posted 2007) [#8]
so, examples should be emailed to you, or posted here?


CS_TBL(Posted 2007) [#9]
+ should always superstrict be assumed? (matters in declaring variables)


assari(Posted 2007) [#10]
CS_TBL:posted here. Superstrict would be better


CS_TBL(Posted 2007) [#11]
Then there's the situation of commands belonging together, like the whole bank family. You want want -in case of the banks- a big example having all the pokes and peeks 'n stuff, or unique examples tailormade for each poke/peek flavor?


assari(Posted 2007) [#12]
The objective is to have clear examples. Most of the time unique is better but sometimes multiple flavors in a single example can clarify concepts.


Jake L.(Posted 2007) [#13]
This is a very nice community project and I'd like to contribute. Since this just started, may I suggest to setup a small and easy wiki to collect all entries?

Using a forum topic will end in a mess. It will become a pain to check what's already covered, what have changed, bugfixed etc...

Are there any free hosted Wikis around we could use? Like free forums...no complicated setup, just register and go.


CS_TBL(Posted 2007) [#14]
Not all bank thingies, but at least most of 'em.




Russell(Posted 2007) [#15]
Great idea, guys!

I'm all in favor of the "Related Commands: blah blah blah" (with hyperlinks to those related commands) approach as well, as alphabetical order is not always the best way to organize commands, even within a certain BMax documentation category.

Or, alternatively or in addition to that, if slightly more complete examples are given with not-yet-learned commands included, the actual commands in the example could be hyperlinks.

For example, in CS_TBL's CreateBank() code above, BankSize() and PeekByte() could both be hyperlinked to those command definitions. The other commands, such as Local, For and Print would not need to be, as they are more general and not really closely connected to CreateBank().

Russell


CS_TBL(Posted 2007) [#16]
The real handy part of a manual is what I've done in the lowest 3 examples.

Instead of:
<command> -> <explanation>

one learns more from:

<code problem> -> <solution1>, <solution2>, <solution3> etc.


CS_TBL(Posted 2007) [#17]
Ok, not really a command reference, but nonetheless handy to include for beginners.



Jake L.(Posted 2007) [#18]
@CS_TBL: You forgot For...until. Always useful when iterating through arrays. "For idx%=0 until foo.length"


CS_TBL(Posted 2007) [#19]
Right, will add. Tho I've actually never used it.. :P


Jake L.(Posted 2007) [#20]
By the way, did I made the suggestion already to use a Wiki for this task? ;)


assari(Posted 2007) [#21]
Jake L: There's been at least two attempts to do this with a Wiki. For this attempt I'd like to stick to this method.

CS_TBL, North: I've included your contributions to the compiled help. Download the latest version, click on the search tab and search for your name to see the examples you have contributed. Thanks

We are now at 41% complete from 30% before w contributions from CS_TBL, North & yours truly. I'm targetting 90% by year end :) Keep them coming...

As a reminder, checkout http://www.2dgamecreators.com/files/examples.htm for a list of functions without examples before contributing.


CS_TBL(Posted 2007) [#22]
In what kind of setting/enviroment are you going to place those Howtos? Appendixes?


CS_TBL(Posted 2007) [#23]


Someone ought to write appendixes about typical design patterns, and their applications.


assari(Posted 2007) [#24]
I was not planning for how-tos and appendices. ATM I'm sticking them in as extra link to the function example. My main objective is to have 90% of the bmx functions to have examples


Jake L.(Posted 2007) [#25]
How do you plan to handle examples that covers more than one function? For example, CanvasGraphics() is covered in the CreateCanvas()-example quite well.


assari(Posted 2007) [#26]
I simply copy them across. So they will have the same example. In the stats they count as 2 examples which is OK as they represent examples for 2 functions.


CASO(Posted 2007) [#27]
This has a lot of Pixmap Functions. (Please optimize it if you can.)



CS_TBL(Posted 2007) [#28]
hm.. isn't that a bit much for examples which are to explain one single thing?


assari(Posted 2007) [#29]
CASO, thanks for your contributions. I broke your example down into smaller slices on a per function basis. Do a search on CASO to check them out.

We have now reached an important milestone, 45% functions with examples, which is halfway towards my stated target of 90% done by year end :)

Check out the download page in the top post.


CS_TBL(Posted 2007) [#30]
Can we keep the (forum-)jokes? :P




CASO(Posted 2007) [#31]
Here are some more.



assari(Posted 2007) [#32]
More than 50% of functions now have at least one example.
The latest version can be downloaded from http://www.2dgamecreators.com/files/

Next milestone is to surpass BRL no of examples, this effort has contributed examples to 164 functions cf BRL's 190.

Don't forget to check the list at http://www.2dgamecreators.com/files/examples.htm before contributing.


CASO(Posted 2007) [#33]
Here are a few more.



CS_TBL(Posted 2007) [#34]
caso: I highly doubt your examples are 100% perfect for a manual tho. Not superstrict compliant, and uhm.. "EventSourceHandle" ?? :P


CS_TBL(Posted 2007) [#35]
The use of Superstrict might not be mandatory, but I actually think it's best to teach things the right way. Esp. for beginners, Superstrict helps finding bugs. (also for the medium/advanced :P)

some alternatives:



assari(Posted 2007) [#36]
New milestone reached. User examples has surpassed BRL examples.

I have now added methods to the list instead of just functions so there's more to do but we are still above 50%

The latest version can be downloaded from www.2dgamecreators.com/files/


Jason W.(Posted 2007) [#37]
Thanks Assari!

Jason


assari(Posted 2007) [#38]
Another milestone reached, 60% of functions/methods now with examples. I will plod through and add more examples but will not be bumping this thread until the next milestone of 70% which could take the next 4-5 weeks.

As I add stuff, I will upload to the website so that downloads will be up to date eventhough there's no news here.

If you wish to contribute, don't forget to check http://www.2dgamecreators.com/files/examples.htm to see which functions/methods are still without examples.