I was in the middle of making a line clipping function but I noticed the getkey function for the camera stopped working correctly. For some reason, multiple of the same keys get activated when only one is pressed. Even though only getKey(19) is true, the condition for getKey(35) also gets activated as well(Which is why I switched over to getKey(13) and getKey(21), but that doesn't work either). I believe Axe uses the Xlib getkey functions, if that has anything to do with it.

SourceCoder 3 (AXECUBEO) wrote:
:.CUBE
:DiagnosticOff
:Full
:[F7F7F7F7F708]->GDB1
:[F7F7F7F708F7]
:[F7F7F708F7F7]
:[F70808F708F7]
:[F70808F7F708]
:[F70808080808]
:[08F70808F7F7]
:[08F708080808]
:[08F708F7F708]
:[0808F7080808]
:[0808F708F7F7]
:[0808F7F708F7]
:[F7F7F7080808]
:[0808F7F7F708]
:[F708F708F708]
:Select(~1,+L1->[r1])
:For(256)
: Select(+1,cos()->{[r1]++}
:End
:0->[r1]
:L1->^^oCosLUT
:L1+256->^^oMOV
:L1+256+3->^^oINSIDE
:L1+256+9->^^oLEFT
:L1+256+14->^^oRIGHT
:L1+256+18->^^oBOTTOM
:L1+256+24->^^oTOP
:L1+256+28->^^oCODE
:
:0->theta
:0->T
:0->MOV
:
:0->CODE
:0->INSIDE
:2->LEFT
:4->RIGHT
:8->BOTTOM
:16->TOP
:Repeat getKey(15)
: ClrDraw
: If getKey(1):T+1->T:End
: If getKey(2):theta+1->theta:End
: If getKey(3):theta-1->theta:End
: If getKey(4):T-1->T:End
:
: If getKey(13)
: MOV+30->MOV
: ElseIf getKey(21)
: MOV-30->MOV
: End
:
: thetasub(Sin)->S
: thetasub(Cos)->C
: Tsub(Sin)->M
: Tsub(Cos)->N
:
: 0->CODE
: For(A,0,14)
: A*6+GDB1->B
: . X and G
: sign{B}->X->G
: . Y and O
: sign{B+1}->Y
: . Z and R
: sign{B+2}->Z
: . U and P
: sign{B+3}->U->P
: . V and F
: sign{B+4}->V
: . W and J
: sign{B+5}->W
:
: . ----\-Y ROTATION----\-
: . G acts as a placeholder for the X variable, since we're performing operations on the actual X variable and should change.
: . x' = x * cos(angle) + z * sin(angle);
: G*C+(Z*S)//16->X
: . z' = z * cos(angle) - x * sin(angle);
: Z*C-(G*S)//16->Z
: Y*8->Y
: . x' = x * cos(angle) + z * sin(angle);
: P*C+(W*S)//16->U
: . z' = z * cos(angle) - x * sin(angle);
: W*C-(P*S)//16->W
: V*8->V
:
: . ----\-X ROTATION----\-
: . G acts as a placeholder for the Y variable, since we're performing operations on the actual Y variable and it cannot change.
: . y' = y * cos(angle) - z * sin(angle);
: Y->G
: G*N-(Z*M)//16->Y
: . z' = z * cos(angle) + y * sin(angle);
: Z*N+(G*M)//16->Z
: X*8->X
: . y' = y * cos(angle) - z * sin(angle);
: V->G
: G*N-(W*M)//16->V
: . z' = z * cos(angle) + y * sin(angle);
: W*N+(G*M)//16->W
: U*8->U
:
: Z+2000/64->Z
: W+2000/64->W
: Line((X+MOV)//Z+48,Y//Z+32,(U+MOV)//W+48,V//W+32)
: . Pxl-On(sign{GDB2}//sign{GDB2+2}+48,sign{GDB2+1}//sign{GDB2+2}+32)
: End
: DispGraph
: sub(COMP,(X+MOV)//Z+48,Y//Z+32)
: Output(5,5,CODE>Dec)
: sub(COMP,(U+MOV)//W+48,V//W+32)
: Output(1,5,CODE>Dec)
:End
:
:Lbl Sin
:-64
:Lbl Cos
:^256??128,sign{+^^oCosLUT}
:Return
:
:. COMP(x,y)
:Lbl COMP
:0->CODE
:If [r1]<0
:CODE or LEFT->CODE
:ElseIf [r1]>95
:CODE or RIGHT->CODE
:End
:If [r2]<0
:CODE or TOP->CODE
:ElseIf [r2]>64
:CODE or BOTTOM->CODE
:End
:Return
:
:
:
:
:
:
:
Try replacing the ElseIf with two seperate statements.

getKey(13)?MOV+30->MOV
getKey(21)?MOV-30->MOV

That usually works for me. Let me know if that helps!

(quick tip, do this for the other four getKey statements too)
Thanks for the reply, key 13 still doesn't register for some reason. When I switch the two statements around neither of them registers.

getKey(1)?T+1->T
getKey(2)?theta+1->theta
getKey(3)?theta-1->theta
getKey(4)?T-1->T
getKey(13)?MOV+30->MOV
getKey(21)?MOV-30->MOV
getKeys are kind of finicky with Axe and I don't know why, my solution might be to replace just those two with an If statement that runs off of G instead of getKey.
You can prematurely store getkey into G and then read the variable rather than the direct command. just make sure you store 0 into g before the getKey->G.

There is no real guarantee that it works, if it doesn't then I'd just play around with it until it does such as placing it before the 1,2,3 and 4. it's always really weird.
Thanks, I'll get it working some way.
  
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