04-24-2005, 10:24 PM
I am working on a picture maker for my games so i dont have write them all out into a data segment so here it is tell me what you think
In the reader you move with the arrow keys and select colors with the numberpad. press "s" to get to the save pic sub then when you have selected your pic within the lines press tab to save it
After this one is done you get the x and y limits maker sure to remember these cause you need them for the reader
In the reader you move with the arrow keys and select colors with the numberpad. press "s" to get to the save pic sub then when you have selected your pic within the lines press tab to save it
Code:
DECLARE SUB savepic ()
DECLARE SUB save ()
up$ = CHR$(0) + CHR$(72): down$ = CHR$(0) + CHR$(80): lft$ = CHR$(0) + CHR$(75)
rght$ = CHR$(0) + CHR$(77)
DIM SHARED prev(1000)
DIM SHARED x
DIM SHARED y
DIM SHARED sx
DIM SHARED sy
DIM SHARED zoom
DIM SHARED col(150, 107)
x = 1: y = 1
sx = 1: sy = 1
1
CLS
COLOR 11: PRINT "Picture Maker"
COLOR 12: PRINT "1) Get started"
COLOR 13: PRINT "2) Controls"
COLOR 14: PRINT "3) Quit"
COLOR 7
a$ = "0"
DO UNTIL VAL(a$) <= 3 AND VAL(a$) >= 1: a$ = INKEY$: LOOP
SELECT CASE VAL(a$)
CASE 1
GOTO prompt
CASE 2
GOTO controls
CASE 3
END
END SELECT
controls:
PRINT "Controls"
PRINT "Arrow keys to move cursor:"
PRINT "Numbers to change colors"
PRINT "S to save"
PRINT "When in save press S at any time to exit to edit mode"
PRINT "When in save select the part in the picture that you want to save"
PRINT "then press tab and it will give the x and y lengths, save them for the reader"
SLEEP
GOTO 1
prompt:
INPUT "Select the zoom of the picture (0-10)", zoom
CLS
SCREEN 13
GET (0, 0)-(4, 4), prev
color1 = 0
DO
a$ = INKEY$
IF a$ = CHR$(27) THEN END
IF color1 = 0 THEN color1 = 11
LINE (x, y)-(x + zoom, y + zoom), color1, BF
SELECT CASE UCASE$(a$)
CASE "S"
save
'checks for up down left or right
CASE up$
IF y > 1 THEN
color1 = 0
LINE (x, y)-(x + zoom, y + zoom), 0, BF
PUT (x, y), prev
y = y - (zoom + 1)
sy = sy - 1
GET (x, y)-(x + zoom, y + zoom), prev
END IF
CASE down$
IF y <= 144 THEN
color1 = 0
LINE (x, y)-(x + zoom, y + zoom), 0, BF
PUT (x, y), prev
sy = sy + 1
y = y + (zoom + 1)
GET (x, y)-(x + zoom, y + zoom), prev
END IF
CASE rght$
IF x <= 314 THEN
color1 = 0
LINE (x, y)-(x + zoom, y + zoom), 0, BF
PUT (x, y), prev
sx = sx + 1
x = x + (zoom + 1)
GET (x, y)-(x + zoom, y + zoom), prev
END IF
CASE lft$
IF x > 1 THEN
color1 = 0
LINE (x, y)-(x + zoom, y + zoom), 0, BF
PUT (x, y), prev
x = x - (zoom + 1)
sx = sx - 1
GET (x, y)-(x + zoom, y + zoom), prev
END IF
'clears blocks
CASE "C"
color1 = 0
LINE (x, y)-(x + zoom, y + zoom), 0, BF
col(sx, sy) = 0
GET (x, y)-(x + zoom, y + zoom), prev
END SELECT
'changes colors of blocks
IF VAL(a$) <= 9 AND VAL(a$) >= 1 THEN
b = VAL(a$)
color1 = b
col(sx, sy) = b
LINE (x, y)-(x + zoom, y + zoom), b, BF
GET (x, y)-(x + zoom, y + zoom), prev
END IF
LOOP
SUB save
up$ = CHR$(0) + CHR$(72): down$ = CHR$(0) + CHR$(80): lft$ = CHR$(0) + CHR$(75)
rght$ = CHR$(0) + CHR$(77)
DIM prevy(16383)
DIM prevx(16383)
GET (0, y)-(x, y), prevy
GET (x, 0)-(x, y), prevx
DO
a$ = INKEY$
color2 = 11
LINE (x, y)-(x + zoom, y + zoom), color2, BF
'draws a straight line from the wall to the block so the user
'knows what he is saving
LINE (0, y)-(x, y), 9
LINE (x, 0)-(x, y), 9
SELECT CASE UCASE$(a$)
'gets rid of lines and exits sub
CASE "S"
LINE (0, y)-(x, y), 0
PUT (0, y), prevy
LINE (x, 0)-(x, y), 0
PUT (x, 0), prevx
EXIT SUB
'checks witch direction then clears the line
'puts back what was there and moves the cursor
CASE up$
IF y >= 1 THEN
LINE (0, y)-(x, y), 0
LINE (x, 0)-(x, y), 0
LINE (x, y)-(x + zoom, y + zoom), 0, BF
PUT (0, y), prevy
PUT (x, 0), prevx
color1 = 0
PUT (x, y), prev
sy = sy - 1
y = y - (zoom + 1)
GET (0, y)-(x, y), prevy
GET (x, 0)-(x, y), prevx
GET (x, y)-(x + zoom, y + zoom), prev
END IF
CASE down$
IF y <= 294 THEN
LINE (0, y)-(x, y), 0
LINE (x, 0)-(x, y), 0
LINE (x, y)-(x + zoom, y + zoom), 0, BF
PUT (0, y), prevy
PUT (x, 0), prevx
color1 = 0
PUT (x, y), prev
sy = sy + 1
y = y + (zoom + 1)
GET (0, y)-(x, y), prevy
GET (x, 0)-(x, y), prevx
GET (x, y)-(x + zoom, y + zoom), prev
END IF
CASE rght$
IF x <= 314 THEN
LINE (0, y)-(x, y), 0
LINE (x, 0)-(x, y), 0
LINE (x, y)-(x + zoom, y + zoom), 0, BF
PUT (0, y), prevy
PUT (x, 0), prevx
color1 = 0
PUT (x, y), prev
sx = sx + 1
x = x + (zoom + 1)
GET (0, y)-(x, y), prevy
GET (x, 0)-(x, y), prevx
GET (x, y)-(x + zoom, y + zoom), prev
END IF
CASE lft$
IF x >= 1 THEN
LINE (0, y)-(x, y), 0
LINE (x, 0)-(x, y), 0
LINE (x, y)-(x + zoom, y + zoom), 0, BF
PUT (0, y), prevy
PUT (x, 0), prevx
color1 = 0
PUT (x, y), prev
sx = sx - 1
x = x - (zoom + 1)
GET (0, y)-(x, y), prevy
GET (x, 0)-(x, y), prevx
GET (x, y)-(x + zoom, y + zoom), prev
END IF
CASE CHR$(9)
savepic
END SELECT
LOOP
END SUB
SUB savepic
cx = sx
cy = sy
OPEN "pic.bmp" FOR OUTPUT AS #1
FOR cy = 1 TO sy
FOR cx = 1 TO sx
WRITE #1, col(cx, cy)
NEXT
NEXT
CLOSE #1
CLS
SCREEN 1
PRINT "x="; sx
PRINT "y="; sy
END
END SUB
After this one is done you get the x and y limits maker sure to remember these cause you need them for the reader
Code:
DECLARE SUB bmread (lx!, ly!, filename$, mul!)
CLS
SCREEN 13
INPUT "X limitations:", lx
INPUT "Y limitations:", ly
bmread lx, ly, "pic.bmp", 15
SUB bmread (lx, ly, filename$, mul)
CLS
DIM col(lx, ly)
OPEN filename$ FOR INPUT AS #1
FOR y = 1 TO ly
FOR x = 1 TO lx
INPUT #1, col(x, y)
NEXT
NEXT
CLOSE #1
ax = 0
ay = 0
FOR y = 1 TO ly * mul STEP mul
ay = ay + 1
ax = 0
FOR x = 1 TO lx * mul STEP mul
ax = ax + 1
LINE (x, y)-(x + mul, y + mul), col(ax, ay), BF
NEXT
NEXT
END SUB
[/code]
his world has been connected...
Tied to the darkness.
Soon to be completely eclipsed.
There is so very much to learn...
You understand so little.
A meaningless effort.
One who knows nothing can understand nothing.
-Ansem Bringer of darkness and creator of the heartless
Tied to the darkness.
Soon to be completely eclipsed.
There is so very much to learn...
You understand so little.
A meaningless effort.
One who knows nothing can understand nothing.
-Ansem Bringer of darkness and creator of the heartless