Hokay, here's the situation...
I'm loading images to qb via a script command, it makes an image and index array for the image file. The problem I'm having is, when I want to draw the screen, how do I get QB to draw graphics from those arrays without hard-coding it? I don't wanna have to hard-code in an array to my DrawScreen routine everytime I want a images from a new image file. I need QB to handle that on its own so I can have as many image files as I want (well as much as QB can handle) without having to change add another line of code to my engine.
Any help at all is much appreciated.
Thank you all so much.
G'day,
~Dave~
Scripting Difficulties
- Seb McClouth
- Veteran
- Posts: 342
- Joined: Wed Nov 09, 2005 7:47 am
- Location: Inside the Matrix...
- Contact:
Look around at forum on how to make libraries... That might help ya...
QBinux is a Linux distribution with the aim of integrating the work of the vast community of free software developers at Pete's QBASIC Site in order to create a modern, performant, safe and easy to use system for system administrators and desktop users.
- The Awakened
- Veteran
- Posts: 144
- Joined: Sun Aug 07, 2005 1:51 am
- {Nathan}
- Veteran
- Posts: 1169
- Joined: Thu Aug 19, 2004 6:08 pm
- Location: The wetlands of central Ohio, USA
- Contact:
Yes, I think I might get what you are saying, but I am not sure. Please elaborate. If you are asking what I think you are, check the tutorial section for TileX (I think that is what it is... it is an old commented program that uses DEF FN. It is pretty good if you are going for tile*tile scrolling. It takes a little work to learn from, but it really is a great thingy...).
Sorry for confusing any of you, I'm having a tough time explaining this... Lemme give it another shot.
I want my DrawScreen routine to go through all images loaded and draw them to the screen at their specified coordinates. Ugh, this is hard for me to explain after this...
Rather then having to hard code in a few lines for every new image array I have to put the correct sprite, I want my routine to handle that on its own so I can simply load the images via script, and put them on screen via the DrawMap routine.
So if I say LOADIMAGE whatever.??? in my script then put it on the map, All I want to do is hafta type DRAWSCREEN and the routine will be able to put that image on screen.
I need the routine to draw the screen to recognize image arrays without having to change my code to look for that specific array.
I'm having a hard time explaining this for some reason so if you still aren't getting what I'm trying to say I'll try to word it better yet again. I don't have any real code because I'm still in planning and have no idea of how to do this.
Hope I'm not confusing the hell out of you...
Sorry for the headache,
~Dave
I want my DrawScreen routine to go through all images loaded and draw them to the screen at their specified coordinates. Ugh, this is hard for me to explain after this...
Rather then having to hard code in a few lines for every new image array I have to put the correct sprite, I want my routine to handle that on its own so I can simply load the images via script, and put them on screen via the DrawMap routine.
So if I say LOADIMAGE whatever.??? in my script then put it on the map, All I want to do is hafta type DRAWSCREEN and the routine will be able to put that image on screen.
I need the routine to draw the screen to recognize image arrays without having to change my code to look for that specific array.
I'm having a hard time explaining this for some reason so if you still aren't getting what I'm trying to say I'll try to word it better yet again. I don't have any real code because I'm still in planning and have no idea of how to do this.
Hope I'm not confusing the hell out of you...
Sorry for the headache,
~Dave
- The Awakened
- Veteran
- Posts: 144
- Joined: Sun Aug 07, 2005 1:51 am
Heh, didn't you kind of ask this same question in this thread:
http://www.petesqbsite.com/forum/viewtopic.php?t=1197
That's what you need to do: put all of your images into the same array. It's easier to put them all into the same file and load them all at once. But if you need to load individual files (not reccommended), then the code looks like this:
ImageSize is just a variable that represents the size of one image, in QB integers. Keep Index as a global variable, so that it doesn't reset to 0.
I really recommend you use the first method (put everything in the same file), since its easier to keep track of.
Fire away with any more questions.
-The Awakened
http://www.petesqbsite.com/forum/viewtopic.php?t=1197
That's what you need to do: put all of your images into the same array. It's easier to put them all into the same file and load them all at once. But if you need to load individual files (not reccommended), then the code looks like this:
Code: Select all
DEF SEG = VARSEG(Images(Index))
BLOAD "image.img", VARPTR(Images(Index))
DEF SEG
Index = Index + ImageSize
I really recommend you use the first method (put everything in the same file), since its easier to keep track of.
Fire away with any more questions.
-The Awakened
"Sorry for beating you up with a baseball bat Julian, but I DID think that you were a samsquanch."