Qbasicnews.com
May 31, 2020, 07:57:34 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Back to Qbasicnews.com | QB Online Help | FAQ | Chat | All Basic Code | QB Knowledge Base
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Using AFLIB  (Read 5199 times)
Sir Toad
Member
*
Posts: 30



« on: February 18, 2003, 02:31:32 PM »

I'm using AFLIB - but it's not a LIB so it's sorta funny Smiley

It's just a buncha routines in my project.

Okay, a lot of people use PP256, and that's what I'm using. But I just don't know how to use it along with AFLIB.

The following does not work, the output is scrambled. I've tried a lot of combinations, but I know there must be a correct way of wording this code:

(first we use the PP256 routines to load the PUT file, and this works fine:)

    REDIM SHARED sprite(0)       AS INTEGER
    REDIM SHARED indxSprite(0)   AS INTEGER
    CALL Init.ImageData("tiles\sprite.PUT", sprite())
    CALL MakeImageIndex(sprite(), indxSprite())

And here is where I cannot figure out how to display a sprite:

AF.Sprite &HA000, 260, 60, VARSEG(sprite(1)), indxSprite(3)

The arguments are Destination Segment, X, Y, Sprite Segment, Sprite Offset

Help would be greatly appreciated... I've been messing with this for a long time today.
Logged

__________________________________

Mr Toad
Blue Castle Productions
R@dioman
Ancient QBer
****
Posts: 410



« Reply #1 on: February 18, 2003, 06:11:15 PM »

try:
REDIM SHARED sprite(1 to 1) AS INTEGER
REDIM SHARED indxSprite(1 to 1) AS INTEGER
CALL Init.ImageData("tiles\sprite.PUT", sprite())
CALL MakeImageIndex(sprite(), indxSprite())

AF.Sprite &HA000, 260, 60, VARSEG(sprite(1)), indxSprite(3)

I would set up an off-screen buffer for flickerless animation, like so:

REDIM SHARED VPage(31999) as integer
AF.Sprite varseg(VPage(0)), 260, 60, VARSEG(sprite(1)), indxSprite(3)
AF.PCopy &HA000, Varseg(VPage(0))

*Not tested*
Logged

Sir Toad
Member
*
Posts: 30



« Reply #2 on: February 18, 2003, 08:04:06 PM »

I tried 1 TO 1 instead of 0 but I get the same result. I can't post a picture or I would. I tried placing only one tile, and the whole screen is a garbled mess of colored pixels. Either the project's memory is really low when it tries to place the tile, or I'm not doing something right.

Are you sure this is correct:
AF.Sprite &HA000, 260, 60, VARSEG(sprite(1)), indxSprite(3)

I don't need to use VARPTR or anything special? I guessed at this code because it seemed most logical. However the output is corrupt.
Logged

__________________________________

Mr Toad
Blue Castle Productions
Sir Toad
Member
*
Posts: 30



« Reply #3 on: February 18, 2003, 08:12:50 PM »

let me also add that I can PUT (x,y),Spite(indxSprite(3)), PSET just fine, so it's the way I'm using AF.Sprite or something  :-?
Logged

__________________________________

Mr Toad
Blue Castle Productions
toonski84
__/--\__
*****
Posts: 2567



« Reply #4 on: February 18, 2003, 08:57:26 PM »

a:  is aflib compatible with put?  put has a very funny format, with the whole x * 8 deal, and not many libs use the format.
Logged

i]"I know what you're thinking. Did he fire six shots or only five? Well, to tell you the truth, in all this excitement, I've kinda lost track myself. But being as this is a .44 Magnum ... you've got to ask yourself one question: 'Do I feel lucky?' Well, do ya punk?"[/i] - Dirty Harry
R@dioman
Ancient QBer
****
Posts: 410



« Reply #5 on: February 18, 2003, 11:14:41 PM »

Bingo! You do have tu use varptr to get to offset of where the tile is located, like so:

REDIM SHARED sprite(1 to 1) AS INTEGER
REDIM SHARED indxSprite(1 to 1) AS INTEGER
REDIM SHARED VPage(31999) as integer

CALL Init.ImageData("tiles\sprite.PUT", sprite())
CALL MakeImageIndex(sprite(), indxSprite())

AF.Sprite varseg(VPage(0)), 260, 60, VARSEG(sprite(1)), varptr(sprite(3))
AF.PCopy &HA000, Varseg(VPage(0))

This should work  Cool
Logged

Sir Toad
Member
*
Posts: 30



« Reply #6 on: February 18, 2003, 11:47:23 PM »

thanks Radioman, you're  a lifesaver. 'course you didn't get it quite right, but you made me think a little. The proper way of typing it is

VARSEG(sprite(1)), VARPTR(sprite(indxsprite(3)))

Thanks anyhow Smiley

It's touchy though... I'm still getting some corruption with the NPCs but the map is coming in clear.
Logged

__________________________________

Mr Toad
Blue Castle Productions
relsoft
*/-\*
*****
Posts: 3927



WWW
« Reply #7 on: February 19, 2003, 04:57:04 AM »

Too late.....

LOL

R@dioman: tomorrow, I didn't have the time to zip it.

BTW, you should multilib RelLib and CosmoX to compile it... :*)
Logged

y smiley is 24 bit.


Genso's Junkyard:
http://rel.betterwebber.com/
Sir Toad
Member
*
Posts: 30



« Reply #8 on: February 19, 2003, 01:37:05 PM »

Quote
BTW, you should multilib RelLib and CosmoX to compile it... :*)


Did you mean me? AFLib and RelLib aren't the same, right? What would I need CosmoX lib for? I do need something for memory if it exists... When using AFLib, if I load too many tiles then the output is corrupt (scattered pixels all over the screen). There's a fine line between not displaying a tile correctly and running out of memory, but this time it's memory.
Logged

__________________________________

Mr Toad
Blue Castle Productions
Kackurot
Member
*
Posts: 68



WWW
« Reply #9 on: February 19, 2003, 02:46:23 PM »

Well  toad, Cosmox lib is cool and will make relib bettter. Cosmox has memory routines for ems,xms and such. Odf course relib has xms now, but using Cosmo will give you more rountines to work with ;-) (By the way I had the same probs as you when i first used relib with pp256. I forgot to use varseg and varptr  :lol:  )
Logged

he Legend Continues..........
Pick up DBZ budaki today!!! ;-)
R@dioman
Ancient QBer
****
Posts: 410



« Reply #10 on: February 19, 2003, 05:09:01 PM »

Rel: Sounds good.
Logged

toonski84
__/--\__
*****
Posts: 2567



« Reply #11 on: February 19, 2003, 08:27:34 PM »

brief bit of history:
cosmox came first, by bobby3999 (now abridged to bobby) as a faster, more complete replacement to directqb, which was created by the ex-qb programmer angelo mottello.  both are still very popular.  recently, rel made rel-lib, which he soon after adapted to work with dqb's format.  even more recently, rellib was converted into call absolute routines which could work in qb1.1 (the free version of qb4.5 that came with dos).  the guy that converted it named it 'aflib'.  if you can, use the qlb form of the library, as aflib wastes precious string memory.  i havent checked out cosmox's extra stuff, but i understand the entire asm source is there for you to compile...
Logged

i]"I know what you're thinking. Did he fire six shots or only five? Well, to tell you the truth, in all this excitement, I've kinda lost track myself. But being as this is a .44 Magnum ... you've got to ask yourself one question: 'Do I feel lucky?' Well, do ya punk?"[/i] - Dirty Harry
Sir Toad
Member
*
Posts: 30



« Reply #12 on: February 19, 2003, 09:35:01 PM »

Thanks so much for the history, toonski84. I didn't know any of that.

Now, I still don't understand why I would even want to use RelLib if CosmoX can do what it can do.
Quote
Of course relib has xms now, but using Cosmo will give you more rountines to work with.

So you are saying the XMS routines in RelLib are why I should mix the two?

Quote
but i understand the entire asm source is there for you to compile...


yes I saw the asm source, but I don't have any idea how or why I'd need to compile it...?
Logged

__________________________________

Mr Toad
Blue Castle Productions
relsoft
*/-\*
*****
Posts: 3927



WWW
« Reply #13 on: February 20, 2003, 03:32:10 AM »

Quote from: "Sir Toad"
Quote
BTW, you should multilib RelLib and CosmoX to compile it... :*)


Did you mean me? AFLib and RelLib aren't the same, right? What would I need CosmoX lib for? I do need something for memory if it exists... When using AFLib, if I load too many tiles then the output is corrupt (scattered pixels all over the screen). There's a fine line between not displaying a tile correctly and running out of memory, but this time it's memory.


Sorry Toad, its for R@dioman as he will certainly need it to compile a source(Very big and messy) I am giving him. :*)


Toad: are you using the multiplatform(like the sound of it) AFlib? the one that can be found on the junk section of my site?  It works with VBdos and all other QB that supports ABSOLUTE. :*)

No you don't need any other lib to use AFlib.  Look at the Zeldatut.bas at the Junkyard.  it scrolls, and more. :*)
Logged

y smiley is 24 bit.


Genso's Junkyard:
http://rel.betterwebber.com/
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!