| Home CBM ASCII-X BASIC Disk Commands Enter RUN mode Program Format Secret Variables Variable Format Expressions Keywords (divide) (equal) (less) (minus) (more) (multiply) (plus) (power) Abs And Append Asc Atn Auto Backup Bank Begin Bend Bload Boot Box Bsave Bump Catalog Char Chr Circle Close Clr Cmd Collect Collision Color Concat Cont Copy Cos Data Dclear Dclose Dec Def Delete Dim Directory Dispose Dload Do Dopen Draw Ds Ds string Dsave Dverify El Else End Envelope Er Err Exit Exp Fast Fetch Filter Fn For Fre Get Get num Getkey Go Gosub Goto Graphic Gshape Header Help Hex If Input Input num Instr Int Joy Key Left Len Let List Load Locate Log Loop Mid Monitor Movspr New Next Not Off On Open Or Paint Peek Pen Pi Play Pointer Poke Pos Pot Print num Pudef Quit Rclr Rdot Read Record Rem Rename Renumber Restore Resume Return Rgr Right Rlum Rnd Rreg Rspcolor Rsppos Rsprite Run Rwindow Save Scale Scnclr Scratch Sgn Sin Sleep Slow Sound Spc Sprcolor Sprdef Sprite Sprsav Sqr Sshape St Stash Step Stop Str Swap Sys Tab Tan Tempo Then Ti Ti string To Trap Troff Tron Until Using Usr Val Verify Vol Wait While Width Window Xor Syntax Tokens C128 D64plus Disk Escape Codes Hardware PCxface PETSCII Pet2asc Futurama IBM PC-AT Contact Games Glossary Hall of fame Hall of shame Miscellaneous Privacy policy Programming Twisty puzzles |
RDOT ( dotAttribute )
Return information about the pixel cursor.
The pixel cursor is an internal BASIC variable which basically "remembers" the last physical pixel plotted on the screen. It is used as default value in many of the bitmap graphic commands. Use RDOT if you would like to retrieve the x and y ordinates of the pixel cursor. Because the value returned by RDOT refers to a physical pixel, SCALE does not apply. In contrast, use LOCATE to assign the pixel cursor (it does apply SCALE when active). Passing RDOT a dotAttribute of 2 will retrieve the colorSource of the pixel located at the pixel cursor. If the pixel cursor is off-screen, the return value will be zero. Even if the coordinate is on-screen, know that the colorSource refers to only a bit pattern stored in bitmap memory. The actual color seen on screen will depend on the actual colors assigned to the colorSource in the cell where the pixel cursor is located. If you have not changed any colors (with the COLOR command) since you cleared the bitmap (you did clear it before you started, right?) then you can use the RCLR function to look-up the video-chip color that has been assigned to the colorSource. In other words, chip_color_at_pixel_cursor = RCLR(RDOT(2)). Remember this is unreliable if you changed colors after clearing the bitmap. If you have changed colors, then the only reliable way to get the displayed color of the pixel is to PEEK the color memory -- but this video chip and mode specific. A floating-point dotAttribute will be converted to an integer (see INT). You will get TYPE MISMATCH ERROR with a string dotAttribute. Examples:
Those are pretty trivial examples as you can probably guess what the value of RDOT would be. Much more interesting is using RDOT as follow-up to a complex graphic command like a rotated BOX, or a CIRCLE that has been mutated to create an arc or polygon. Might even be interesting as a follow-up to a simple DRAW command if you used a polar coordinate!
© H2Obsession, 2014 |