Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How about a Mirror parameter for PUT?
#1
I've been flipping images and placing them in a seperate buffer when I know that I am going to need a reverse image of a picture. It would be nice if there was an extra optional parameter for PUT that makes places the image flipped, maybe have 1 make it flip horizontally, 2 flip vertically, 3 flip both ways? It would free up a lot of RAM for me and probably a lot of game programmers.
f you play a Microsoft CD backwards you can hear demonic voices. The scary part is that if you play it forwards it installs Windows.
Reply
#2
That would be awsome and very useful. You could make a game and have a mirror in it and have the mirror cast a reflection.
Reply
#3
Only problem with that there are presently 22 PUT routines, for the different screen modes, for the different PUT modes, and for CPUs that support MMX. You want horizonal and vertical mirroring, you're talking about writing 44 new routines for one feature. That's quite a bit of bloat.

Instead, just write your own routine to flip a sprite, it's quicker and easier than dealing with the same renderer, only backwards.
Reply
#4
I'm working 3 SUB's right now for a 16x16 sprite, and all it is is simply taking the 1st column of the sprite and puttin it in anotehr spot, then the 2nd column and puting it beside the previously placed column, or rows for the other way to flip, and doinging both to flip both ways obviously, if anyone succeeds before I do, why not post your code.
Reply
#5
Well here's my code for a 16x16 sprite, and it's in SUB's too, I'm proud of myself, my first completed project in fb Big Grin



The code is for fb, although I am sure porting to qb wouldn't be too hard, well anyway, there's a simple routine and it works, and lots of comments too.
Code:
' FLIPPING
' Coded by Axipher
' Copyright 2005
' No external data required


DEFINT A-Z

SCREEN 13,,,1
CLS

' Declare SUB's
DECLARE SUB fliph ()
DECLARE SUB flipv ()
DECLARE SUB flipb ()

' Set aside space in memory
DIM SHARED object%(129)
DIM SHARED objectfh%(129)
DIM SHARED objectfhp%(9)
DIM SHARED objectfv%(129)
DIM SHARED objectfvp%(9)
DIM SHARED objectfb%(129)
DIM SHARED objectfbp%(9)

' Draw the object
CIRCLE (5,5),3,1
LINE (11,8)-(8,11),1
PAINT (16,16),4,1
PAINT (5,5),3,1
CIRCLE (5,5),3,2
GET (1, 1)-(16, 16), object%

' Replace the Object
CLS
PUT (1,1),object%


' Do the flips
fliph
flipv
flipb
' Show all flips
PUT (1,1),object%
PUT (17,1),objectfh%
PUT (1,17),objectfv%
PUT (17,17),objectfb%
LOCATE 6,1:PRINT "Normal"
PUT (1,48),object%
LOCATE 9,1:PRINT "Flipped Horizontaly"
PUT (1,72),objectfh%
LOCATE 12,1:PRINT "Flipped Verticaly"
PUT (1,96),objectfv%
LOCATE 15,1:PRINT "Flipped Both"
PUT (1,120),objectfb%


' Wait for user input then end
SLEEP
SYSTEM




SUB fliph ()
' Flip object Horizontaly
FOR x = 1 TO 16
    GET (x,1)-(x,16),objectfhp%
    PUT (33-x,1),objectfhp%
    GET (17,1)-(32,17),objectfh%
NEXT
CLS
PUT (1,1),object%
END SUB


SUB flipv
' Flip object Verticaly
FOR y = 1 TO 16
    GET (1,y)-(16,y),objectfvp%
    PUT (1,33-y),objectfvp%
    GET (1,17)-(17,32),objectfv%
NEXT
CLS
PUT (1,1),object%
END SUB


SUB flipb
' Flip object both ways
FOR x = 1 TO 16
    GET (x,1)-(x,16),objectfbp%
    PUT (33-x,1),objectfbp%
    GET (17,1)-(32,17),objectfb%
NEXT
CLS
PUT (1,1),objectfb%
FOR y = 1 TO 16
    GET (1,y)-(16,y),objectfbp%
    PUT (1,33-y),objectfbp%
    GET (1,17)-(17,32),objectfb%
NEXT
CLS
END SUB
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)