Re: A REALLY verbose example of the EDO Structure Package by GT Hawkins
  Home FAQ Contact Sign in
comp.lang.forth only
 
Advanced search
POPULAR GROUPS

more...

 Up
Re: A REALLY verbose example of the EDO Structure Package by GT Hawkins         

Group: comp.lang.forth · Group Profile
Author: Doug Hoffman
Date: Dec 7, 2006 16:20

Were you looking for something like this?

:class var cell bytes data
:m !: ( n -- ) self ! ;m
:m @: ( -- n ) self @ ;m
;class

:class anim var .delay
var .basedelay
var .&image
var .xcoord
var .xinc
var .xmin
var .xmax
var .ycoord
var .yinc
var .ymin
var .ymax
var .plane

:m init: ( .de .ba .&i .x .x+ .x< .x> .y .y+ .y< .y> .p -- )
!: .plane !: .ymax !: .ymin
!: .yinc !: .ycoord !: .xmax
!: .xmin !: .xinc !: .xcoord
!: .&image !: .basedelay !: .delay ;m

defer DrawObject ( addr -- )
:m draw: self DrawObject ;m

;class

anim Sprite0
anim Sprite1
anim Sprite2
anim Sprite3
anim Sprite4
anim Sprite5
anim Sprite6
anim Sprite7
anim Sprite8
anim Sprite9
anim Sprite10
anim Sprite11
anim Sprite12

1 21 DiamondS[] 44 2 40 256 8 0 0 195 Plane0 init: Sprite0
1 15 Ovoid[] 148 2 56 240 72 0 0 195 Plane0 init: Sprite1
1 23 DiamondS[] 44 2 40 256 128 0 0 195 Plane0 init: Sprite2
1 13 Ovoid[] 60 0 0 320 72 2 0 160 Plane1 init: Sprite3
1 11 DiamondS[] 104 0 0 320 72 2 0 160 Plane1 init: Sprite4
1 8 Ovoid[] 148 0 0 320 72 2 0 164 Plane1 init: Sprite5
1 9 DiamondS[] 192 0 0 320 72 2 0 164 Plane1 init: Sprite6
1 14 Ovoid[] 236 0 0 320 72 2 0 160 Plane1 init: Sprite7
1 8 DiamondS[] 100 4 4 300 24 3 0 180 Plane2 init: Sprite8
1 9 Ovoid[] 124 4 4 300 48 3 0 180 Plane2 init: Sprite9
1 7 DiamondS[] 148 4 4 300 72 3 0 180 Plane2 init: Sprite10
1 6 Ovoid[] 172 4 4 300 96 3 0 180 Plane2 init: Sprite11
1 5 DiamondS[] 196 4 4 300 120 3 0 180 Plane2 init: Sprite12

: (DrawObject) ( &obj -- )
\ access the data using the passed obj address and draw the image
cr ." Drawing object at address: " .
;

' (DrawObject) is DrawObject

: Animation ( -- )
draw: Sprite0
draw: Sprite1
draw: Sprite2
draw: Sprite3
draw: Sprite4
;

Animation

Drawing object at address: 4291904
Drawing object at address: 4291956
Drawing object at address: 4292008
Drawing object at address: 4292060
Drawing object at address: 4292112

Sprite0 64 dump

0 1 2 3 4 5 6 7 8 9 A B C D E F
417D40: 00 00 00 01 00 00 00 15 00 41 7B F0 00 00 00 2C
.........A{....,
417D50: 00 00 00 02 00 00 00 28 00 00 01 00 00 00 00 08
.......(........
417D60: 00 00 00 00 00 00 00 00 00 00 00 C3 00 00 00 00
................
417D70: 00 41 7C 30 00 00 00 01 00 00 00 0F 00 41 7C 10
.A|0.........A|.
417D80: 00 00 00 94 00 00 00 02 00 00 00 38 00 00 00 F0
...........8....

Sprite1 64 dump

0 1 2 3 4 5 6 7 8 9 A B C D E F
417D74: 00 00 00 01 00 00 00 0F 00 41 7C 10 00 00 00 94
.........A|.....
417D84: 00 00 00 02 00 00 00 38 00 00 00 F0 00 00 00 48
.......8.......H
417D94: 00 00 00 00 00 00 00 00 00 00 00 C3 00 00 00 00
................
417DA4: 00 41 7C 30 00 00 00 01 00 00 00 17 00 41 7B F0
.A|0.........A{.
417DB4: 00 00 00 2C 00 00 00 02 00 00 00 28 00 00 01 00
...,.......(....
no comments
diggit! del.icio.us! reddit!