mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2024-12-30 17:26:31 +00:00
22e3d8f06e
Remove some palettes. Add PaletteSetSlate. Change all gr_palette_std to gr32_palette_std. Change all CBGR48 to CBGR24.
317 lines
28 KiB
HTML
Executable file
317 lines
28 KiB
HTML
Executable file
<!DOCTYPE HTML>
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
|
|
<meta name="generator" content="ZealOS V0.11">
|
|
<style type="text/css">
|
|
body {background-color:#fef1f0;}
|
|
.cF0{color:#000000;background-color:#fef1f0;}
|
|
.cF1{color:#0148a4;background-color:#fef1f0;}
|
|
.cF2{color:#3b7901;background-color:#fef1f0;}
|
|
.cF3{color:#057c7e;background-color:#fef1f0;}
|
|
.cF4{color:#bb2020;background-color:#fef1f0;}
|
|
.cF5{color:#9e42ae;background-color:#fef1f0;}
|
|
.cF6{color:#b57901;background-color:#fef1f0;}
|
|
.cF7{color:#b2b6af;background-color:#fef1f0;}
|
|
.cF8{color:#555753;background-color:#fef1f0;}
|
|
.cF9{color:#678fbb;background-color:#fef1f0;}
|
|
.cFA{color:#82bc49;background-color:#fef1f0;}
|
|
.cFB{color:#0097a2;background-color:#fef1f0;}
|
|
.cFC{color:#e26a6a;background-color:#fef1f0;}
|
|
.cFD{color:#c671bc;background-color:#fef1f0;}
|
|
.cFE{color:#c7ab00;background-color:#fef1f0;}
|
|
.cFF{color:#fef1f0;background-color:#fef1f0;}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<pre style="font-family:monospace;font-size:12pt">
|
|
<a name="l1"></a><span class=cF2>//#define SQUARE_SIZE</span><span class=cF0> </span><span class=cF2>20</span><span class=cF0>
|
|
<a name="l2"></a></span><span class=cF2>//#define SQUARE_GAP</span><span class=cF0> </span><span class=cF2>5</span><span class=cF0>
|
|
<a name="l3"></a></span><span class=cF2>//#define SQUARE_DELAY</span><span class=cF0> </span><span class=cF2>5 // mS</span><span class=cF0>
|
|
<a name="l4"></a>
|
|
<a name="l5"></a></span><span class=cF2>// paint program globals</span><span class=cF0>
|
|
<a name="l6"></a></span><span class=cF1>class</span><span class=cF0> CPaint
|
|
<a name="l7"></a>{
|
|
<a name="l8"></a> </span><span class=cF2>// Image Framebuffer</span><span class=cF0>
|
|
<a name="l9"></a> </span><span class=cF9>U32</span><span class=cF0> *fb;
|
|
<a name="l10"></a>
|
|
<a name="l11"></a> </span><span class=cF2>// Brush</span><span class=cF0>
|
|
<a name="l12"></a> </span><span class=cF9>CBGR24</span><span class=cF0> color;
|
|
<a name="l13"></a> </span><span class=cF9>U64</span><span class=cF0> thick;
|
|
<a name="l14"></a> </span><span class=cF9>U64</span><span class=cF0> last_x;
|
|
<a name="l15"></a> </span><span class=cF9>U64</span><span class=cF0> last_y;
|
|
<a name="l16"></a> </span><span class=cF9>U64</span><span class=cF0> last_thick;
|
|
<a name="l17"></a>
|
|
<a name="l18"></a>} paint;
|
|
<a name="l19"></a>
|
|
<a name="l20"></a></span><span class=cF1>U0</span><span class=cF0> PaintGlobalsInit()
|
|
<a name="l21"></a>{
|
|
<a name="l22"></a> paint.fb = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cFB>text</span><span class=cF0>.buffer_size);
|
|
<a name="l23"></a> paint.thick = </span><span class=cFE>8</span><span class=cF0>;
|
|
<a name="l24"></a> paint.color = </span><span class=cF3>BLACK32</span><span class=cF0>;
|
|
<a name="l25"></a>
|
|
<a name="l26"></a> </span><span class=cF2>// last cursor position and size</span><span class=cF0>
|
|
<a name="l27"></a> paint.last_x = </span><span class=cFB>mouse</span><span class=cF0>.pos.x;
|
|
<a name="l28"></a> paint.last_y = </span><span class=cFB>mouse</span><span class=cF0>.pos.y;
|
|
<a name="l29"></a> paint.last_thick = paint.thick;
|
|
<a name="l30"></a>}
|
|
<a name="l31"></a>
|
|
<a name="l32"></a>
|
|
<a name="l33"></a></span><span class=cF1>I0</span><span class=cF0> DrawImagePixel(</span><span class=cF9>I64</span><span class=cF0> x, </span><span class=cF9>I64</span><span class=cF0> y, </span><span class=cF9>CBGR24</span><span class=cF0> color)
|
|
<a name="l34"></a>{
|
|
<a name="l35"></a> paint.fb[x + y * </span><span class=cF3>GR_WIDTH</span><span class=cF0>] = color;
|
|
<a name="l36"></a>}
|
|
<a name="l37"></a>
|
|
<a name="l38"></a></span><span class=cF1>I0</span><span class=cF0> DrawScreenPixel(</span><span class=cF9>I64</span><span class=cF0> x, </span><span class=cF9>I64</span><span class=cF0> y, </span><span class=cF9>CBGR24</span><span class=cF0> color)
|
|
<a name="l39"></a>{
|
|
<a name="l40"></a> </span><span class=cFB>text</span><span class=cF0>.fb_alias[x + y * </span><span class=cF3>GR_WIDTH</span><span class=cF0>] = color;
|
|
<a name="l41"></a>}
|
|
<a name="l42"></a>
|
|
<a name="l43"></a></span><span class=cF1>I0</span><span class=cF0> DrawScreenChar(</span><span class=cF9>I64</span><span class=cF0> x, </span><span class=cF9>I64</span><span class=cF0> y, </span><span class=cF9>I64</span><span class=cF0> char)
|
|
<a name="l44"></a>{
|
|
<a name="l45"></a> </span><span class=cF9>I64</span><span class=cF0> i, j;
|
|
<a name="l46"></a>
|
|
<a name="l47"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < </span><span class=cF3>FONT_HEIGHT</span><span class=cF0>; i++)
|
|
<a name="l48"></a> </span><span class=cF1>for</span><span class=cF0> (j = </span><span class=cFE>0</span><span class=cF0>; j < </span><span class=cF3>FONT_WIDTH</span><span class=cF0>; j++)
|
|
<a name="l49"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF7>(</span><span class=cFB>text</span><span class=cF0>.font[char] >> (i * </span><span class=cFE>8</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0> & </span><span class=cF7>(</span><span class=cFE>1</span><span class=cF0> << j</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l50"></a> DrawScreenPixel(x + j, y + i, </span><span class=cF3>BLACK32</span><span class=cF0>);
|
|
<a name="l51"></a>}
|
|
<a name="l52"></a>
|
|
<a name="l53"></a></span><span class=cF1>I0</span><span class=cF0> DrawScreenStr(</span><span class=cF9>I64</span><span class=cF0> x, </span><span class=cF9>I64</span><span class=cF0> y, </span><span class=cF1>U8</span><span class=cF0> *str)
|
|
<a name="l54"></a>{
|
|
<a name="l55"></a> </span><span class=cF9>I64</span><span class=cF0> c, i = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l56"></a>
|
|
<a name="l57"></a> </span><span class=cF1>while</span><span class=cF0> (c = *str++)
|
|
<a name="l58"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l59"></a> DrawScreenChar(x + </span><span class=cF7>(</span><span class=cF3>FONT_WIDTH</span><span class=cF0> * i++</span><span class=cF7>)</span><span class=cF0>, y, c);
|
|
<a name="l60"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l61"></a>}
|
|
<a name="l62"></a>
|
|
<a name="l63"></a></span><span class=cF1>I0</span><span class=cF0> DrawImageBrush(</span><span class=cF9>I64</span><span class=cF0> x, </span><span class=cF9>I64</span><span class=cF0> y, </span><span class=cF9>CBGR24</span><span class=cF0> color, </span><span class=cF9>I64</span><span class=cF0> thick)
|
|
<a name="l64"></a>{
|
|
<a name="l65"></a> </span><span class=cF9>I64</span><span class=cF0> i, j;
|
|
<a name="l66"></a>
|
|
<a name="l67"></a> </span><span class=cF1>for</span><span class=cF0> (i = x; i < x + thick; i++)
|
|
<a name="l68"></a> </span><span class=cF1>for</span><span class=cF0> (j = y; j < y + thick; j++)
|
|
<a name="l69"></a> DrawImagePixel(i, j, color);
|
|
<a name="l70"></a>}
|
|
<a name="l71"></a>
|
|
<a name="l72"></a></span><span class=cF1>I0</span><span class=cF0> DrawScreenBrush(</span><span class=cF9>I64</span><span class=cF0> x, </span><span class=cF9>I64</span><span class=cF0> y, </span><span class=cF9>CBGR24</span><span class=cF0> color, </span><span class=cF9>I64</span><span class=cF0> thick)
|
|
<a name="l73"></a>{
|
|
<a name="l74"></a> </span><span class=cF9>I64</span><span class=cF0> i, j;
|
|
<a name="l75"></a>
|
|
<a name="l76"></a> </span><span class=cF1>for</span><span class=cF0> (i = x; i < x + thick; i++)
|
|
<a name="l77"></a> </span><span class=cF1>for</span><span class=cF0> (j = y; j < y + thick; j++)
|
|
<a name="l78"></a> DrawScreenPixel(i, j, color);
|
|
<a name="l79"></a>
|
|
<a name="l80"></a> paint.last_x = x;
|
|
<a name="l81"></a> paint.last_y = y;
|
|
<a name="l82"></a> paint.last_thick = thick;
|
|
<a name="l83"></a>
|
|
<a name="l84"></a>}
|
|
<a name="l85"></a>
|
|
<a name="l86"></a></span><span class=cF1>U0</span><span class=cF0> PaintSaveImage()
|
|
<a name="l87"></a>{
|
|
<a name="l88"></a> </span><span class=cF1>U8</span><span class=cF0> *filename, *tmp;
|
|
<a name="l89"></a>
|
|
<a name="l90"></a> </span><span class=cFB>text</span><span class=cF0>.is_fb_busy = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l91"></a> </span><span class=cF5>LFBFlush</span><span class=cF0>;
|
|
<a name="l92"></a>
|
|
<a name="l93"></a> tmp = </span><span class=cF5>PopUpFileName</span><span class=cF0>(</span><span class=cF6>"~/"</span><span class=cF0>);
|
|
<a name="l94"></a> filename = </span><span class=cF5>ExtChange</span><span class=cF0>(tmp, </span><span class=cF6>"GR32"</span><span class=cF0>);</span><span class=cF2>// make sure file ends in .GR32</span><span class=cF0>
|
|
<a name="l95"></a> </span><span class=cF5>Free</span><span class=cF0>(tmp);
|
|
<a name="l96"></a> </span><span class=cF5>FileWrite</span><span class=cF0>(filename, paint.fb, </span><span class=cFB>text</span><span class=cF0>.buffer_size);
|
|
<a name="l97"></a> </span><span class=cF5>Free</span><span class=cF0>(filename);
|
|
<a name="l98"></a>
|
|
<a name="l99"></a> </span><span class=cFB>text</span><span class=cF0>.is_fb_busy = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l100"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(</span><span class=cFB>text</span><span class=cF0>.fb_alias, paint.fb, </span><span class=cFB>text</span><span class=cF0>.buffer_size);
|
|
<a name="l101"></a>
|
|
<a name="l102"></a>}
|
|
<a name="l103"></a>
|
|
<a name="l104"></a></span><span class=cF1>U0</span><span class=cF0> PaintLoadImage()
|
|
<a name="l105"></a>{
|
|
<a name="l106"></a> </span><span class=cF1>U8</span><span class=cF0> </span><span class=cFB>ext</span><span class=cF0>[</span><span class=cF3>STR_LEN</span><span class=cF0>],
|
|
<a name="l107"></a> *file,
|
|
<a name="l108"></a> filename[</span><span class=cF3>STR_LEN</span><span class=cF0>],
|
|
<a name="l109"></a> *file_image;
|
|
<a name="l110"></a>
|
|
<a name="l111"></a> </span><span class=cFB>text</span><span class=cF0>.is_fb_busy = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l112"></a> </span><span class=cF5>LFBFlush</span><span class=cF0>;
|
|
<a name="l113"></a>
|
|
<a name="l114"></a> </span><span class=cF5>PopUpOk</span><span class=cF0>(</span><span class=cF6>"Pick a .GR32 file to load.\n\n"</span><span class=cF0>
|
|
<a name="l115"></a> </span><span class=cF6>"(Double-click / ESC to pick.)"</span><span class=cF0>);
|
|
<a name="l116"></a>
|
|
<a name="l117"></a> </span><span class=cF1>do</span><span class=cF0>
|
|
<a name="l118"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l119"></a> file = </span><span class=cF5>PopUpPickFile</span><span class=cF0>(</span><span class=cF6>"~/"</span><span class=cF0>);
|
|
<a name="l120"></a> </span><span class=cF5>FileExtRemove</span><span class=cF0>(file, </span><span class=cFB>ext</span><span class=cF0>);
|
|
<a name="l121"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l122"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF5>StrCompare</span><span class=cF7>(</span><span class=cFB>ext</span><span class=cF0>, </span><span class=cF6>"GR32"</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l123"></a>
|
|
<a name="l124"></a> </span><span class=cF5>StrCopy</span><span class=cF0>(filename, file);
|
|
<a name="l125"></a> </span><span class=cF5>Free</span><span class=cF0>(file);
|
|
<a name="l126"></a> file = </span><span class=cF5>ExtDefault</span><span class=cF0>(filename, </span><span class=cF6>"GR32"</span><span class=cF0>);
|
|
<a name="l127"></a>
|
|
<a name="l128"></a> file_image = </span><span class=cF5>FileRead</span><span class=cF0>(file);
|
|
<a name="l129"></a> </span><span class=cF5>Free</span><span class=cF0>(file);
|
|
<a name="l130"></a>
|
|
<a name="l131"></a> </span><span class=cFB>text</span><span class=cF0>.is_fb_busy = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l132"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(paint.fb, file_image, </span><span class=cFB>text</span><span class=cF0>.buffer_size);
|
|
<a name="l133"></a> </span><span class=cF5>Free</span><span class=cF0>(file_image);
|
|
<a name="l134"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(</span><span class=cFB>text</span><span class=cF0>.fb_alias, paint.fb, </span><span class=cFB>text</span><span class=cF0>.buffer_size);
|
|
<a name="l135"></a>}
|
|
<a name="l136"></a>
|
|
<a name="l137"></a></span><span class=cF9>U32</span><span class=cF0> PaintImagePeek(</span><span class=cF9>I64</span><span class=cF0> x, </span><span class=cF9>I64</span><span class=cF0> y)
|
|
<a name="l138"></a>{
|
|
<a name="l139"></a> </span><span class=cF1>return</span><span class=cF0> paint.fb[x + y * </span><span class=cF3>GR_WIDTH</span><span class=cF0>];
|
|
<a name="l140"></a>}
|
|
<a name="l141"></a>
|
|
<a name="l142"></a></span><span class=cF1>I0</span><span class=cF0> Paint32()
|
|
<a name="l143"></a>{
|
|
<a name="l144"></a> </span><span class=cF9>I64</span><span class=cF0> sc, ch, i, j, sc_space = </span><span class=cF5>Char2ScanCode</span><span class=cF0>(</span><span class=cF3>CH_SPACE</span><span class=cF0>);
|
|
<a name="l145"></a> </span><span class=cF1>U8</span><span class=cF0> str_r[</span><span class=cF3>STR_LEN</span><span class=cF0>],
|
|
<a name="l146"></a> str_g[</span><span class=cF3>STR_LEN</span><span class=cF0>],
|
|
<a name="l147"></a> str_b[</span><span class=cF3>STR_LEN</span><span class=cF0>];
|
|
<a name="l148"></a>
|
|
<a name="l149"></a> </span><span class=cF5>SettingsPush</span><span class=cF0>; </span><span class=cF2>//See </span><a href="https://zeal-operating-system.github.io/ZealOS/System/TaskSettings.CC.html#l3"><span class=cF4>SettingsPush</span></a><span class=cF0>
|
|
<a name="l150"></a> </span><span class=cF5>AutoComplete</span><span class=cF0>;
|
|
<a name="l151"></a> </span><span class=cF5>WinBorder</span><span class=cF0>;
|
|
<a name="l152"></a> </span><span class=cF5>WinMax</span><span class=cF0>;
|
|
<a name="l153"></a> </span><span class=cF5>DocCursor</span><span class=cF0>;
|
|
<a name="l154"></a> </span><span class=cF5>DocClear</span><span class=cF0>;
|
|
<a name="l155"></a> </span><span class=cF5>MenuPush</span><span class=cF0>(</span><span class=cF6>""</span><span class=cF0>);
|
|
<a name="l156"></a>
|
|
<a name="l157"></a> </span><span class=cF5>PopUpOk</span><span class=cF0>(</span><span class=cF6>"\n"</span><span class=cF0>
|
|
<a name="l158"></a> </span><span class=cF6>"$GREEN$0-9$FG$ to get colors from current palette.\n"</span><span class=cF0>
|
|
<a name="l159"></a> </span><span class=cF6>"$GREEN$R, G, or B$FG$ to increase color values.\n"</span><span class=cF0>
|
|
<a name="l160"></a> </span><span class=cF6>"$GREEN$Shift-R, Shift-G, or Shift-B$FG$ to decrease.\n"</span><span class=cF0>
|
|
<a name="l161"></a> </span><span class=cF6>"$GREEN$+ or -$FG$ to change brush size.\n"</span><span class=cF0>
|
|
<a name="l162"></a> </span><span class=cF6>"$GREEN$Alt$FG$ to peek (eyedropper) color under brush.\n\n"</span><span class=cF0>
|
|
<a name="l163"></a> </span><span class=cF6>"$BLUE$Ctrl-S$FG$ to save image.\n"</span><span class=cF0>
|
|
<a name="l164"></a> </span><span class=cF6>"$BLUE$Ctrl-L$FG$ to load image.\n\n"</span><span class=cF0>
|
|
<a name="l165"></a> </span><span class=cF6>"$GREEN$Left-click or SPACE$FG$ to draw.\n\n"</span><span class=cF0>
|
|
<a name="l166"></a> </span><span class=cF6>"$RED$ENTER$FG$ to clear image.\n"</span><span class=cF0>
|
|
<a name="l167"></a> </span><span class=cF6>"$RED$Shift-Esc or Double Right-Click$FG$ to exit."</span><span class=cF0>);
|
|
<a name="l168"></a> </span><span class=cF5>Sleep</span><span class=cF0>(</span><span class=cFE>250</span><span class=cF0>); </span><span class=cF2>// help ensure SPACE press doesn't draw early</span><span class=cF0>
|
|
<a name="l169"></a>
|
|
<a name="l170"></a> </span><span class=cFB>text</span><span class=cF0>.is_fb_busy = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l171"></a> </span><span class=cF5>MemSet</span><span class=cF0>(</span><span class=cFB>text</span><span class=cF0>.fb_alias, </span><span class=cF3>WHITE32</span><span class=cF0>, </span><span class=cFB>text</span><span class=cF0>.buffer_size);
|
|
<a name="l172"></a> </span><span class=cF5>MemSet</span><span class=cF0>(paint.fb, </span><span class=cF3>WHITE32</span><span class=cF0>, </span><span class=cFB>text</span><span class=cF0>.buffer_size);
|
|
<a name="l173"></a>
|
|
<a name="l174"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>)
|
|
<a name="l175"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l176"></a> </span><span class=cF2>// draw the image where the brush was last covering it</span><span class=cF0>
|
|
<a name="l177"></a> </span><span class=cF1>for</span><span class=cF0> (i = paint.last_x; i < paint.last_x + paint.last_thick; i++)
|
|
<a name="l178"></a> </span><span class=cF1>for</span><span class=cF0> (j = paint.last_y; j < paint.last_y + paint.last_thick; j++)
|
|
<a name="l179"></a> DrawScreenPixel(i, j, paint.fb[i + j * </span><span class=cF3>GR_WIDTH</span><span class=cF0>]);
|
|
<a name="l180"></a>
|
|
<a name="l181"></a> </span><span class=cF2>// draw the brush on the screen</span><span class=cF0>
|
|
<a name="l182"></a> DrawScreenBrush(</span><span class=cFB>mouse</span><span class=cF0>.pos.x, </span><span class=cFB>mouse</span><span class=cF0>.pos.y, paint.color, paint.thick);
|
|
<a name="l183"></a>
|
|
<a name="l184"></a> </span><span class=cF2>// if clicked, draw brush on the image</span><span class=cF0>
|
|
<a name="l185"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFB>mouse</span><span class=cF0>.lb || </span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cFB>kbd</span><span class=cF0>.down_bitmap, sc_space</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l186"></a> DrawImageBrush(</span><span class=cFB>mouse</span><span class=cF0>.pos.x, </span><span class=cFB>mouse</span><span class=cF0>.pos.y, paint.color, paint.thick);
|
|
<a name="l187"></a>
|
|
<a name="l188"></a> </span><span class=cF2>// build the color strings (U8[], no MAlloc)</span><span class=cF0>
|
|
<a name="l189"></a> </span><span class=cF5>StrPrint</span><span class=cF0>(str_r, </span><span class=cF6>"Red: %d"</span><span class=cF0>, paint.color.r);
|
|
<a name="l190"></a> </span><span class=cF5>StrPrint</span><span class=cF0>(str_g, </span><span class=cF6>"Green: %d"</span><span class=cF0>, paint.color.g);
|
|
<a name="l191"></a> </span><span class=cF5>StrPrint</span><span class=cF0>(str_b, </span><span class=cF6>"Blue: %d"</span><span class=cF0>, paint.color.b);
|
|
<a name="l192"></a>
|
|
<a name="l193"></a> </span><span class=cF2>// draw the image where the color strings where covering it </span><span class=cF0>
|
|
<a name="l194"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < </span><span class=cFE>3</span><span class=cF0> * </span><span class=cF3>FONT_HEIGHT</span><span class=cF0>; i++)
|
|
<a name="l195"></a> </span><span class=cF1>for</span><span class=cF0> (j = </span><span class=cFE>0</span><span class=cF0>; j < </span><span class=cFE>12</span><span class=cF0> * </span><span class=cF3>FONT_WIDTH</span><span class=cF0>; j++)
|
|
<a name="l196"></a> DrawScreenPixel(j, i, paint.fb[j + i * </span><span class=cF3>GR_WIDTH</span><span class=cF0>]);
|
|
<a name="l197"></a>
|
|
<a name="l198"></a> </span><span class=cF2>// draw the color strings on screen</span><span class=cF0>
|
|
<a name="l199"></a> DrawScreenStr(</span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0> * </span><span class=cF3>FONT_HEIGHT</span><span class=cF0>, str_r);
|
|
<a name="l200"></a> DrawScreenStr(</span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>1</span><span class=cF0> * </span><span class=cF3>FONT_HEIGHT</span><span class=cF0>, str_g);
|
|
<a name="l201"></a> DrawScreenStr(</span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>2</span><span class=cF0> * </span><span class=cF3>FONT_HEIGHT</span><span class=cF0>, str_b);
|
|
<a name="l202"></a>
|
|
<a name="l203"></a> </span><span class=cF2>// 60fps wait</span><span class=cF0>
|
|
<a name="l204"></a> </span><span class=cF5>Refresh</span><span class=cF0>;
|
|
<a name="l205"></a>
|
|
<a name="l206"></a> </span><span class=cF2>// Get key, process</span><span class=cF0>
|
|
<a name="l207"></a> </span><span class=cF5>KeyScan</span><span class=cF0>(&ch, &sc);
|
|
<a name="l208"></a> </span><span class=cF1>switch</span><span class=cF0> (ch)
|
|
<a name="l209"></a> {
|
|
<a name="l210"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>:
|
|
<a name="l211"></a> </span><span class=cF1>switch</span><span class=cF0> (sc.u8[</span><span class=cFE>0</span><span class=cF0>])
|
|
<a name="l212"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l213"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_ALT</span><span class=cF0>:
|
|
<a name="l214"></a> paint.color = PaintImagePeek(</span><span class=cFB>mouse</span><span class=cF0>.pos.x, </span><span class=cFB>mouse</span><span class=cF0>.pos.y);
|
|
<a name="l215"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l216"></a>
|
|
<a name="l217"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_CURSOR_LEFT</span><span class=cF0>:
|
|
<a name="l218"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l219"></a>
|
|
<a name="l220"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_CURSOR_RIGHT</span><span class=cF0>:
|
|
<a name="l221"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l222"></a>
|
|
<a name="l223"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_CURSOR_UP</span><span class=cF0>:
|
|
<a name="l224"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l225"></a>
|
|
<a name="l226"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_CURSOR_DOWN</span><span class=cF0>:
|
|
<a name="l227"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l228"></a>
|
|
<a name="l229"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l230"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l231"></a>
|
|
<a name="l232"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'+'</span><span class=cF0>:
|
|
<a name="l233"></a> paint.thick++;
|
|
<a name="l234"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l235"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'-'</span><span class=cF0>:
|
|
<a name="l236"></a> paint.thick--;
|
|
<a name="l237"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l238"></a>
|
|
<a name="l239"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'r'</span><span class=cF0>:
|
|
<a name="l240"></a> paint.color.r++;
|
|
<a name="l241"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l242"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'g'</span><span class=cF0>:
|
|
<a name="l243"></a> paint.color.g++;
|
|
<a name="l244"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l245"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'b'</span><span class=cF0>:
|
|
<a name="l246"></a> paint.color.b++;
|
|
<a name="l247"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l248"></a>
|
|
<a name="l249"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'R'</span><span class=cF0>:
|
|
<a name="l250"></a> paint.color.r--;
|
|
<a name="l251"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l252"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'G'</span><span class=cF0>:
|
|
<a name="l253"></a> paint.color.g--;
|
|
<a name="l254"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l255"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'B'</span><span class=cF0>:
|
|
<a name="l256"></a> paint.color.b--;
|
|
<a name="l257"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l258"></a>
|
|
<a name="l259"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'0'</span><span class=cF0>...</span><span class=cF6>'9'</span><span class=cF0>:
|
|
<a name="l260"></a> paint.color = </span><span class=cFB>gr_palette</span><span class=cF0>[ch - </span><span class=cF6>'0'</span><span class=cF0>];
|
|
<a name="l261"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l262"></a>
|
|
<a name="l263"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'\n'</span><span class=cF0>:
|
|
<a name="l264"></a> </span><span class=cF5>MemSet</span><span class=cF0>(paint.fb, </span><span class=cF3>WHITE32</span><span class=cF0>, </span><span class=cFB>text</span><span class=cF0>.buffer_size);
|
|
<a name="l265"></a> </span><span class=cF5>MemSet</span><span class=cF0>(</span><span class=cFB>text</span><span class=cF0>.fb_alias, </span><span class=cF3>WHITE32</span><span class=cF0>, </span><span class=cFB>text</span><span class=cF0>.buffer_size);
|
|
<a name="l266"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l267"></a>
|
|
<a name="l268"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_CTRLS</span><span class=cF0>:
|
|
<a name="l269"></a> PaintSaveImage;
|
|
<a name="l270"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l271"></a>
|
|
<a name="l272"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_CTRLL</span><span class=cF0>:
|
|
<a name="l273"></a> PaintLoadImage;
|
|
<a name="l274"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l275"></a>
|
|
<a name="l276"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_SHIFT_ESC</span><span class=cF0>:
|
|
<a name="l277"></a> </span><span class=cF1>goto</span><span class=cF0> paint_done;
|
|
<a name="l278"></a> }
|
|
<a name="l279"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l280"></a>
|
|
<a name="l281"></a>paint_done:
|
|
<a name="l282"></a> </span><span class=cFB>text</span><span class=cF0>.is_fb_busy = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l283"></a> </span><span class=cF5>LFBFlush</span><span class=cF0>;
|
|
<a name="l284"></a> </span><span class=cF5>SettingsPop</span><span class=cF0>;
|
|
<a name="l285"></a> </span><span class=cF5>MenuPop</span><span class=cF0>;
|
|
<a name="l286"></a>}
|
|
<a name="l287"></a>
|
|
<a name="l288"></a>PaintGlobalsInit;
|
|
<a name="l289"></a>Paint32;</span></pre></body>
|
|
</html>
|