I liked codeguy's
lotsa rotating poly's program so much I went and spruced it up with an interactive console that's graphically positioned using my layouter program. You can select polys one at a time and "do stuff".
Run the prog, then edit the first file p-console.png with a paint program. The black brackets position the visual elements, the writings are just memos - move the brackets about, then save the file and restart the program, & watch if anything moved. :> See if you can make the first file look like the other file, p-console2.png. (Try drawing gray lines to use as guides)
Materials:
p-console.png,
p-console2.png (find the code for the two include files in the first post)
'$include:'layouterinit.bas'
CONST MaxScreenX = 1366
CONST MaxScreenY = 768
CONST MaxPolys = 511
TYPE PolyRec
px AS INTEGER
py AS INTEGER
radius AS INTEGER
pc AS INTEGER
nsides AS INTEGER
incx AS INTEGER
incy AS INTEGER
rotateangle AS INTEGER
incrotate AS INTEGER
fill AS INTEGER
fillstep AS INTEGER
dosectorlines AS INTEGER
END TYPE
DIM SHARED SinTable(-360 TO 360), CosTable(-360 TO 360), Counts(16, 16)
FOR i = -360 TO 360
SinTable(i) = SIN(i * 3.1415926535 / 180)
CosTable(i) = COS(i * 3.1415926535 / 180)
NEXT
DIM console(100, 3) AS LONG
REDIM lay0pointsArr&(2000 ^ 2)
ReadLayout console(), "p-console.png", 0
'scale up the layout (image is half size)
FOR i = 0 TO UBOUND(console, 1): console(i, 0) = console(i, 0) * 2: console(i, 1) = console(i, 1) * 2: NEXT i
bfr& = _NEWIMAGE(1366, 768, 256)
SCREEN bfr&, , 1, 1
scr& = _DEST
_DEST bfr&
DIM Polys(0 TO MaxPolys) AS PolyRec
FOR i = 0 TO MaxPolys
Polys(i).px = INT(RND * 1366)
Polys(i).py = INT(RND * 768)
Polys(i).radius = INT(RND * 32)
Polys(i).nsides = INT(RND * 16) + 1
Polys(i).incx = ((-1) ^ INT(RND * 2)) * INT(RND * 8) + 1
Polys(i).incy = ((-1) ^ INT(RND * 2)) * INT(RND * 8) + 1
Polys(i).rotateangle = INT(RND * 360)
Polys(i).incrotate = INT(RND * 9) * (-1) ^ INT(RND * 2)
'* these are used by drawpoly
Polys(i).pc = INT(RND * 64) + 32
Polys(i).fill = -1 '-INT(RND * 2)
Polys(i).fillstep = INT(RND * 8) + 1
Polys(i).dosectorlines = -INT(RND * 2)
NEXT
FOR i = -360 TO 360
SinTable(i) = SIN(i * 3.1415926535 / 180)
CosTable(i) = COS(i * 3.1415926535 / 180)
NEXT
_FULLSCREEN
IF _FULLSCREEN = 0 THEN _FULLSCREEN _OFF
DIM msg$(10)
selected = -1
DIM prevlmb AS INTEGER, lmb AS INTEGER 'mouse cl tracker
DO
DO: LOOP WHILE _MOUSEINPUT: prevlmb = lmb: lmb = _MOUSEBUTTON(1)
CLS
FOR i = 0 TO MaxPolys
IF Polys(i).rotateangle > 360 - Polys(i).incrotate THEN
Polys(i).incrotate = -Polys(i).incrotate
ELSEIF Polys(i).rotateangle < 0 THEN
Polys(i).incrotate = -Polys(i).incrotate
END IF
Polys(i).rotateangle = Polys(i).rotateangle + Polys(i).incrotate
IF Polys(i).px > 1366 - Polys(i).incx THEN
Polys(i).incx = -Polys(i).incx
ELSEIF Polys(i).px < Polys(i).radius - Polys(i).incx THEN
Polys(i).incx = -Polys(i).incx
END IF
IF Polys(i).py > 768 - Polys(i).incy THEN
Polys(i).incy = -Polys(i).incy
ELSEIF Polys(i).py < Polys(i).radius - Polys(i).incy THEN
Polys(i).incy = -Polys(i).incy
END IF
Polys(i).px = Polys(i).px + Polys(i).incx
Polys(i).py = Polys(i).py + Polys(i).incy
drawpoly Polys(), i, Polys(i).pc
NEXT
'_LIMIT 30
k$ = INKEY$
PCOPY 0, 1
'click check routine
IF (prevlmb IMP lmb) = 0 THEN
buttonpressed = 0
IF CheckPair(console(), 4, _MOUSEX, _MOUSEY) OR CheckPair(console(), 5, _MOUSEX, _MOUSEY) THEN trackmode = 0
IF CheckPair(console(), 1, _MOUSEX, _MOUSEY) THEN buttonpressed = -1
IF CheckPair(console(), 3, _MOUSEX, _MOUSEY) THEN buttonpressed = -1
IF CheckPair(console(), 4, _MOUSEX, _MOUSEY) THEN buttonpressed = -1: msg$(1) = "Attempting contact...": msg$(2) = " unresponsive": msg$(3) = ""
IF CheckPair(console(), 5, _MOUSEX, _MOUSEY) THEN buttonpressed = -1: msg$(1) = "": msg$(2) = "arming laser...": msg$(3) = "Ready to fire!"
IF CheckPair(console(), 6, _MOUSEX, _MOUSEY) THEN buttonpressed = -1: trackmode = -1
'if a poly is clicked, note the selection
IF NOT buttonpressed THEN
prevselected = selected
selected = findpoly(Polys(), _MOUSEX, _MOUSEY)
IF selected <> -1 AND selected <> prevselected THEN
prevselected = selected
msg$(1) = "Unknown: mysterious entity": msg$(2) = "": msg$(3) = ""
ELSE
selected = prevselected
END IF
END IF
END IF
IF k$ = CHR$(27) THEN selected = -1: prevselected = -1: FOR cclr = 1 TO 3: msg$(cclr) = "": NEXT
'to draw the console
_DEST scr&
IF selected <> -1 THEN
'draw selection reticle if any selected
FOR cs = 1 TO 9: CIRCLE (Polys(selected).px, Polys(selected).py), Polys(selected).radius + 6 + cs / 2, _RGB(30, 30, 220), , , 1.1: NEXT
END IF
x1 = console(0, 0): x2 = console(1, 0): y1 = console(0, 1): y2 = console(1, 1)
LINE (x1, y1)-(x2, y2), _RGB(0, 0, 0), BF
LINE (x1 + 10, y1 + 10)-(x2 - 10, y2 - 10), _RGB(225, 225, 225), B
IF selected <> -1 THEN
realpx = Polys(selected).px: Polys(selected).px = (x1 + x2) / 2
realpy = Polys(selected).py: Polys(selected).py = (y1 + y2) / 2
drawpoly Polys(), selected, Polys(selected).pc
Polys(selected).px = realpx
Polys(selected).py = realpy
END IF
IF trackmode AND selected > -1 THEN msg$(1) = "Tracking creature --": msg$(2) = STR$(Polys(selected).px): msg$(3) = STR$(Polys(selected).py)
'no fancy routines for the rest of the console, yet!
ShowBunch console(), 3, msg$(1), 1
ShowBunch console(), 4, "Comm", 2
ShowBunch console(), 5, "Fire", 3
ShowBunch console(), 6, "scan", 2
ShowBunch console(), 7, msg$(2), 2
ShowBunch console(), 8, msg$(3), 2
'lastly before swapping _DEST: draw a mouse cursor if needed
IF _FULLSCREEN > 0 THEN
ha = 0: hb = 0
FOR i = 1 TO 5
IF i MOD 2 = 1 THEN ha = ha + 1 ELSE hb = hb + 1
LINE (_MOUSEX + ha + 8, _MOUSEY - hb)-STEP(18, 18)
LINE (_MOUSEX + ha, _MOUSEY - hb)-STEP(15, 15)
LINE (_MOUSEX + ha, _MOUSEY - hb + 8)-STEP(18, 18)
NEXT i
END IF
_DEST bfr&
_DISPLAY
LOOP UNTIL k$ > "" AND k$ <> CHR$(27)
SYSTEM
SUB drawpoly (p() AS PolyRec, which, c)
IF p(which).nsides > 0 THEN
yx = 360 / p(which).nsides
FOR i = 0 TO 360 STEP yx
IF p(which).fill THEN
FOR cr = 1 TO p(which).radius STEP p(which).fillstep
x1 = p(which).px + cr * CosTable((i + p(which).rotateangle) MOD 360)
y1 = p(which).py + cr * SinTable((i + p(which).rotateangle) MOD 360)
x2 = p(which).px + cr * CosTable(((i + p(which).rotateangle) + yx) MOD 360)
y2 = p(which).py + cr * SinTable(((i + p(which).rotateangle) + yx) MOD 360)
LINE (x1, y1)-(x2, y2), c
IF p(which).dosectorlines THEN
LINE (p(which).px, p(which).py)-(x1, y1), c
END IF
NEXT
ELSE
x1 = p(which).px + p(which).radius * CosTable((i + p(which).rotateangle) MOD 360)
y1 = p(which).py + p(which).radius * SinTable((i + p(which).rotateangle) MOD 360)
x2 = p(which).px + p(which).radius * CosTable(((i + p(which).rotateangle) + yx) MOD 360)
y2 = p(which).py + p(which).radius * SinTable(((i + p(which).rotateangle) + yx) MOD 360)
LINE (x1, y1)-(x2, y2), c
IF p(which).dosectorlines THEN
LINE (p(which).px, p(which).py)-(x1, y1), c
END IF
END IF
NEXT
ELSE
PSET (p(which).px, p(which).py), c
END IF
END SUB
FUNCTION findpoly (p() AS PolyRec, x, y)
'pick the poly closest to where lmb clicked
sr = 20
DIM range(MaxPolys)
FOR i = 0 TO MaxPolys
range(i) = 100
IF p(i).px > x - sr AND p(i).px < x + sr AND p(i).py > y - sr AND p(i).py < y + sr THEN
range(i) = SQR((p(i).px - x) ^ 2 + (p(i).py - y) ^ 2)
END IF
NEXT i
lowest = 0
FOR i = 0 TO MaxPolys
IF range(i) < range(lowest) THEN lowest = i
NEXT i
IF range(lowest) >= 100 THEN findpoly = -1 ELSE findpoly = lowest
END FUNCTION
'$include:'layouterfunc.bas'
(I'm ashamed to say this took more than 2 hours to do... they said programming was easy dammit!) And if you ad an ovaloid to the mouse cursor, you can have your own starship Enterprise!
So this shows what sort of things you can do with layouter. Making the layout image only 1/2 as long and tall as the actual screen turned out to be a good idea. the reading function won't account for that automaticlly though, so you have to multiply the array. There's limitless possibilities to what else you can do, even though I only put in really simple functions for checking mouse clicks and making boxes show up!