home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Zodiac Super OZ
/
MEDIADEPOT.ISO
/
FILES
/
13
/
N_B_V203.ZIP
/
POLY-2D.DMO
< prev
next >
Wrap
Text File
|
1996-07-04
|
5KB
|
79 lines
$if 0
┌──────────────────────────╖ PowerBASIC v3.20
┌──┤ DASoft ╟──────────────────────┬──────────────────╖
│ ├──────────────────────────╢ Copyright 1995 │ DATE: 1995-10-01 ╟─╖
│ │ FILE NAME POLY-2D .DMO ║ by ╘════════════════─ ║ ║
│ │ ║ Don Schullian, Jr. ║ ║
│ ╘══════════════════════════╝ ║ ║
│ A license is hereby granted to the holder to use this source code in ║ ║
│ any program, commercial or otherwise, without receiving the express ║ ║
│ permission of the copyright holder and without paying any royalties, ║ ║
│ as long as this code is not distributed in any compilable format. ║ ║
│ IE: source code files, PowerBASIC Unit files, and printed listings ║ ║
╘═╤═════════════════════════════════════════════════════════════════════╝ ║
│ .................................... ║
╘═══════════════════════════════════════════════════════════════════════╝
$endif
'.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°
' ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° °
'┌────────────────────────────────
$INCLUDE "DAS-NB01.INC" '│ ol ' N°1
$INCLUDE "DAS-NB03.INC" '│ math package
$INCLUDE "DAS-NBV1.INC" '│ VGA graphics
$INCLUDE "PUBLICS .INC" '│ pick-up pPi# EXTERNAL
CLS '│
SCREEN 12 '│
GraphicSETUP '│ don 't forget this!
'│
DIM tP1 AS PolygonTYPE '│ your basic hexagon
tP1.X = 319 '│ center column
tP1.Y = 200 '│ center row
tP1.Points = 6 '│ 6 points = Hexagon
tP1.Radius = 50 '│ "circle" radius
tP1.Aspect = 1 '│ 1 = normal aspect
tP1.StartDeg = 0 '│ 0 = point 1 at top
tP1.PMode = 2 '│ XOR poly ON/OFF
tP1.Colour = 14 '│ Yellow
'│
'────────────────────────────────────────────┤ flickering Hexagon
H% = 1 : V% = 1 '│ routine
DO '│
INCR tP1.X, H% '│ new location
INCR tP1.Y, V% '│
IF tP1.Y =< 50 THEN V% = 1 '│ check boundries
IF tP1.Y => 420 THEN V% = -1 '│
IF tP1.X =< 50 THEN H% = 1 '│
IF tP1.X => 590 THEN H% = -1 '│
Draw2Dpolygon tP1 '│ XOR on
Draw2Dpolygon tP1 '│ XOR off
LOOP UNTIL INSTAT '│
G$ = INKEY$ '│
'────────────────────────────────────────────┤ flicker-free?
CLS '│ it's all in the timing and
tP1.X = 319 '│ speed of your system (try it)
tP1.Y = 200 '│
DIM XY%(1,tP1.Points) '│ the point coordinates
H% = 3 : V% = 3 '│ move values
GLineDRAW 0,245,639,245,0,3,14 '│ bounce line
GLineDRAW 0,145,639,145,0,3,15 '│ background line
DO '│
PolygonPoints tP1, XY%() '│ compute points
PolygonDRAW XY%(), tP1.Points, 0,2,11 '│ draw poly
INCR tP1.X, H% '│ move poly
INCR tP1.Y, V% '│
IF tP1.Y =< 50 THEN V% = 3 '│ check bounds
IF tP1.Y => 200 THEN V% = -3 '│
IF tP1.X =< 50 THEN H% = 3 '│
IF tP1.X => 590 THEN H% = -3 '│
GRFwaitRefresh 245 '│
PolygonDRAW XY%(), tP1.Points, 0,2,11 '│ XOR poly off screen
LOOP UNTIL INSTAT '│ this routine is smooth as silk
'│ on my 486/40 but you may have
'│ to play with the numbers on
'│ yours as the MHz of the screen
CLS '│ is also a factor
SCREEN 0 '└──────────────────────────────