<aname="l3"></a>Dive into </span><ahref="https://tomawezome.github.io/ZealOS/Doc/DemoIndex.DD.html#l1"><spanclass=cF4>Demo Index</span></a><spanclass=cF0> to learn.
<aname="l45"></a>* See </span><ahref="https://tomawezome.github.io/ZealOS/System/Gr/GrScreen.CC.html#l415"><spanclass=cF4>GrUpdateScreen</span></a><spanclass=cF0>(), </span><ahref="https://tomawezome.github.io/ZealOS/System/Gr/GrScreen.CC.html#l69"><spanclass=cF4>GrUpdateTasks</span></a><spanclass=cF0>() and </span><ahref="https://tomawezome.github.io/ZealOS/System/Gr/GrScreen.CC.html#l19"><spanclass=cF4>GrUpdateTaskWin</span></a><spanclass=cF0>() called by the WinMgr task 60fps. Notice the task's </span><ahref="https://tomawezome.github.io/ZealOS/System/Gr/GrScreen.CC.html#l41"><spanclass=cF4>draw_it</span></a><spanclass=cF0>()
<aname="l46"></a>callback being called. Only tasks on </span><spanclass=cF2>Core0</span><spanclass=cF0> are allowed to have windows. There is one window per task, no child windows.
<aname="l49"></a>* </span><ahref="https://tomawezome.github.io/ZealOS/Kernel/KernelA.HH.html#l4263"><spanclass=cF4>CDC</span></a><spanclass=cF0>s (device contexts) are a data type for controlling graphics on the screen or graphics in mem. The device context
<aname="l50"></a>structure has thick and color. You use </span><ahref="https://tomawezome.github.io/ZealOS/System/Gr/GrDC.CC.html#l182"><spanclass=cF4>DCAlias</span></a><spanclass=cF0>() to create your own structure, with its own color and thick. Free it with </span><spanclass=cF4>
<aname="l51"></a></span><ahref="https://tomawezome.github.io/ZealOS/System/Gr/GrDC.CC.html#l230"><spanclass=cF4>DCDel</span></a><spanclass=cF0>() when finished.
<aname="l53"></a>* </span><spanclass=cF4>gr.dc</span><spanclass=cF0> is a device context for persistent data on the screen, not needing to be redrawn. You create an alias for this by
<aname="l54"></a>using </span><ahref="https://tomawezome.github.io/ZealOS/System/Gr/GrDC.CC.html#l182"><spanclass=cF4>DCAlias</span></a><spanclass=cF0>() and work with that. See </span><ahref="https://tomawezome.github.io/ZealOS/Demo/Graphics/NetOfDots.CC.html#l1"><spanclass=cF4>::/Demo/Graphics/NetOfDots.CC</span></a><spanclass=cF0>.
<aname="l56"></a>* There are various flavors of line and point plotting routines. </span><ahref="https://tomawezome.github.io/ZealOS/System/Gr/GrPrimatives.CC.html#l663"><spanclass=cF4>GrLine</span></a><spanclass=cF0>() and </span><ahref="https://tomawezome.github.io/ZealOS/System/Gr/GrPrimatives.CC.html#l61"><spanclass=cF4>GrPlot</span></a><spanclass=cF0>() are the simplest. The others allow
<aname="l59"></a>* See </span><ahref="https://tomawezome.github.io/ZealOS/Doc/Transform.DD.html#l1"><spanclass=cF4>::/Doc/Transform.DD</span></a><spanclass=cF0> for adding a transformation.
<aname="l61"></a>* You change the </span><spanclass=cF2>Fs->draw_it</span><spanclass=cF0> var to point to your </span><spanclass=cF2>DrawIt()</span><spanclass=cF0> function which gets called each screen refresh (60 fps). You draw
<aname="l62"></a>everything in the window over and over again. See </span><ahref="https://tomawezome.github.io/ZealOS/Demo/Graphics/Box.CC.html#l1"><spanclass=cF4>::/Demo/Graphics/Box.CC</span></a><spanclass=cF0>.
<aname="l64"></a>* Use the graphic sprite resource editor, </span><spanclass=cF2><CTRL-r></span><spanclass=cF0>, to create a sprite that can be plotted with </span><ahref="https://tomawezome.github.io/ZealOS/System/Gr/GrSpritePlot.CC.html#l18"><spanclass=cF4>Sprite3</span></a><spanclass=cF0>() or output to the cmd
<aname="l65"></a>line with </span><ahref="https://tomawezome.github.io/ZealOS/System/Gr/GrSpritePlot.CC.html#l536"><spanclass=cF4>Sprite</span></a><spanclass=cF0>(). Use </span><spanclass=cF2>$IB,"",BI=1$</span><spanclass=cF0> in a src program to insert the addr of sprite binary data item #1. To learn how the
<aname="l66"></a>numbers work, after creating a sprite with </span><spanclass=cF2><CTRL-r></span><spanclass=cF0>, toggle to plain text with </span><spanclass=cF2><CTRL-t></span><spanclass=cF0> and check its num. Make an assignment
<aname="l67"></a>to a ptr var or pass to </span><ahref="https://tomawezome.github.io/ZealOS/System/Gr/GrSpritePlot.CC.html#l18"><spanclass=cF4>Sprite3</span></a><spanclass=cF0>() with </span><spanclass=cF2>$IB,"",BI=n$</span><spanclass=cF0>. Use </span><spanclass=cF2><CTRL-r></span><spanclass=cF0>'s "Pointer to Sprite" to make a </span><spanclass=cF2>$IB...$</span><spanclass=cF0> entry. See </span><spanclass=cF4>
<aname="l68"></a></span><ahref="https://tomawezome.github.io/ZealOS/Demo/Graphics/SpritePlot.CC.html#l1"><spanclass=cF4>::/Demo/Graphics/SpritePlot.CC</span></a><spanclass=cF0> and </span><ahref="https://tomawezome.github.io/ZealOS/Demo/Graphics/SpritePlot3D.CC.html#l1"><spanclass=cF4>::/Demo/Graphics/SpritePlot3D.CC</span></a><spanclass=cF0>. The origin (zero point) for a sprite is defined by the
<aname="l69"></a>cursor location when you pressed </span><spanclass=cF2><CTRL-r></span><spanclass=cF0> to make it. You can edit a sprite by clicking the cursor on it and pressing </span><spanclass=cF2><CTRL-r
<aname="l72"></a>* Set </span><ahref="https://tomawezome.github.io/ZealOS/Kernel/KernelA.HH.html#l4237"><spanclass=cF4>DCF_SYMMETRY</span></a><spanclass=cF0> in the </span><ahref="https://tomawezome.github.io/ZealOS/Kernel/KernelA.HH.html#l4263"><spanclass=cF4>CDC</span></a><spanclass=cF2>.flags</span><spanclass=cF0> and call </span><ahref="https://tomawezome.github.io/ZealOS/System/Gr/GrMath.CC.html#l236"><spanclass=cF4>DCSymmetrySet</span></a><spanclass=cF0>() or </span><ahref="https://tomawezome.github.io/ZealOS/System/Gr/GrMath.CC.html#l259"><spanclass=cF4>DCSymmetry3Set</span></a><spanclass=cF0>(). This will plot a mirror image in addition
<aname="l73"></a>to the primary image. Set </span><ahref="https://tomawezome.github.io/ZealOS/Kernel/KernelA.HH.html#l4241"><spanclass=cF4>DCF_JUST_MIRROR</span></a><spanclass=cF0> to plot just the image, but this required </span><ahref="https://tomawezome.github.io/ZealOS/Kernel/KernelA.HH.html#l4237"><spanclass=cF4>DCF_SYMMETRY</span></a><spanclass=cF0> to be set at the same time.
<aname="l74"></a> Note: You can only have one symmetry active at a time including in </span><ahref="https://tomawezome.github.io/ZealOS/System/Gr/Gr.HH.html#l157"><spanclass=cF4>CSprite</span></a><spanclass=cF0>s.
<aname="l76"></a>* Use </span><ahref="https://tomawezome.github.io/ZealOS/System/Gr/GrDC.CC.html#l205"><spanclass=cF4>DCNew</span></a><spanclass=cF0>() to create a mem bitmap which can be used to work off-screen and which can be </span><ahref="https://tomawezome.github.io/ZealOS/System/Gr/GrBitMap.CC.html#l93"><spanclass=cF4>GrBlot</span></a><spanclass=cF0>ed onto the screen. If you
<aname="l77"></a>set </span><spanclass=cF2>brush</span><spanclass=cF0> member of </span><spanclass=cF2>CDC</span><spanclass=cF0> to another </span><spanclass=cF2>CDC</span><spanclass=cF0>, all the graphic routines will </span><ahref="https://tomawezome.github.io/ZealOS/System/Gr/GrBitMap.CC.html#l93"><spanclass=cF4>GrBlot</span></a><spanclass=cF0>() the brush instead of </span><ahref="https://tomawezome.github.io/ZealOS/System/Gr/GrPrimatives.CC.html#l61"><spanclass=cF4>GrPlot</span></a><spanclass=cF0>(). See </span><spanclass=cF4>
<aname="l80"></a>* There are a few </span><ahref="https://tomawezome.github.io/ZealOS/Kernel/KernelA.HH.html#l3564"><spanclass=cF4>raster operations</span></a><spanclass=cF0> available. They go in bits 8-11 of the </span><spanclass=cF2>dc->color</span><spanclass=cF0> member var which is a </span><ahref="https://tomawezome.github.io/ZealOS/Kernel/KernelA.HH.html#l3605"><spanclass=cF4>CColorROPU32</span></a><spanclass=cF0>. </span><spanclass=cF4>
<aname="l81"></a></span><ahref="https://tomawezome.github.io/ZealOS/Kernel/KernelA.HH.html#l3566"><spanclass=cF4>ROP_COLLISION</span></a><spanclass=cF0> is special. It counts the num of pixs drawn on non-background locations. Using </span><ahref="https://tomawezome.github.io/ZealOS/Kernel/KernelA.HH.html#l3566"><spanclass=cF4>ROP_COLLISION</span></a><spanclass=cF0> with vector </span><spanclass=cF4>
<aname="l82"></a></span><ahref="https://tomawezome.github.io/ZealOS/System/Gr/Gr.HH.html#l157"><spanclass=cF4>CSprite</span></a><spanclass=cF0>'s is tricky because overlapping pixs from lines in the </span><ahref="https://tomawezome.github.io/ZealOS/System/Gr/Gr.HH.html#l157"><spanclass=cF4>CSprite</span></a><spanclass=cF0> reg as collisions. You can either work with a nonzero
<aname="l83"></a>count or convert your </span><ahref="https://tomawezome.github.io/ZealOS/System/Gr/Gr.HH.html#l157"><spanclass=cF4>CSprite</span></a><spanclass=cF0> to a bitmap if your subelements draw on top of each other. Be sure to set </span><spanclass=cF4>->bkcolor</span><spanclass=cF0> before
<aname="l84"></a>using </span><ahref="https://tomawezome.github.io/ZealOS/Kernel/KernelA.HH.html#l3566"><spanclass=cF4>ROP_COLLISION</span></a><spanclass=cF0>. See </span><ahref="https://tomawezome.github.io/ZealOS/Demo/Graphics/Collision.CC.html#l1"><spanclass=cF4>::/Demo/Graphics/Collision.CC</span></a><spanclass=cF0> and </span><ahref="https://tomawezome.github.io/ZealOS/Apps/Titanium/Titanium.CC.html#l555"><spanclass=cF4>Titanium</span></a><spanclass=cF0>.
<aname="l86"></a>* The </span><spanclass=cF4>->dither_probability_u16</span><spanclass=cF0> member of </span><ahref="https://tomawezome.github.io/ZealOS/Kernel/KernelA.HH.html#l4263"><spanclass=cF4>CDC</span></a><spanclass=cF0> is a </span><spanclass=cF2>U16</span><spanclass=cF0> used to statistically sel between two colors to get something resembling
<aname="l87"></a>more shades of color. See </span><ahref="https://tomawezome.github.io/ZealOS/Demo/Graphics/SunMoon.CC.html#l1"><spanclass=cF4>::/Demo/Graphics/SunMoon.CC</span></a><spanclass=cF0> and </span><ahref="https://tomawezome.github.io/ZealOS/Demo/Graphics/Shading.CC.html#l1"><spanclass=cF4>::/Demo/Graphics/Shading.CC</span></a><spanclass=cF0>. It works with many graphic
<aname="l88"></a>routines, but not those with pens.
<aname="l91"></a>create an </span><ahref="https://tomawezome.github.io/ZealOS/Kernel/KernelA.HH.html#l281"><spanclass=cF4>CMathODE</span></a><spanclass=cF0> struct with </span><ahref="https://tomawezome.github.io/ZealOS/System/MathODE.CC.html#l31"><spanclass=cF4>ODENew</span></a><spanclass=cF0>(), passing it the num of vars in the state vect. For realistic physics, you usually
<aname="l92"></a>have 2 state vars for each dimension (for each mass) because motion is governed by F=mA which is a 2nd order equation. The
<aname="l93"></a>two states are pos and velocity and to solve these you need to supply the derivative of pos and velocity. The derivative of
<aname="l94"></a>pos is usually simply the current velocity and the derivative of velocity is the acceleration (the sum of forces on a mass
<aname="l95"></a>divided by mass). To help provide meaningful names for values in the state vect, you can create an </span><ahref="https://tomawezome.github.io/ZealOS/Kernel/KernelA.HH.html#l230"><spanclass=cF4>COrder2D3</span></a><spanclass=cF0> ptr and point
<aname="l96"></a>it to a mass in the state vect. Six elements in the state vect are required for each mass.