'=========================================================================== ' Subject: SPRITE(BITMAP) EDITOR Date: 04-23-96 (21:25) ' Author: Joshua Dickerson Code: QB, QBasic, PDS ' Origin: FidoNet QUIK_BAS Echo Packet: GRAPHICS.ABC '=========================================================================== ' Here is a simple bitmap editor i wrote to aid in the design of my games.. 'You start out in zoom mode where you can edit individual pixils of your 'bitmap, and as soon as you press esc, it automaticly writes a qBasic file with 'data statements and a loader for them..use the numeric keypad to move around 'and the , and . to select the colors (Actually < > without the shift heh 'heh).. hit space to set the point to the current color.. An "X" will denote 'where you are, but you will not see the changes to that pixil until you move 'the cursor away from the spot you were working on. DECLARE SUB UpdateScrollBar () DECLARE SUB Display () DIM SHARED x, y, xMax, yMax, SelectedColor CLS INPUT "Bitmap X size ->", xMax INPUT "Bitmap Y size ->", yMax DIM SHARED Bmp(xMax, yMax) AS STRING * 1 SCREEN 13 LOCATE 23, 1 PRINT "v" UpdateScrollBar Display DO WHILE a$ <> CHR$(27) SELECT CASE a$ CASE "," SelectedColor = SelectedColor - 1 IF SelectedColor < 0 THEN SelectedColor = 255 UpdateScrollBar CASE "." SelectedColor = SelectedColor + 1 IF SelectedColor > 255 THEN SelectedColor = 0 UpdateScrollBar CASE " " Bmp(x, y) = CHR$(SelectedColor) Display CASE "4" IF x > 0 THEN x = x - 1 Display CASE "6" IF x < xMax THEN x = x + 1 Display CASE "8" IF y > 0 THEN y = y - 1 Display CASE "2" IF y < yMax THEN y = y + 1 Display END SELECT LOCATE 7, 7 COLOR SelectedColor PRINT "X"; a$ = INPUT$(1) LOOP CLS FOR i = 0 TO xMax FOR j = 0 TO yMax PSET (i, j), ASC(Bmp(i, j)) NEXT NEXT Size% = 4 + INT(((xMax + 1) / 2) * (yMax + 1)) DIM BitMap%(Size%) GET (0, 0)-(xMax, yMax), BitMap% OPEN "Test.bas" FOR OUTPUT AS #1 PRINT #1, "SCREEN 13" PRINT #1, "DIM BitMap%("; Size%; ")" PRINT #1, "FOR I = 0 to"; Size% PRINT #1, " READ BitMap%(I)" PRINT #1, "NEXT" PRINT #1, "" PRINT #1, "PUT (0,0), BitMap%" PRINT #1, "END" PRINT #1, "" PRINT #1, "DATA "; FOR i = 0 TO Size% - 1 x = x + 1 PRINT #1, "&H" + HEX$(BitMap%(i)); IF x > 8 THEN x = 0 PRINT #1, "" PRINT #1, "DATA "; ELSE PRINT #1, ", "; END IF NEXT PRINT #1, "&H" + HEX$(BitMap%(Size%)) CLOSE SUB Display CONST WindowSize = 6 FOR i = -WindowSize TO WindowSize LOCATE WindowSize + 1 + i, 1 FOR j = -WindowSize TO WindowSize IF j + x >= 0 AND i + y >= 0 AND j + x <= xMax AND i + y <= yMax THEN COLOR ASC(Bmp(j + x, i + y)) PRINT CHR$(219); ELSE COLOR 15 PRINT CHR$(178); END IF NEXT NEXT END SUB SUB UpdateScrollBar LOCATE 24, 1 FOR i = 0 TO 39 COLOR (i + SelectedColor) MOD 255 PRINT CHR$(219); NEXT END SUB