$WW,1$$FG,5$$TX+CX,"Graphics Overview"$$FG$ Dive into $LK,"Demo Index",A="FI:::/Doc/DemoIndex.TXT"$ to learn. The order that layers are drawn on top of each other is: $SP,"",BI=1$ * If you are curious, see $LK,"GrUpdateScreen",A="MN:GrUpdateScreen"$() and $LK,"GrUpdateWins",A="MN:GrUpdateWins"$() called by the WinMgr task 60fps. Notice the tasks $LK,"draw_it",A="FF:::/Adam/Gr/GrScreen.CPP,draw_it"$ callback being called. Only tasks on $FG,2$core0$FG$ are allowed to have windows. There is one window per task, no child windows. You can have pop-up child tasks. * $LK,"CDC",A="MN:CDC"$s (device contexts) are a data type for controlling graphics on the screen or graphics in mem. The device context structure has pen width and color. You use $LK,"DCAlias",A="MN:DCAlias"$() to create your own structure, with its own color and pen width. Free it with $LK,"DCDel",A="MN:DCDel"$() when finished. * $FG,4$gr.dc$FG$ is a device context for persistent data on the screen, not needing to be redrawn. You create an alias for this by using $LK,"DCAlias",A="MN:DCAlias"$() and work with that. See $LK,"::/Demo/Graphics/NetOfDots.CPP"$. * There are various flavors of line and point plotting routines. $LK,"GrLine",A="MN:GrLine"$() and $LK,"GrPlot",A="MN:GrPlot"$() are the simplest. The others allow 3D graphics and rotations. * See $LK,"::/Doc/Transform.TXT"$ for adding a transformation. * You change the $FG,2$Fs->draw_it$FG$ var to point to your $FG,2$DrawIt()$FG$ function which gets called each screen refresh (60 fps). You draw everything in the window over and over again. See $LK,"::/Demo/Graphics/Box.CPP"$. * Use the resource editor, $FG,2$$FG$, to create a sprite that can be plotted with $LK,"Sprite3",A="MN:Sprite3"$() or output to the cmd line with $LK,"Sprite",A="MN:Sprite"$(). Use $FG,2$$$IB,"",BI=1$$$FG$ in a src program to insert the addr of sprite binary data item #1. To learn how the numbers work, after creating a sprite with $FG,2$$FG$, toggle to plain text with $FG,2$$FG$ and check its num. Make an assignment to a ptr var or pass to $LK,"Sprite3",A="MN:Sprite3"$() with $FG,2$$$IB,"",BI=n$$$FG$. Use $FG,2$$FG$'s "Pointer to Sprite" to make a $FG,2$$$IB...$$$FG$ entry. See $LK,"::/Demo/Graphics/SpritePlot.CPP"$ and $LK,"::/Demo/Graphics/SpritePlot3D.CPP"$. The origin (zero point) for a sprite is defined by the cursor location when you pressed $FG,2$$FG$ to make it. You can edit a sprite by clicking the cursor on it and pressing $FG,2$$FG$ again. * Set $LK,"DCF_SYMMETRY",A="MN:DCF_SYMMETRY"$ in the $LK,"CDC",A="MN:CDC"$$FG,2$.flags$FG$ and call $LK,"GrSetSymmetry",A="MN:GrSetSymmetry"$() or $LK,"GrSetSymmetry3",A="MN:GrSetSymmetry3"$(). This will plot a mirror image in addition to the primary image. Set $LK,"DCF_JUST_MIRROR",A="MN:DCF_JUST_MIRROR"$ to plot just the image, but this required $LK,"DCF_SYMMETRY",A="MN:DCF_SYMMETRY"$ to be set at the same time. Note: You can only have one symmetry active at a time including in $LK,"CSprite",A="MN:CSprite"$s. * Use $LK,"DCNew",A="MN:DCNew"$() to create a mem bitmap which can be used to work off-screen and which can be $LK,"GrBlot",A="MN:GrBlot"$ed onto the screen. If you set $FG,2$brush$FG$ member of $FG,2$CDC$FG$ to another $FG,2$CDC$FG$, all the graphic routines will $LK,"GrBlot",A="MN:GrBlot"$() the brush instead of $LK,"GrPlot",A="MN:GrPlot"$(). See $LK,"::/Demo/Graphics/Blot.CPP"$. * There are a few $LK,"raster operations",A="MN:ROP_EQU"$ available. They go in bits 8-11 of the $FG,2$dc->color$FG$ member var which is a $LK,"CColorROPU32",A="MN:CColorROPU32"$. $LK,"ROP_COLLISION",A="MN:ROP_COLLISION"$ is special. It counts the num of pixs drawn on non-background locations. Using $LK,"ROP_COLLISION",A="MN:ROP_COLLISION"$ with vector $LK,"CSprite",A="MN:CSprite"$'s is tricky because overlapping pixs from lines in the $LK,"CSprite",A="MN:CSprite"$ reg as collisions. You can either work with a nonzero count or convert your $LK,"CSprite",A="MN:CSprite"$ to a bitmap if your subelements draw on top of each other. Be sure to set $FG,4$->bkcolor$FG$ before using $LK,"ROP_COLLISION",A="MN:ROP_COLLISION"$. See $LK,"::/Demo/Graphics/Collision.CPP"$ and $LK,"TimeOut",A="FF:::/Apps/TimeOut/TimeOut.CPP,ROP_COLLISION"$. * The $FG,4$->dither_probability_u16$FG$ member of $LK,"CDC",A="MN:CDC"$ is a $FG,2$U16$FG$ used to statistically select between two colors to get something resembling more shades of color. See $LK,"::/Demo/Graphics/SunMoon.CPP"$ and $LK,"::/Demo/Graphics/Shading.CPP"$. 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 $LK,"CMathODE",A="MN:CMathODE"$ struct with $LK,"ODENew",A="MN:ODENew"$(), passing it the num of vars in the state vect. For realistic physics, you usually have 2 state vars 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 $LK,"COrder2D3",A="MN:COrder2D3"$ ptr and point it to a mass in the state vect. Six elements in the state vect are required for each mass. See $LK,"Math/CMathODE",A="HI:Math/CMathODE"$. See $LK,"::/Demo/Games/Rocket.CPP"$. U PðÿÿÿPÜÿÿÿ @Üÿÿÿ@4 @484 ”” ¨¨ ¼¼ 8( @” @(@ XÜÿÿÿXÈÿÿÿ `Èÿÿÿ`´ÿÿÿ XÈÿÿÿHÈÿÿÿ HÈÿÿÿH H @ `´ÿÿÿP´ÿÿÿ P´ÿÿÿP PP PP P H (@(T 0, , TT T¨ T h hh h¼ h| |Ì ÌÌ || |Ì €€ PÜÿÿÿ@Üÿÿÿ (p p 0\(\ 8H0H 0,/@ , € ((p 00\ 8ðÿÿÿ8H HðÿÿÿH @@ 88, Hðÿÿÿ8ðÿÿÿ @0\Ðÿÿÿtask0 DocsTäÿÿÿtask0->draw_it()Løÿÿÿtask0->next_ctrlD task0->last_ctrl< task1 Docs44task1->draw_it(),Htask1->next_ctrl$\task1->last_ctrl„ext[EXT_FINAL_SCREEN_UPDATE]h¼ÿÿÿTextŒ¼ÿÿÿtextbasepgr_dc (persistent)μÿÿÿ(Lags a refresh)