English Amiga Board

Go Back   English Amiga Board > Coders > Coders. Language > Coders. Blitz Basic

Thread Tools
Old 07 November 2018, 13:38   #161
Registered User

Daedalus's Avatar
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 3,397
Originally Posted by amyren View Post
In the docs these commands are mentioned LoadAnim, InitAnim, and NextFrame.
But so far just by adding this line will result in an error meaasage, "unable to free memory"
LoadAnim 0,"images/animtest.iff"
Is there an example of how to do this in a system friendly way?
I don't think the standard animation commands are particularly system-friendly. You could try using the LoadShape command to load the frames if there aren't too many frames, then blitting the frames yourself as needed. Loading large shapes in itself has its own problems however.

I do remember the standard commands working for me many years ago, though it was very picky about the format. Try saving the animation as a different format if possible. Do you have a bitmap set up already? BitmapToWindow can then be used to display the bitmap the animation is rendering to in a window. As previously mentioned, palette information will have to be set for the screen for this to look right.

It might be worth looking at the RIAnim library of commands. I haven't used it, but apparently it supports other animation formats, and seems a bit more useful (uses fast RAM and can blit the animation at any position on a bitmap for example).

In my program I have the main program window (window 0) and then I do have several other windows in different sizes that will pop up. But maximum there will be two windows open at once.
So I think I could get away with using only Window 0 and Window 1 used in my program, as long as those extra windows only are used to display text.
Or would this be considered bad practice?
I'm not sure what the relevance of showing text only is. Each window you open needs to have its own ID that's unique to every other window you have open. If you only ever have two windows open, you can use IDs 0 and 1. But if there are lots of different windows your program can handle, that wouldn't be particularly good practice as it can lead to confusion later on. A better approach would be to have a separate ID for each window, regardless of whether other windows are open at the same time. For example, always use ID 0 for the main window, ID 3 for the Preferences window, ID 5 for the Help window, and so on.

Even better practice would be to declare some constants, and use them instead of just numbers for the ID. This will make your code far more readable in the future, and will help to reduce the chances of bugs even further. For example:

#MainWin = 0
#DebugWin = 1
#PrefsWin = 2
#OutputWin = 5
And then, later on in your program you can use them like this:
WindowOutput #OutputWin

If EventWindow = #PrefsWin
  NPrint "Prefs Window was used"
End If

Then I wonder about the compiler settings. When my program is finished, should one finetune those settings for numbers of objects, windows, anims etc. to fit exactly the number used in the program. Would this reduce the memory requirements for the program?
Not by any amount likely to be worth the time taken to change all the numbers. Basically, each of those items is set up as an array of the possible objects, so reducing the limit reduces the size of the array. But that's only going to be a few hundred bytes at most I suspect, so unless you're desperate for that few bytes (in which case I'm impressed that you're running so close to the limit), I wouldn't bother.
Daedalus is offline  

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
[blitz basic] How much amiga-blitz friendly is this? saimon69 Coders. Blitz Basic 104 29 November 2016 21:45
Blitz Basic (1) Retro1234 Coders. Blitz Basic 9 18 February 2016 18:54
Blitz basic 2 Help Havie Coders. Blitz Basic 30 08 September 2013 10:15
Blitz Basic 2 anyone? jobro request.Apps 12 28 November 2005 19:15
Blitz Basic 2 LaundroMat Retrogaming General Discussion 5 24 July 2001 09:10

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT +2. The time now is 20:21.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2018, vBulletin Solutions Inc.
Page generated in 0.06151 seconds with 15 queries