Graphics Overview Dive into Demo Index to learn. The order layers are drawn on top of each other is: /* Graphics Not Rendered in HTML */ * See GrUpdateScreen(), GrUpdateTasks() and GrUpdateTaskWin() called by the WinMgr task 60fps. Notice the task's draw_it() callback being called. Only tasks on Core0 are allowed to have windows. There is one window per task, no child windows. You can have pop-up child tasks. * CDCs (device contexts) are a data type for controlling graphics on the screen or graphics in mem. The device context structure has thick and color. You use DCAlias() to create your own structure, with its own color and thick. Free it with DCDel() when finished. * gr.dc is a device context for persistent data on the screen, not needing to be redrawn. You create an alias for this by using DCAlias() and work with that. See ::/Demo/Graphics/NetOfDots.CC. * There are various flavors of line and point plotting routines. GrLine() and GrPlot() are the simplest. The others allow 3D graphics and rotations. * See ::/Doc/Transform.DD for adding a transformation. * You change the Fs->draw_it variable to point to your DrawIt() function which gets called each screen refresh (60 fps). You draw everything in the window over and over again. See ::/Demo/Graphics/Box.CC. * Use the graphic sprite resource editor, <CTRL-r>, to create a sprite that can be plotted with Sprite3() or output to the cmd line with Sprite(). Use $IB,"",BI=1$ in a src program to insert the address of sprite binary data item #1. To learn how the numbers work, after creating a sprite with <CTRL-r>, toggle to plain text with <CTRL-t> and check its num. Make an assignment to a pointer variable or pass to Sprite3() with $IB,"",BI=n$. Use <CTRL-r>'s "Pointer to Sprite" to make a $IB...$ entry. See ::/Demo/Graphics/SpritePlot.CC and ::/Demo/Graphics/SpritePlot3D.CC. The origin (zero point) for a sprite is defined by the cursor location when you pressed <CTRL-r> to make it. You can edit a sprite by clicking the cursor on it and pressing <CT RL-r> again. * Set DCF_SYMMETRY in the CDC.flags and call DCSymmetrySet() or DCSymmetry3Set(). This will plot a mirror image in addition to the primary image. Set DCF_JUST_MIRROR to plot just the image, but this required DCF_SYMMETRY to be set at the same time. Note: You can only have one symmetry active at a time including in CSprites. * Use DCNew() to create a mem bitmap which can be used to work off-screen and which can be GrBloted onto the screen. If you set brush member of CDC to another CDC, all the graphic routines will GrBlot() the brush instead of GrPlot(). See ::/Demo/Graphics/Blot.CC. * There are a few raster operations available. They go in bits 8-11 of the dc->color member variable which is a CColorROPU32. ROP_COLLISION is special. It counts the num of pixs drawn on non-background locations. Using ROP_COLLISION with vector CSprite's is tricky because overlapping pixs from lines in the CSprite register as collisions. You can either work with a nonzero count or convert your CSprite to a bitmap if your subelements draw on top of each other. Be sure to set ->bkcolor before using ROP_COLLISION. See ::/Demo/Graphics/Collision.CC and Titanium. * The ->dither_probability_u16 member of CDC is a U16 used to statistically sel between two colors to get something resembling more shades of color. See ::/Demo/Graphics/SunMoon.CC and ::/Demo/Graphics/Shading.CC. It works with many graphic routines, but not those with pens. * There is a mechanism built-in for generating motion based on differential equations, which allows realistic physics. You create an CMathODE struct with ODENew(), passing it the num of variables in the state vect. For realistic physics, you usually have 2 state variables for each dimension (for each mass) because motion is governed by F=mA which is a 2nd order equation. The two states are pos and velocity and to solve these you need to supply the derivative of pos and velocity. The derivative of pos is usually simply the current velocity and the derivative of velocity is the acceleration (the sum of forces on a mass divided by mass). To help provide meaningful names for values in the state vect, you can create an COrder2D3 pointer and point it to a mass in the state vect. Six elements in the state vect are required for each mass. See Math/CMathODE. See ::/Demo/Games/Rocket.CC.