Idea for two new commands - Printable Version +- QB64 Phoenix Edition (https://qb64phoenix.com/forum) +-- Forum: Chatting and Socializing (https://qb64phoenix.com/forum/forumdisplay.php?fid=11) +--- Forum: General Discussion (https://qb64phoenix.com/forum/forumdisplay.php?fid=2) +--- Thread: Idea for two new commands (/showthread.php?tid=2578) |
Idea for two new commands - TerryRitchie - 04-06-2024 UPDATE: Never mind. POINT(0) and POINT(1) already do this. Thanks Steve While working on example programs for the DRAW statement topic in Lesson 5 of the tutorial I had an idea for two new commands. The LINE statement allows doing this: LINE(0, 0)-(100, 100), _RGB32(255, 255, 255) ' a white line LINE -(100, 200), _RGB(255, 255, 255) ' continue the line from last point By omitting the first set of coordinates the LINE statement simply continues on from the last point. You always know the coordinates because they are explicitly given with numerical values or variables. However, take this piece of code for instance: DRAW "BM200,200" ' move pen to location DRAW "TA45" ' rotate pen DRAW "R100" ' draw line 100 pixels long LINE -(300, 300), _RGB32(255, 255, 255) ' continue line from last DRAW point By omitting the first set of coordinates the LINE statement will continue on from where DRAW left off. But, what was the first set of coordinates? Before issuing the LINE statement I suggest two new commands to find out: _DRAWX ' get current x position of pen (or _GETX ' get current graphics cursor x position) _DRAWY ' get current y position of pen (or _GETY ' get current graphics cursor y position) This could come in very handy: TYPE TICKS x AS INTEGER y AS INTEGER END TYPE DIM Tick(359) AS TICKS DIM Angle AS INTEGER SCREEN _NEWIMAGE(800, 600, 32) FOR Angle = 0 to -359 STEP -1 DRAW "BM399,299" ' center pen on screen DRAW "TA" + STR$(Angle) ' rotate pen DRAW "U200" ' draw line 200 pixels long Tick(ABS(Angle)).x = _DRAWX ' get current pen x position Tick(ABS(Angle)).y = _DRAWY ' get current pen y position NEXT Angle You now have the 360 locations around a circle without using any trigonometry. You can always know where your graphics cursor (or pen) position is at any time while using DRAW to do complex "Spirograph" type images. This could allow sprites, images, or even text to be located at key points within your DRAW commands. What do you think? Sound like something looking into to? All drawing commands need to keep track of the graphics cursor position already, right? Would it be a simple thing to extract this using the two new commands? RE: Idea for two new commands - Pete - 04-06-2024 I like any statement that begins with DRAW! - Sam RE: Idea for two new commands - TerryRitchie - 04-06-2024 (04-06-2024, 02:56 AM)Pete Wrote: I like any statement that begins with DRAW!Or ends in varmint! RE: Idea for two new commands - SMcNeill - 04-06-2024 Is POINT not the way to do this? https://qb64phoenix.com/qb64wiki/index.php/POINT POINT(0) or POINT(1) RE: Idea for two new commands - TerryRitchie - 04-06-2024 (04-06-2024, 03:07 AM)SMcNeill Wrote: Is POINT not the way to do this?Oh for PETE's sake! I just had a HUGE brain fart. I completely forgot that POINT could be used like that. Ok, move along, nothing to see here ... RE: Idea for two new commands - SMcNeill - 04-06-2024 Don't worry. I remember suggesting the same thing to Galleon ages ago. He's the one who reminded me of POINT back then. Maybe someone can do a tutorial on POINT! RE: Idea for two new commands - TerryRitchie - 04-06-2024 (04-06-2024, 03:14 AM)SMcNeill Wrote: Don't worry. I remember suggesting the same thing to Galleon ages ago. He's the one who reminded me of POINT back then.LOL, Yep, POINT is going to be added right above the DRAW statement in lesson 5. Ok, putting the code away for the rest of the night. Going to fire up Brutal DOOM Project Brutality and take my frustration out on some imps with a double barreled shot gun. Draw you varmints! RE: Idea for two new commands - Pete - 04-06-2024 GREAT IDEA inspired by Terry, _VARMINT It must be all uppercase, because CamelCase didn't go so well for Sam, Whoa CAMEL! I SEZ WHOAAAA!!! Well case aside, what could _VARMINT do? Well, glad you asked. It acts the same as KILL, but while the KILL statement requires a directive... KILL myfile.bas, etc. _VARMINT just KILLS all your files at once! It even remains in you system, as a TSR, to kill all newly added files, too. Hey, let's get Clippy to beta test it for us! How soon can it be ready? Steve gets 1-point for pointing out POINT. I mean what's the point of points if people who point out statements like POINT don't get points for pointing them out? Just sayin' Pete RE: Idea for two new commands - TerryRitchie - 04-06-2024 (04-06-2024, 03:40 AM)Pete Wrote: GREAT IDEA inspired by Terry,Point well taken. RE: Idea for two new commands - Pete - 04-06-2024 Yep, now no one can ever accuse me again of making a POINTless post! Pete |