This program is a picture making program. you draw the picture, exit the program, and save the picture. but since I'm horrible at optimization, i need help doing it.

Controls
[2nd] - draw mode
[alpha] - erase mode
[Math] - Neutral mode (Also what it starts on)
[X,θ,T,n] - toggle fast move.
[Y=] - Horizontal line
[Window] - Vertical line
[Zoom] - Type text
[Trace] - Shades from point A to point B
[Graph] - Draws a line from point A to point B


Code:

ClrDraw
0->Xmin
94->Xmax
~62->Ymin
0->Ymax
47->A
~31->B
1->C
0->D
0->E
0->F
While 1
   Pt-Change(A,B
   Repeat Ans
   getKey:End
   Ans->G
   Pt-Change(A,B
   If G=105 and J:Then
      If K
      Line(A,B,J,K
      If I:Then
         If B<J:Then
            B->T
            J->B
            T->J
         End
         For(Q,J,B
            Line(A,Q,I,Q
         End
      End
      T->B:0->I:0->J:0->K:DelVar T
   End
   If not(J:Then
      If D=1:Pt-On(A,B
      If D=2:Pt-Off(A,B
      If G=21:1->D
      If G=31:2->D
      If G=41:0->D
   End
   4(G=32 xor C=5)+1->C
   A-C(G=24)->A:A+C(G=26)->A
   B-C(G=34)->B:B+C(G=25)->B
   If G<21:Then
      If G=14:Then
         A->I
         B->J
         Pt-Change(A,B
      End
      If G=15:Then
         A->J
         B->K
         Pt-Change(A,B
      End
      If G=11
      Horizontal B
      If G=12
      Vertical A
      If G=13:Then
         "    ->Str1
         Repeat G=105
            Repeat Ans
            getKey:End
            Ans->G
            0->Q
            If length(Str1)>4
            3->Q
            If G>34 and G<105
            sub(Str1,1,length(Str1)-Q)+sub("ABC  EFGHIJKLMNOPQRSTUVWXYZ$[<|] :[|>]",G-5iPart(.1G+4),1)+"   "->Str1
            If G=23
            sub(Str1,1,length(Str1)-4)+"   "->Str1
            Text(abs(B),A,Str1
         End
      End
   End
End


Edit: Fixed all errors and added the 2 other functions
Edit: Fixed erase function on the typing
DragonScholar71 wrote:
Keep in mind that there might be a few errors seeing as how I didn't test this code yet...


Premature optimization is the root of all evil. It's much easier to edit a program before it's been optimized, so you want to make sure to test and fix any bugs before optimizing it.
I have made this program before, but I guess it's better to be safe...
I have optimized it a little (With the help of mr. womp womp). And this is what i currently have.


Code:

ClrDraw
0->Xmin:94->Xmax:~62->Ymin:0->Ymax
AxesOff
47->A
~31->B
1->C
DelVar JDelVar IDelVar KDelVar D
While 1
   pxl-Test(abs(B),A)->U
   Repeat Ans
      Pt-Change(A,B
   getKey:End
   If U:Then
      Pt-On(A,B
   Else
      Pt-Off(A,B
   End
   Ans->G
   If not(J:Then
      If D=1:Pt-On(A,B
      If D=2:Pt-Off(A,B
      If G=21:1->D
      If G=31:2->D
      If G=41:0->D
   End
   4(G=32 xor C=5)+1->C
   A-C(G=24)->A:A+C(G=26)->A
   B-C(G=34)->B:B+C(G=25)->B
   If A>Xmax
   Xmin->A
   If A<Xmin
   Xmax->A
   If B>Ymax
   Ymin->B
   If B<Ymin
   Ymax->B
   If G=105 and J:Then
      If K
      Line(A,B,J,K
      If I:Then
         If B<J:Then
            B->T
            J->B
            T->J
         End
         For(Q,J,B
            Line(A,Q,I,Q
         End
         T->B
      End
      DelVar IDelVar KDelVar JDelVar T
   End
   If G<21:Then
      If G=14:Then
         A->I
         B->J
         Pt-Change(A,B
      End
      If G=15:Then
         A->J
         B->K
         Pt-Change(A,B
      End
      If G=11:Horizontal B
      If G=12:Vertical A
      If G=13:Then
         "    "->Str1
         Repeat G=105
            Repeat Ans
            getKey:End
            Ans->G
            3(4<length(Str1
            If G>34 and G<105
            sub(Str1,1,length(Str1)-Ans)+sub("ABC  EFGHIJKLMNOPQRSTUVWXYZ$[<|] :[|>]",G-5iPart(.1G+4),1)+"   "->Str1
            If G=23
            sub(Str1,1,length(Str1)-4)+"   "->Str1
            Text(abs(B),A,Str1
         End
      End
   End
End

Same Controls as before.
And Now...

THE FINISHED PRODUCT! I have worked on this program for a long time (1 Month) and it is looking great. It's fast, useful and great for making game backgrounds. It will even ask you if you want to keep the graph screen! More features coming soon!

Controls

[2nd] - Draw Mode
[Alpha] - Erase Mode
[Math] - Neutral mode (you can go over pixels and not effect them!)

[1] - Box unshaded
[2] - Box shaded
[3] - Draw a line from point A to point B
[4] - Horizontal line
[5] - Vertical Line
[6] - Insert Text


Code:

Menu("Keep Graph?","Yes",1,"No",2
Lbl 2
ClrHome
Lbl 1
0->Xmin:94->Xmax:~62->Ymin:0->Ymax
AxesOff
47->A
~31->B
1->C
DelVar JDelVar IDelVar KDelVar D
While 1
   pxl-Test(abs(B),A)->U
   Repeat Ans
      Pt-Change(A,B
   getKey:End
   If U:Then
      Pt-On(A,B
   Else
      Pt-Off(A,B
   End
   Ans->G
   If not(J:Then
      If D=1:Pt-On(A,B
      If D=2:Pt-Off(A,B
      If G=21:1->D
      If G=31:2->D
      If G=41:0->D
   End
   4(G=32 xor C=5)+1->C
   A-C(G=24)->A:A+C(G=26)->A
   B-C(G=34)->B:B+C(G=25)->B
   If A>Xmax
   Xmin->A
   If A<Xmin
   Xmax->A
   If B>Ymax
   Ymin->B
   If B<Ymin
   Ymax->B
   If G=105 and J:Then
      If O:Then
         Line(J,O,A,O
         Line(A,O,A,B
         Line(A,B,J,B
         Line(J,B,J,O
      End
      If K
      Line(A,B,J,K
      If I:Then
         B->T
         If B<J:Then
            J->B
            T->J
         End
         For(Q,J,B
            Line(A,Q,I,Q
         End
         T->B
      End
      DelVar IDelVar KDelVar JDelVar TDelVar O
   End
   If G>41:Then
      If G=92:Then
         A->J
         B->O
         Pt-Change(A,B
      End
      If G=93:Then
         A->I
         B->J
         Pt-Change(A,B
      End
      If G=94:Then
         A->J
         B->K
         Pt-Change(A,B
      End
      If G=82:Horizontal B
      If G=83:Vertical A
      If G=84:Then
         "    ->Str1
         Repeat G=105
            Repeat Ans
            getKey:End
            Ans->G
            3(4<length(Str1
            If G>34 and G<105
            sub(Str1,1,length(Str1)-Ans)+sub("ABC  EFGHIJKLMNOPQRSTUVWXYZ$[<|] :[|>]",G-5iPart(.1G+4),1)+"   "->Str1
            If G=23
            sub(Str1,1,length(Str1)-4)+"   "->Str1
            Text(abs(B),A,Str1
         End
      End
   End
End


P.S. I need to post it on the site still...
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement