Making a MaxGUI Application: StripAnimMakerLite

BlitzMax Forums/BlitzMax Tutorials/Making a MaxGUI Application: StripAnimMakerLite

assari(Posted 2006) [#1]
[Updated Feb 05 2006] All Parts Added. Tutorial Complete :)

Having written more or less 15 parts on the MaxGUI beginner tutorial series, I thought now would be a good time to put into practice some of the stuff that we have learnt so far. These series of tutorials will take you through from the beginning steps through to a complete MaxGUI based application. If you have not gone through my beginner series tutorials, I suggest you go through them before starting on this one. Link to the beginner tutorials here.


The Strip Anim Maker Lite Tutorials:
1) Part 1- Introduction and Main Canvas
2) Part 2- Loading Images
3) Part 3 - Scrolling Canvas Image
4) Part 4 - The Selection Cursor
5) Part 5 - Adding the Zoom Window
6) Part 6 - Adding a Resizable Cursor
7) Part 7a - Capturing Image to AnimStrip
8) Part 7b - Capturing Image to AnimStrip
9) Part 8 - Catching Keyboard Events
10) Part 9 - Previewing Animations
11) Part 10 - Selecting an Animation Frame
12) Part 11 - PopUp Menu, Cut, Paste and Clear
13) Part 12 - Saving the Animation Strip


assari(Posted 2006) [#2]
OK, next part to the StripAnimMakerLite tutorial added.
6) Part 6 - Adding a Resizable Cursor


frolicy(Posted 2006) [#3]
WOW - that looks interesting!

He MARK, Please give assari a job for writing official Docs !!!!! (lol)

( and pay him well !)


although i had not yet the time to try everything out, your work is highly appreciated!

THANK YOU SO MUCH - ASSARI !!!


semar(Posted 2006) [#4]
@ assari,

that's very nice from you :-)

Please keep on, I *do* appreciate your tutorials !

Sergio.


Grisu(Posted 2006) [#5]
Thanks for all the tutorials!

If I only had time to do them all. :/


Eric(Posted 2006) [#6]
I am always using your Tutorials as a reference guide.

Thanks for taking the time, it is very much appreciated.

Regards,
Eric


Blitzogger(Posted 2006) [#7]
Any idea on When Parts 7 & 8 will be ready?


assari(Posted 2006) [#8]
Targetting for tomorrow


Grisu(Posted 2006) [#9]
Assari, have you written a tutorial about using a resizable window for coding a game yet?


assari(Posted 2006) [#10]
OK. More parts added to this series of tutorials. This has been a lot harder than I thought. Apologies if the explanation are not as succint or detailed as previously but I thought its better to get it out first and revisit later.

7) Part 7a - Capturing Image to AnimStrip
8) Part 7b - Capturing Image to AnimStrip
9) Part 8 - Catching Keyboard Events
10) Part 9 - Previewing Animations


assari(Posted 2006) [#11]
@Grisu,
Have you checked out the code by Perturbatio at the end of this thread?
The short answer to your question is no and none being planned. At least now I have done the keyboard events request that you had :)


Grisu(Posted 2006) [#12]
Thanks Assari!


Scott Shaver(Posted 2006) [#13]
@Grisu

you could also have a look at the PlayThing program in the zip file in this thread.

http://www.blitzbasic.com/Community/posts.php?topic=55711

It uses a canvas that doesn't take up the entire window but resizes when needed.


Sashnil(Posted 2006) [#14]
Great tut,

I guess i could re-write GlueIT in bmax now and have it x-platform in one go. Interesting!
The more i use bmax the more i like it :)


Eric(Posted 2006) [#15]
For some reason I keep getting an error attempting to access a null method.

Has any one tried to run the sample code from here?

http://www.2dgamecreators.com/tutorials/stripanimmakerlite/AStripAnim%20Maker%20v09.bmx


Duckstab[o](Posted 2006) [#16]
Yes you just need the 1945 bmp to run the programme


Eric(Posted 2006) [#17]
oh duh! thanks


assari(Posted 2006) [#18]
Final parts uploaded.

11) Part 10 - Selecting an Animation Frame
12) Part 11 - PopUp Menu, Cut, Paste and Clear
13) Part 12 - Saving the Animation Strip

Final Words

There are still a lot of things that we can add to this program. I decided to call this the Lite version because I wanted to keep the scope of the program manageable, bearing in mind that the real objective of this program was as an example to a learning tutorial.

In the course of this journey, I was distracted many times in terms of the functionalities that I wanted to add but had to remind myself many times to first get the tutorial done and then re-visit the program later., add more functionalities and remove the "lite" moniker from its name.

I have since decided to release the program code as public domain so as to allow as many people as possible to built upon the existing code and add the functionalities that they want without worrying about infringing copyright.

The functionalities I have been thinking about were

* Adding the functionality to fine tune the position of the captured images on the strip so that they are aligned to each other thereby getting a smoother animation
* Saving the Animation Strip with a different background color so that other languages (such as Blitz 2D) can use the strip image on mask colors other than black
* A scrollable Animation Strip
* Failing the above, at least some sort of bound/range limit so that users cannot insert images beyond the screen limits of the Animation Strip.
* In the spirit of the above, checks in other parts of the program as well, such as the LoadAnimation function
* Allowing for resizing of the animation size, currently the size defaults to the biggest image in the list
* A copy from clipboard function to allow copying an image from a webpage direct onto the Main Canvas

I'm sure there are many more. Be my guest and modify and add functionalities to your hearts content. The best way to learn is by doing.

Take care and success.


tonyg(Posted 2006) [#19]
I realise this is 5 months old but I have just got around to following the tutorial after getting cocky and thinking I didn't need to.
It's absolutely brilliant. Not just for what it's creating but the process used in building the GUI and function from a starting template.
I've done a few GUI apps with MaxGUI and, frankly, I've been creating them a bit haphazardly.
The process and layout used here makes so much sense I feel ashamed I haven't been doing it from the start.
Thanks *yet again* Assari.
There's a couple of slight errors.
In

Part 6 - Adding a Resizable Cursor

where
 Function Process_MouseDownEvent:Int()
uses CursorResize1=False when it should be CursorResize=False
                   Else 'We are in change size mode, so back out
                        CursorResize1=False    ' *** should be Cursorresize ***    
                        xsize=mx1a-mx1_Old
                        ysize=my1a-my1_Old
                        If xsize>MaxCursorSize Then xsize=MaxCursorSize
                        If xsize>MaxCursorSize Then xsize=MaxCursorSize
                        MoveMouse(mx1_Old,my1_Old)
                    EndIf

and in...
Part 10 - Selecting an Animation Frame

section
Function Process_MouseDownEvent

the End Select 'eventdata() comes after the case canvas3 statement...
                Case MOUSE_RIGHT
                    CopyPixUnderCursorToAnimStrip()

            Case Canvas3 'From Animstrip
            Select EventData()
                Case MOUSE_LEFT
                       SelectFrame()
                   End Select
                    
               End Select 'eventdata()  ' *** should come after Case MOUSE_RIGHT statement?
       RedrawGadget(Canvas1)

Anyway, again, superb tutorial which, with your others and a few from other people, deserves to be shipped with Bmax.
<edit> P.S. Is it normal to use lots of globals with GUI code? I realise it's a tutorial and aimed at using the product but I still try to keep them as 'local' as I can.


assari(Posted 2006) [#20]
Tonyg,
Thanks for the kind words and encouragements.
I've now corrected both the errors that you spotted in Part 6 and 10. Thankfully they were only in the text, the sources were OK.


Grey Alien(Posted 2006) [#21]
Has anyone compiled this into some an end user (i.e me) can use to easily make anim strips? thanks.


tonyg(Posted 2006) [#22]
Got to end of Part 12, download the final source and compile it.
If you haven't got MaxGUI then why not get it as you're a B+ owner.


Grey Alien(Posted 2006) [#23]
OK great thanks, I have MaxGUI.


Grey Alien(Posted 2006) [#24]
oh dear it runs and then exits with:

"D3D7Max2D Create System Surface Failed"


tonyg(Posted 2006) [#25]
... and you've not been able to find out what's wrong in, what is it, 8 minutes... disaster.
P.S. it works for me. Can your graphics card handle 1024*1024 images?


Grey Alien(Posted 2006) [#26]
Well I sort of gave up at the error point as I haven't a clue how to proceed. I'm using BMax 1.22 and have a Radeon 9800XT 256Mb RAM so I'm pretty sure it can handle that. weird.


Sanctus(Posted 2007) [#27]
This is great!
Mods can you stiky this?