06-23-2004, 03:11 AM
Here is a graphics editor that uses the mouse and a grid, and all the colors. it makes it very easy to make detailed images:
here is an image that can be used with my editor. when you start the program, it asks you if you want to load an image. you can press y, and then type this in: exam. then you can press enter.
oh, and save this to a .txt called exam.... or exam.txt. well, enjoy.
ok, so, send in yur image editors. and, if you have time, make a mini game that uses the images from yur editor..... oh, and try to make it save the images like that in a .txt, k? ok, get to it!
Code:
DEFINT A-Z
DECLARE SUB mouse (cx, dx, bx)
DECLARE SUB mousepointer (SW)
DIM SHARED a(9) 'Set up array for code
DEF SEG = VARSEG(a(0)) 'Get array segment (nnnn: )
' (two 8 bit)
FOR i = 0 TO 17 'length of DATA to
READ r 'read
POKE VARPTR(a(0)) + i, r 'into array/2 (nnnn:iiii) (one 8 bit)
NEXT i 'until 17
'**************************** Machine Code *********************************
DATA &HB8,&H00,&H00 : ' mov AX,[n] [Swap code-(L),(H)] in AX
DATA &H55 : ' push BP Save BP
DATA &H8B,&HEC : ' mov BP,SP Get BP to c Seg
DATA &HCD,&H33 : ' int 33 Interrupt 33
DATA &H92 : ' xchg AX,[reg] [Swap code-reg] in AX
DATA &H8B,&H5E,&H06 : ' mov BX,[BP+6] Point to (variable)
DATA &H89,&H07 : ' mov [BX],AX Put AX in (variable)
DATA &H5D : ' pop BP Restore BP
DATA &HCA,&H02,&H00 : ' ret 2 Far return
SCREEN 13
'****************************** Mouse set up ******************************
CALL mousepointer(0) 'Reset mouse and
CALL mousepointer(1) 'turn pointer off
CALL mousepointer(3) 'Get coordinates
'****************************** P R O G R A M ******************************
DIM im(100, 100)
FOR y = 1 TO my
FOR x = 1 TO mx
im(x, y) = 0
NEXT x
NEXT y
SCREEN 13
INPUT "Before you start drawing, do you want to load another image to work with (y\n)"; ans$
IF (ans$ = "y") THEN
INPUT "(you don't have to add the .TXT) What is the name of the file you want to load"; nm$
OPEN nm$ + ".TXT" FOR INPUT AS #1
INPUT #1, mx
INPUT #1, my
FOR y = 1 TO my
FOR x = 1 TO mx
INPUT #1, im(x, y)
NEXT x
NEXT y
ELSE
DO
INPUT "how wide do you want it to be (between 1 and 100)"; mx
LOOP UNTIL mx < 100
DO
INPUT "how tall do you want it to be (between 1 and 100)"; my
LOOP UNTIL my < 100
END IF
CLS
LINE (mx, 0)-(mx, my), 2
LINE (0, my)-(mx, my), 2
pix = 200 / mx
piy = 200 / my
FOR x = 1 TO 200 STEP pix
LINE ((x + 115), 0)-((x + 115), 200), 15
NEXT x
FOR y = 1 TO 200 STEP piy
LINE (115, y)-(315, y), 15
NEXT y
FOR y = 1 TO 80 STEP 8
FOR x = 1 TO 100 STEP 4
colr = colr + 1
LINE (x, y + 120)-(x + 3, y + 127), colr, BF
NEXT x
NEXT y
colr = 1
FOR y = 1 TO 200 STEP piy
FOR x = 1 TO 200 STEP pix
IF (dx > x + 115 AND dx < x + pix + 115) THEN
IF (cx > y AND cx < y + piy) THEN
IF (bx = 1) THEN
im((x / pix), (y / piy)) = colr
ELSEIF (bx = 2) THEN
im((x / pix), (y / piy)) = 0
END IF
END IF
END IF
NEXT x
NEXT y
coolr = 0
FOR y = 1 TO 80 STEP 8
FOR x = 1 TO 100 STEP 4
coolr = coolr + 1
IF (x <= dx AND x + 3 >= dx) THEN
IF (y + 120 <= cx AND y + 127 >= cx) THEN
IF (bx = 1) THEN
colr = coolr
END IF
END IF
END IF
NEXT x
NEXT y
LINE (10, 102)-(20, 112), colr, BF
FOR y = 0 TO my
FOR x = 0 TO mx
IF (im(x, y) <> 0) THEN
PSET (x, y), im(x, y)
END IF
NEXT x
NEXT y
FOR y = 0 TO my - 1
FOR x = 0 TO mx - 1
IF (im(x, y) <> 0) THEN
LINE ((x * pix) + 115 + 2, (y * piy + 2))-((x * pix) + pix + 115, (y * piy) + piy), im(x, y), BF
END IF
NEXT x
NEXT y
DO
Key$ = INKEY$
CALL mouse(cx, dx, bx)
LOCATE 10, 1: PRINT dx; cx; bx
IF (bx <> 0) THEN
FOR y = 1 TO 200 STEP piy
FOR x = 1 TO 200 STEP pix
IF (dx > x + 115 - 1 AND dx < x + pix + 115) THEN
IF (cx > y - 1 AND cx < y + piy) THEN
IF (bx = 1) THEN
im((x / pix), (y / piy)) = colr
ELSEIF (bx = 2) THEN
im((x / pix), (y / piy)) = 0
END IF
END IF
END IF
NEXT x
NEXT y
coolr = 0
FOR y = 1 TO 80 STEP 8
FOR x = 1 TO 100 STEP 4
coolr = coolr + 1
IF (x <= dx AND x + 3 >= dx) THEN
IF (y + 120 <= cx AND y + 127 >= cx) THEN
IF (bx = 1) THEN
colr = coolr
END IF
END IF
END IF
NEXT x
NEXT y
LINE (10, 102)-(20, 112), colr, BF
FOR y = 0 TO my
FOR x = 0 TO mx
IF (im(x, y) <> 0) THEN
PSET (x, y), im(x, y)
END IF
NEXT x
NEXT y
FOR y = 0 TO my - 1
FOR x = 0 TO mx - 1
IF (im(x, y) <> 0) THEN
LINE ((x * pix) + 115 + 2, (y * piy + 2))-((x * pix) + pix + 115, (y * piy) + piy), im(x, y), BF
END IF
NEXT x
NEXT y
END IF
LOOP UNTIL Key$ = "q"
LOCATE 2, 5: PRINT "Would you like to save? (y/n)"
DO
Key$ = INKEY$
LOOP UNTIL Key$ = "y" OR Key$ = "n"
IF (Key$ = "y") THEN
INPUT "(you don't have to add the .TXT) What is the filename you want"; nm$
OPEN nm$ + ".TXT" FOR OUTPUT AS #2
WRITE #2, mx
WRITE #2, my
FOR y = 0 TO my
FOR x = 1 TO mx
PRINT #2, im(x, y)
NEXT x
NEXT y
END IF
'-------------------| THE END (Cut here)|----------------------------------
SUB mouse (cx, dx, bx)
POKE VARPTR(a(4)), &H92 'Swap code,Get CX setup
CALL absolute(cx, VARPTR(a(0))) 'Run Code
' cx = cx / 8 'Adjust 25x80
POKE VARPTR(a(4)), &H91 'Swap code,Get DX setup
CALL absolute(dx, VARPTR(a(0))) 'Run Code
dx = dx / 2 'Adjust 25x80
POKE VARPTR(a(4)), &H93 'Swap code,Get BX setup
CALL absolute(bx, VARPTR(a(0))) 'Run Code
'Note :
'Remove the /8
'for graphics modes.
END SUB
SUB mousepointer (SW)
POKE VARPTR(a(0)) + 1, SW 'Swap code,Set AX = (SW)
CALL absolute(c, VARPTR(a(0))) 'Run Code
'Note:
'SW = 0-reset
'SW = 1-on
'SW = 2-off
'SW = 3-coordinates
END SUB
here is an image that can be used with my editor. when you start the program, it asks you if you want to load an image. you can press y, and then type this in: exam. then you can press enter.
oh, and save this to a .txt called exam.... or exam.txt. well, enjoy.
Code:
50
50
0
55 0 55 55 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 55 0 0 0 55 0 0 0 0 0 0 0 0 0 0
55 0 0 55 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 55 0 55 0 55 0 0 0 0 0 0 0 0 0 0
55 0 0 0 55 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 55 0 0 0 55 0 55 55 0 0 55 55 0 0 0
55 0 0 0 55 0 0 0 0 0 0 0 0 0 0 0 0 0 0 55 0 55 0 0 55 55 55 0 55 0 0 55 0 0 0 0 55 0 55 0 55 55 0 0 0 55 0 55 0 0 0
55 0 0 0 55 0 0 55 55 55 55 0 0 0 0 0 0 0 0 55 0 55 0 55 0 0 55 0 55 0 0 55 0 0 0 0 55 0 55 0 55 55 0 0 0 55 55 0 0 0 0
55 0 0 0 55 0 0 55 0 0 55 0 0 0 0 0 0 0 0 55 0 55 0 55 0 0 55 0 55 0 0 55 0 0 0 0 55 0 55 0 55 0 55 0 0 55 0 16 0 0 0
55 0 0 0 55 0 0 55 0 0 55 0 0 0 0 0 0 0 0 55 55 55 0 0 55 55 55 0 0 55 55 55 0 0 0 0 55 0 55 0 55 0 0 55 0 0 55 32 0 0 0
55 0 0 55 0 0 0 55 0 0 55 0 0 0 0 0 0 0 0 0 0 55 0 0 0 0 0 0 0 0 0 0 0 0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 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
ok, so, send in yur image editors. and, if you have time, make a mini game that uses the images from yur editor..... oh, and try to make it save the images like that in a .txt, k? ok, get to it!