? Using the graphics pages to store data (Page 1) ● SmileBASIC Source Forums

Sign In

Register
*Usernames are case-sensitive
Forgot my password

Using the graphics pages to store data

  • #1 ✎ 286 MZ952 Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Drawing I like to draw! Hobbies Reading I like to read books! Hobbies OPTION STRICT OPTION DEFINT DEF WR _N,X,Y DIM A,R,G,B,N=ABS(_N) A=(SGN(_N)==-1) R=N DIV 31 DIV 31*8 G=N DIV 31 MOD 31*8 B=N MOD 31*8 GPSET X,Y,RGB(A,R,G,B) END DEF RD(X,Y) DIM A,R,G,B,N RGBREAD GSPOIT(X,Y) OUT A,R,G,B N=R/8*31*31+G/8*31+B/8 IF A THEN N=N*-1 ENDIF RETURN N END I never really bothered screwing around with color codes and color conversion before. This method covers the integers from -30751 to 30751. Is there a better way? Posted Edited by MZ952
  • #2 ✎ 1818 12Me21 Syntax Highlighter Received for creating the code syntax highlighter on SBS Night Person I like the quiet night and sleep late. Express Yourself Just use GSAVE/GLOAD with the color conversion flag turned off, to read/write raw 16 bit data. Posted Edited by 12Me21
  • #3 ✎ 286 MZ952 Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Drawing I like to draw! Hobbies Reading I like to read books! Hobbies Lol nice. SB should have a function to toggle color conversion with graphic functions. The graphics screen can't store 32 bit values, can it? So, what is color conversion really for? Posted Edited by MZ952
  • #4 ✎ 1818 12Me21 Syntax Highlighter Received for creating the code syntax highlighter on SBS Night Person I like the quiet night and sleep late. Express Yourself It's so you can use normal 32 bit color codes for everything. Posted