User blog:Swaxhog/Learning to Draw

I'm now ready to move from text mode to graphics. This is the final step for me before I tackle backgrounds, foregrounds, sprites and animations and everything else that looks so confusing.

So today I practiced using both screens, learning to handle touch input and drawing basic line graphics. Nothing too complicated just once again getting familiar with the screen dimensions.

What I ended the day with was a small program that lets you draw on the screen. I went through many interations and playing around but essentially it's all the same. Capture the touch x,y and do something with it.

My code uses CHR$ a lot to encode the special characters since I switch between the 3DS and my PC where I use notepad++. Maybe I don't have to do this if I change the encoding but I haven't tried. ' GRAPHICS DEMO ' DRAWING LINES, PAINTING WITH LOWER SCREEN CLS : GCLS PNLTYPE "OFF" : REM HIDE KEYBOARD GPAGE 0 : REM STAY ON TOP SCREEN LOCATE 3,8: PRINT CHR$(152): LOCATE 26,8: PRINT CHR$(153) LOCATE 3,11: PRINT CHR$(150): LOCATE 26,11: PRINT CHR$(150) FOR I=0 TO 21: LOCATE 4+I,8: PRINT CHR$(149): NEXT LOCATE 3,12: PRINT CHR$(154): LOCATE 26,12: PRINT CHR$(155) FOR I=0 TO 21: LOCATE 4+I,12: PRINT CHR$(149): NEXT LOCATE 3,9: PRINT CHR$(150): LOCATE 9,9: PRINT "DRAWING DEMO":LOCATE 26,9: PRINT CHR$(150) LOCATE 3,10: PRINT CHR$(150): LOCATE 8,10: PRINT "A=CLEAR X=QUIT":LOCATE 26,10: PRINT CHR$(150) GPAGE 1 : REM SWITCH TO LOWER SCREEN & DRAW A BORDER FOR I = 0 TO 4 GLINE 0,0+I,256,0+I,15: GLINE 0+I,0,0+I,191,15 GLINE 253+I,0,253+I,191,15: GLINE 0,188+I,256,188+I,15 NEXT @LOOP IF BUTTON==64 THEN END IF BUTTON==16 THEN GFILL 5,5,252,187,16 'CHECK FOR TOUCH IF TCHST==0 THEN @LOOP IF (TCHX<10 OR TCHX > 250) OR (TCHY<10 OR TCHY>180) THEN @LOOP 'TRY AND MAKE LINE THICK WITH NO GAPS GPSET TCHX,TCHY,15 GFILL TCHX-1,TCHY-1,TCHX+1,TCHY+1,15 GOTO @LOOP

Blurry cam photo