Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define MAX_SPEED 180
- dclrscr blue;
- dsetwidth 2
- dsetsize 20
- timer 50
- Main();
- dexit;
- float SpeedToAngle(float speed)
- {
- float pi;
- fpi pi;
- mov ecx, speed;
- div ecx, 180;
- mul ecx, pi;
- return ecx;
- }
- void DrawKM()
- {
- float pos[2];
- float m, k, i, count;
- count = 0;
- for(m = count = 0; m <= 180 ; m += (MAX_SPEED / 18))
- {
- float j = SpeedToAngle(m);
- mov ecx, j
- fcos eax, ecx;
- fsin edx, ecx;
- k = eax;
- i = edx;
- k *= 220;
- i *= 220;
- pos[0] = 250 - k;
- pos[1] = 300 - i;
- dcolor black
- dline center, pos
- dcolor red
- dwritei pos, m
- count += 10;
- }
- }
- float GetVelocity()
- {
- float vel;
- mov eax, port1
- div eax, 6.2
- mov vel, eax
- return vel
- }
- void DrawArrow(float speed)
- {
- if(speed > MAX_SPEED)
- speed = MAX_SPEED;
- if(speed < 0)
- speed = 0;
- float k, i;
- float pos[2];
- float j = SpeedToAngle(speed);
- mov ecx, j
- fcos eax, ecx
- fsin edx, ecx
- k = eax
- i = edx
- k *= 220
- i *= 220
- pos[0] = 250 - k;
- pos[1] = 300 - i;
- dcolor green
- dline center, pos
- }
- void Main()
- {
- DrawKM();
- DrawArrow(GetVelocity());
- }
- color black, 0, 0, 0
- color red, 255, 0, 0
- color blue, 0, 0,255
- color green, 0, 255, 0
- vec2f size, 256, 256
- vec2f center, 256, 300
Advertisement
Add Comment
Please, Sign In to add comment