Jump to content



Photo
- - - - -

Can I clear only lines in a program? If not, is there an alternative?


  • Please log in to reply
4 replies to this topic

#1 omarelnaggary

omarelnaggary

    Newbie

  • Members
  • Pip
  • 2 posts
  • Gender:Male
  • Interests:Programing

  • Calculators:
    fx-9860GII SD and Graph 75+

Posted 09 December 2016 - 07:38 PM

I am programing a simple digital clock that goes from 1 to 12 and repeats.
The way it functions:
- The prog converts every possible direction of the clock hands (1, 2, 3,.. 12) into radians. (angle=A)
(hour=H)
- Then a line is drawn with Coordinates x1=0 y1=0 and x2=-sin x 30 A y2=30 x cos A
- Each time, the loop repeats, H changes to H+1, A changes according to H, the line is cleared, and redrawn with the new values, resulting in a movement of the clock hands by one hour clockwise.

- Loop:
ViewWindow -64,64,0,-32,32,0
For 1-> H To 12
(Hours (H) convert to radian R)
SketchThick F-Line 0, 0, 30 x -sin A, 30 x cos A
Circle 0, 0, 30
(draws numbers on clock 1-12)
SketchThick F-Line 0, 0, 30 x -sin A, 30 x cos A
Cls
Next

-The loop is inside another loop
Problem: every movement of the Line cause the circle to disapear and reappear again, while the line is drawn twice during the loop, so it doesn't have the same effect.
However I only want the line to be cleared each time, I tried using Picture recall for the clock frame, but it doesn't work, and "Cls" clears everything

#2 Viliami

Viliami

    Casio Addict

  • Moderator
  • PipPipPip
  • 99 posts
  • Gender:Male
  • Location:New Zealand
  • Interests:C++ - OpenGL,SDL
    Python - Pygame
    Java - SFML
    C - Casio SDK

  • Calculators:
    FX-9750 GII upgraded to FX-9860 GII

Posted 11 December 2016 - 02:13 AM

To do that you'll have to remove all Cls commmands and instead of clearing the whole screen each frame, just clear the parts of the screen you are changing.

 

For example, if you only want to change the line, draw the line in white over the current line and then draw your new line.


  • omarelnaggary likes this

#3 omarelnaggary

omarelnaggary

    Newbie

  • Members
  • Pip
  • 2 posts
  • Gender:Male
  • Interests:Programing

  • Calculators:
    fx-9860GII SD and Graph 75+

Posted 12 December 2016 - 04:30 AM

To do that you'll have to remove all Cls commmands and instead of clearing the whole screen each frame, just clear the parts of the screen you are changing.
 
For example, if you only want to change the line, draw the line in white over the current line and then draw your new line.

Yeah I thought about the PixelOff or PlotOff commands but they dont work. how can I draw a white line?

#4 Viliami

Viliami

    Casio Addict

  • Moderator
  • PipPipPip
  • 99 posts
  • Gender:Male
  • Location:New Zealand
  • Interests:C++ - OpenGL,SDL
    Python - Pygame
    Java - SFML
    C - Casio SDK

  • Calculators:
    FX-9750 GII upgraded to FX-9860 GII

Posted 13 December 2016 - 07:59 AM

What exactly is happening when you use PixelOff or PlotOff?

 

Because those two functions are the only way to clear a pixel using BASIC. (that I know of)



#5 Krtyski

Krtyski

    Casio Freak

  • Members
  • PipPipPipPip
  • 132 posts
  • Gender:Male
  • Location:Tokyo, Japan
  • Interests:programming, smooth Jazz and 4-wheel driving.

  • Calculators:
    FX-502P, FX-602P, FX-603P,
    fx-4000P, fx-7000G,
    fx-4500P, fx-4800P
    fx-5800P,
    CFX-9850G,
    CFX-9850GC PLUS
    fx-9860G,
    fx-9860G AU,
    fx-9860G Slim
    fx-9860GII SD,
    fx-9860GII-2,
    fx-9860GII-2 SD,
    fx-CG20, fx-CG50,
    fx-CP400
    fx-9860GIII
    fx-9750GIII
    fx-7400GIII

Posted 15 December 2016 - 06:06 AM

Hi everyone

 

I'm afraid Casio Basic does not support a command/function to draw line with pixels off, just like PlotOff against PlotOn.

 

If use PlotOn / PlotOff to draw line (clock hand), it will take long time, so this way looks  just visionary and using Cls is much realistic in slow and poor Casio Basic.

 

====

 

You may not have any interest in C.Basic, a new Add-In Basic interpreter, but you can clear only the clock hand;

 

Instead of "Cls", use "SketchThick F-Line 0, 0, 30 x -sin A, 30 x cos A, C" in C.Basic.

 

C.Basic is very compatible with genuine Casio Basic and also supports extended commands and quite new commands.

 

F-Line x1, y1, x2, y2, [C / X]

 

- C: clear the line

- X: reverse the line

 

just for our info.

 

sentaro21 has been developed C.Basic and I've been supporting for testing and debugging, we speak Japanese, so all the documents are in our language.

 

Now I'm working on translation of manual and command reference.

http://egadget2.web....nterpreter.html

 

I just translated the above command reference;

http://egadget2.web....xtGraphCom.html

 

 

I hope to complete this by 17th Jan, 2017 (so almost all time stamp of articles are that date), but not sure possibly later.


Edited by Krtyski, 15 December 2016 - 06:54 AM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users