Qbasicnews.com

Full Version: Hi, I would need help with Cosmox..
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi all, sorry about my newbieniess..

Yes.. Actually, I can't get done anything with it.
I have some skills on programming and know Q-Basics and stuff like that. But there's no way I could learn Assembly or whatever, so I need to use something library with QB.
I selected Cosmox because I heard it's good.

Well, how to get started on it? I can't understand it's manual, I would need some examples.

I would need to start working on somekind of small GUI I'm going to make for a computer I will use only for Commander Keen playing. (I just got that olde 486 for free..)
So, I'm planning to do somekind of menu where would be graphical background (320 x 200 pic), and there would be some images and user could move somekind of arrow and use that to select stuff.
I can do all the other, but not the "graphic-using" (like opening that graphic on the screen).

I would need to draw and clear the screen as often as possible, to make it as smooth as possible. By the way, is that the way for example in games to create smooth scrolling and so on?

Could someone write me a small code that would:
1. Start with DO.
2. Clear the screen.
3. Draw the background (for example draw the back.pcx on the screen).
4. Draw something object there, that would have some transperent area (like mouse pointer for example). That it would load also from something pic.
5. End with LOOP.

Hope you can help, please ask me if you didn't get the point of something I said. Smile
CosmoX might be a big unnecessary hassle in my opinion. AF-Lib stands for Absolute Functions or something, anyway it's some super-fast graphics functions that are excellent for what you need. download the module here:

http://www.realtorassistant.net/bluecastle/files/af.bas

you'll need to add that module to your project. make sure to call AF.InitLib at the beginning of your program. After that you may use the routines like AF.sprite. (a sprite is a graphic.)

DestSeg% is the destination in memory the sprite should be drawn to. use &HA000 for the screen, or create a back-buffer which is a place in memory the size of your screen. that way, you draw everything to that place, and then update that to the screen. the result is perfect smoothness.

to create a back-buffer do something like:

DIM SHARED MainPage(31999) AS INTEGER
DIM SHARED mainPg AS INTEGER
mainPg = VARSEG(MainPage(0))


VARSEG returns the segment address of a variable.

MainPage is a 64000 bytes (including zero) because an integer is two bytes. the screen segment (&HA000) in 13h is also 64000 bytes (320 times 200).

to draw a box to the back-buffer:

AF.Box MainPg, 0, 0, 100, 100, 1

to copy MainPage to the screen:

AF.Pcopy &HA000, MainPg

there's no point in that code alone, but drawing everything off-screen and then slapping it onscreen causes smooth FPS. AF-lib doesn't have mouse functions but look around on this site and other qb sites. tell me if you need help with that.

(oh, yes, credit goes to Relsoft (genso_sanzo) for making Af-lib/RelLib) thanks again!
(w00t. Now we have Oracle, Neo, and a Keymaker)
(Still waiting for Trinity Smile)

Oh, and AFlib is just RelLib in CALL ABSOLUTE form, so you could try RelLib..

but for examples:

Load QBasic with the /L switch, and the path to the cosmox.qlb file, eg:

(put this in a batch file)

c:\qbasic\qb /Lc:\qbasic\cosmox\cosmox/ah

Then run the batch file, and make the first line in your program:

' $INCLUDE: 'cosmox.bi'

Then call the functions you need Smile
Matrix Revolutions!!!!

Nov 5!!!!

wooot!!!!

Big Grin
Smile

Finish school Nov 6 as well Smile

They're putting Matrix, Matrix Reloaded and Matrix Revolutions on the cinema between 9PM and 3.30AM at reading in Wellington, but I can't go Sad
Rel ol' buddy... did you make me a modified version of Af-lib just for me back then? i posted the link to the one i use above. are the contents of RelLib the same as that? i vaguely remember you making me a couple special routines or something? or was that just QB7.1 compatibleness you did?
All AF.Lib versions are now 7.1 compatible. Also VBDOS no editing necessary. ;*)

the latest is at AFTUT.zip


Nice of you to be back.

I saw your post at Neozones. Image editor? cool!!!
Thanks for the help, I'll try to get something done when I have some time. Smile

Quote:there's no point in that code alone, but drawing everything off-screen and then slapping it onscreen causes smooth FPS.
:o How can I do that?
Somekind of example of using this AF-Lib (I'll use this then, not Cosmox) could be nice. Just the basic; how to draw something there and do the smooth FPS.

Oh, and I don't need mouse, I can't stand one. I make the pointer moveable via keyboard.

Yeah, big Matrix fan here! Can't wait to see Revolutions. Smile This week's going to be hard..
no, KeyMaker i'm just saying as for that code you might as well draw the box to the screen and not use a back-buffer. but when you've got a loop with lots of things being drawn you'll want a back-buffer.

actually i just read through RelLib 5 and what a beautiful peice of work that appears to be. it's also made by Relsoft & Adigun and can do what AF-lib can do + more. it's in a libary format, so to use it you'd go qb.exe /L RelLib.QLB at command prompt (or batch file.) a QLB is a library that's Quick Basic-IDE (blue QB interface) compatible. later, when you compile, you specify RelLib.LIB as the library file, not .QLB.

anyhow to keep it simple, just add the AF.BAS module to your program. in QB, go FILE->Load File... and specify AF.bas as i posted it in my first reply. you may then use the routines within from your main module (the one with the GUI,) ask any questions when you are this far Smile