mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2024-12-29 16:56:30 +00:00
dbf8647d59
Added top & right borders to RawDr. Improved spacing in some debug and compiler reporting. Fixed RawPutChar and EdLite tab width. Fixed Ui missing '0x' prefix syntax highlighter bug. Added 32BitPaint demo.
131 lines
12 KiB
HTML
Executable file
131 lines
12 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.08">
|
|
<style type="text/css">
|
|
body {background-color:#000000;}
|
|
.cF0{color:#ffffff;background-color:#000000;}
|
|
.cF1{color:#3465a4;background-color:#000000;}
|
|
.cF2{color:#4e9a06;background-color:#000000;}
|
|
.cF3{color:#06989a;background-color:#000000;}
|
|
.cF4{color:#a24444;background-color:#000000;}
|
|
.cF5{color:#75507b;background-color:#000000;}
|
|
.cF6{color:#ce982f;background-color:#000000;}
|
|
.cF7{color:#bcc0b9;background-color:#000000;}
|
|
.cF8{color:#555753;background-color:#000000;}
|
|
.cF9{color:#729fcf;background-color:#000000;}
|
|
.cFA{color:#82bc49;background-color:#000000;}
|
|
.cFB{color:#34e2e2;background-color:#000000;}
|
|
.cFC{color:#ac3535;background-color:#000000;}
|
|
.cFD{color:#ad7fa8;background-color:#000000;}
|
|
.cFE{color:#fce94f;background-color:#000000;}
|
|
.cFF{color:#000000;background-color:#000000;}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<pre style="font-family:monospace;font-size:12pt">
|
|
<a name="l1"></a><span class=cF0>#</span><span class=cF1>define</span><span class=cF0> USE_JIFFIES </span><span class=cF3>TRUE</span><span class=cF0> </span><span class=cF2>// Set FALSE for less smooth but more accurate time.</span><span class=cF0>
|
|
<a name="l2"></a>
|
|
<a name="l3"></a>#</span><span class=cF1>define</span><span class=cF0> CLOCK_CENTER </span><span class=cFE>70</span><span class=cF0>
|
|
<a name="l4"></a>#</span><span class=cF1>define</span><span class=cF0> CLOCK_RADIUS (CLOCK_CENTER-</span><span class=cFE>2</span><span class=cF0>)
|
|
<a name="l5"></a>
|
|
<a name="l6"></a>#</span><span class=cF1>define</span><span class=cF0> SECOND_HAND_LEN CLOCK_RADIUS
|
|
<a name="l7"></a>#</span><span class=cF1>define</span><span class=cF0> MINUTE_HAND_LEN </span><span class=cFE>8</span><span class=cF0> * CLOCK_RADIUS / </span><span class=cFE>10</span><span class=cF0>
|
|
<a name="l8"></a>#</span><span class=cF1>define</span><span class=cF0> HOUR_HAND_LEN CLOCK_RADIUS / </span><span class=cFE>2</span><span class=cF0>
|
|
<a name="l9"></a>
|
|
<a name="l10"></a>#</span><span class=cF1>define</span><span class=cF0> CLOCK_BASE_COLOR </span><span class=cF3>BLACK</span><span class=cF0>
|
|
<a name="l11"></a>#</span><span class=cF1>define</span><span class=cF0> SECOND_HAND_COLOR </span><span class=cF3>DKGRAY</span><span class=cF0>
|
|
<a name="l12"></a>#</span><span class=cF1>define</span><span class=cF0> MINUTE_HAND_COLOR </span><span class=cF3>DKGRAY</span><span class=cF0>
|
|
<a name="l13"></a>#</span><span class=cF1>define</span><span class=cF0> HOUR_HAND_COLOR </span><span class=cF3>BLACK</span><span class=cF0>
|
|
<a name="l14"></a>
|
|
<a name="l15"></a></span><span class=cF2>// set this either 24 or 12</span><span class=cF0>
|
|
<a name="l16"></a>#</span><span class=cF1>define</span><span class=cF0> HOUR_MAX </span><span class=cFE>12</span><span class=cF0>
|
|
<a name="l17"></a>
|
|
<a name="l18"></a>#</span><span class=cF1>define</span><span class=cF0> . </span><span class=cFE>2</span><span class=cF0>*</span><span class=cF3>pi</span><span class=cF0>
|
|
<a name="l19"></a>
|
|
<a name="l20"></a>
|
|
<a name="l21"></a></span><span class=cF2>//EST NY -> India:</span><span class=cF0> </span><span class=cF2> 9.5</span><span class=cF0>
|
|
<a name="l22"></a></span><span class=cF2>//EST NY -> China:</span><span class=cF0> </span><span class=cF2> 12</span><span class=cF0>
|
|
<a name="l23"></a></span><span class=cF9>CDate</span><span class=cF0> clock_time_offset = </span><span class=cFE>0</span><span class=cF0> * </span><span class=cFE>60</span><span class=cF0> * </span><span class=cFE>60</span><span class=cF0> * </span><span class=cF3>CDATE_FREQ</span><span class=cF0>;
|
|
<a name="l24"></a>
|
|
<a name="l25"></a></span><span class=cF9>CDateStruct</span><span class=cF0> *ds = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CDateStruct</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l26"></a></span><span class=cF9>CDate</span><span class=cF0> d = </span><span class=cF5>Now</span><span class=cF0> + clock_time_offset;
|
|
<a name="l27"></a></span><span class=cF5>Date2Struct</span><span class=cF0>(ds, d);
|
|
<a name="l28"></a></span><span class=cF9>I64</span><span class=cF0> init_jiff = </span><span class=cFB>counts</span><span class=cF0>.jiffies;
|
|
<a name="l29"></a></span><span class=cF9>I64</span><span class=cF0> cur_jiff;
|
|
<a name="l30"></a></span><span class=cF1>F64</span><span class=cF0> sec, min, hr;
|
|
<a name="l31"></a>
|
|
<a name="l32"></a></span><span class=cF1>U0</span><span class=cF0> ClockDrawIt(</span><span class=cF9>CTask</span><span class=cF0> *, </span><span class=cF9>CDC</span><span class=cF0> *dc)
|
|
<a name="l33"></a>{
|
|
<a name="l34"></a> </span><span class=cF1>if</span><span class=cF0> (USE_JIFFIES)
|
|
<a name="l35"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l36"></a> cur_jiff = </span><span class=cFB>counts</span><span class=cF0>.jiffies - init_jiff;
|
|
<a name="l37"></a> sec = ds->sec + cur_jiff/</span><span class=cFE>1000</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l38"></a> min = ds->min + cur_jiff/</span><span class=cFE>1000</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>/</span><span class=cFE>60</span><span class=cF0>;
|
|
<a name="l39"></a> hr = (ds->hour % HOUR_MAX) + cur_jiff/</span><span class=cFE>1000</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>/</span><span class=cFE>60</span><span class=cF0>/</span><span class=cFE>60</span><span class=cF0>;
|
|
<a name="l40"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l41"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l42"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l43"></a> d = </span><span class=cF5>Now</span><span class=cF0> + clock_time_offset;
|
|
<a name="l44"></a> </span><span class=cF5>Date2Struct</span><span class=cF0>(ds, d);
|
|
<a name="l45"></a> sec = ds->sec;
|
|
<a name="l46"></a> min = ds->min;
|
|
<a name="l47"></a> hr = ds->hour % HOUR_MAX;
|
|
<a name="l48"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l49"></a></span><span class=cF2>/*</span><span class=cF0>
|
|
<a name="l50"></a>
|
|
<a name="l51"></a></span><span class=cF2>public Bool GrLine3(CDC *dc=gr.dc,I64 x1,I64 y1,I64 z1,</span><span class=cF0>
|
|
<a name="l52"></a> </span><span class=cF2> I64 x2,</span><span class=cF0>
|
|
<a name="l53"></a> </span><span class=cF2> I64 y2,</span><span class=cF0>
|
|
<a name="l54"></a> </span><span class=cF2> I64 z2, I64 step=1,I64 start=0)</span><span class=cF0>
|
|
<a name="l55"></a></span><span class=cF2>*/</span><span class=cF0>
|
|
<a name="l56"></a> </span><span class=cF2>//draw second hand</span><span class=cF0>
|
|
<a name="l57"></a> dc->thick = </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l58"></a> dc->color = SECOND_HAND_COLOR;
|
|
<a name="l59"></a> </span><span class=cF5>GrLine3</span><span class=cF0>(dc, CLOCK_CENTER, CLOCK_CENTER, </span><span class=cF3>GR_Z_ALL</span><span class=cF0>,
|
|
<a name="l60"></a> </span><span class=cF7>(</span><span class=cF0>CLOCK_CENTER + SECOND_HAND_LEN * </span><span class=cF5>Cos</span><span class=cF0>(</span><span class=cFE>3</span><span class=cF0>*./</span><span class=cFE>4</span><span class=cF0> + sec * ./</span><span class=cFE>60</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0>,
|
|
<a name="l61"></a> </span><span class=cF7>(</span><span class=cF0>CLOCK_CENTER + SECOND_HAND_LEN * </span><span class=cF5>Sin</span><span class=cF0>(</span><span class=cFE>3</span><span class=cF0>*./</span><span class=cFE>4</span><span class=cF0> + sec * ./</span><span class=cFE>60</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0>,
|
|
<a name="l62"></a> </span><span class=cF3>GR_Z_ALL</span><span class=cF0>);
|
|
<a name="l63"></a>
|
|
<a name="l64"></a> </span><span class=cF2>// draw minute hand</span><span class=cF0>
|
|
<a name="l65"></a> dc->thick = </span><span class=cFE>2</span><span class=cF0>;
|
|
<a name="l66"></a> dc->color = MINUTE_HAND_COLOR;
|
|
<a name="l67"></a> </span><span class=cF5>GrLine3</span><span class=cF0>(dc, CLOCK_CENTER, CLOCK_CENTER, </span><span class=cF3>GR_Z_ALL</span><span class=cF0>,
|
|
<a name="l68"></a> </span><span class=cF7>(</span><span class=cF0>CLOCK_CENTER + MINUTE_HAND_LEN * </span><span class=cF5>Cos</span><span class=cF0>(</span><span class=cFE>3</span><span class=cF0>*./</span><span class=cFE>4</span><span class=cF0> + min * ./</span><span class=cFE>60</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0>,
|
|
<a name="l69"></a> </span><span class=cF7>(</span><span class=cF0>CLOCK_CENTER + MINUTE_HAND_LEN * </span><span class=cF5>Sin</span><span class=cF0>(</span><span class=cFE>3</span><span class=cF0>*./</span><span class=cFE>4</span><span class=cF0> + min * ./</span><span class=cFE>60</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0>,
|
|
<a name="l70"></a> </span><span class=cF3>GR_Z_ALL</span><span class=cF0>);
|
|
<a name="l71"></a>
|
|
<a name="l72"></a> </span><span class=cF2>// draw hour hand</span><span class=cF0>
|
|
<a name="l73"></a> dc->thick = </span><span class=cFE>3</span><span class=cF0>;
|
|
<a name="l74"></a> dc->color = HOUR_HAND_COLOR;
|
|
<a name="l75"></a> </span><span class=cF5>GrLine3</span><span class=cF0>(dc, CLOCK_CENTER, CLOCK_CENTER, </span><span class=cF3>GR_Z_ALL</span><span class=cF0>,
|
|
<a name="l76"></a> </span><span class=cF7>(</span><span class=cF0>CLOCK_CENTER + HOUR_HAND_LEN * </span><span class=cF5>Cos</span><span class=cF0>(</span><span class=cFE>3</span><span class=cF0>*./</span><span class=cFE>4</span><span class=cF0> + hr * ./HOUR_MAX)</span><span class=cF7>)</span><span class=cF0>,
|
|
<a name="l77"></a> </span><span class=cF7>(</span><span class=cF0>CLOCK_CENTER + HOUR_HAND_LEN * </span><span class=cF5>Sin</span><span class=cF0>(</span><span class=cFE>3</span><span class=cF0>*./</span><span class=cFE>4</span><span class=cF0> + hr * ./HOUR_MAX)</span><span class=cF7>)</span><span class=cF0>,
|
|
<a name="l78"></a> </span><span class=cF3>GR_Z_ALL</span><span class=cF0>);
|
|
<a name="l79"></a>
|
|
<a name="l80"></a>
|
|
<a name="l81"></a> dc->color = CLOCK_BASE_COLOR;
|
|
<a name="l82"></a> </span><span class=cF2>//GrPrint(dc, 0, 0, "%d", ds->sec);</span><span class=cF0>
|
|
<a name="l83"></a>
|
|
<a name="l84"></a> </span><span class=cF2>//draw clock base</span><span class=cF0>
|
|
<a name="l85"></a> </span><span class=cF5>GrCircle</span><span class=cF0>(dc, CLOCK_CENTER, CLOCK_CENTER, CLOCK_RADIUS);
|
|
<a name="l86"></a>
|
|
<a name="l87"></a>}
|
|
<a name="l88"></a>
|
|
<a name="l89"></a></span><span class=cF1>U0</span><span class=cF0> ClockDemo()
|
|
<a name="l90"></a>{
|
|
<a name="l91"></a> </span><span class=cF5>SettingsPush</span><span class=cF0>;
|
|
<a name="l92"></a> </span><span class=cF5>DocClear</span><span class=cF0>;
|
|
<a name="l93"></a> </span><span class=cF5>DocCursor</span><span class=cF0>;
|
|
<a name="l94"></a> </span><span class=cF5>Fs</span><span class=cF0>->draw_it = &ClockDrawIt;
|
|
<a name="l95"></a> </span><span class=cF5>StrCopy</span><span class=cF0>(</span><span class=cF5>Fs</span><span class=cF0>->task_title, </span><span class=cF6>"Time"</span><span class=cF0>);
|
|
<a name="l96"></a>
|
|
<a name="l97"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF5>CharGet</span><span class=cF7>(</span><span class=cF0>,</span><span class=cF3>FALSE</span><span class=cF7>)</span><span class=cF0> != </span><span class=cF3>CH_SHIFT_ESC</span><span class=cF0>) </span><span class=cF7>{}</span><span class=cF0>;
|
|
<a name="l98"></a>
|
|
<a name="l99"></a> </span><span class=cF5>SettingsPop</span><span class=cF0>;
|
|
<a name="l100"></a>};
|
|
<a name="l101"></a>
|
|
<a name="l102"></a>ClockDemo;
|
|
</span></pre></body>
|
|
</html>
|