feat(ui); cPos, cRot with normal sizes, position #1

Merged
bedohswe merged 2 commits from n3tael/p3he:main into main 2024-04-03 13:24:50 +00:00
Showing only changes of commit ac9509acac - Show all commits

13
main.py
View File

@ -2,25 +2,24 @@
from time import time_ns, sleep from time import time_ns, sleep
from cmath import exp from cmath import exp
import math
import pygame import pygame
import pygame.freetype import pygame.freetype
from gyro import * from gyro import *
from lines import * from lines import *
def deg2rad(rA): return rA/180*PI def deg2rad(rA): return rA/180*PI
I = complex(0,1) I = complex(0,1)
WHITE = (255,255,255) WHITE = (255,255,255)
BLACK = (0,0,0) BLACK = (0,0,0)
OFFSET = 0.015625 OFFSET = 0.015625
PI = 3.14159265358979323846264338327 PI = math.pi
ROT = cNorm(exp(deg2rad(2)*I)) ROT = cNorm(exp(deg2rad(2)*I))
IROT = 1/ROT IROT = 1/ROT
F = 5 * 10**7 F = 5 * 10**7
F_ = 10**9 F_ = 10**9
class Segment: class Segment:
def __init__(self,bA,cA,cB,trColor): def __init__(self,bA,cA,cB,trColor):
self.isFinite = bA self.isFinite = bA
@ -70,7 +69,7 @@ def cap(rN):
def mainLoop(): def mainLoop():
gPlayer = GyroVector(0,1) gPlayer = GyroVector(0,1)
display = pygame.display.set_mode((1280,720)) display = pygame.display.set_mode((1280,720))
font = pygame.freetype.Font(None,24) font = pygame.freetype.Font(None,18)
while True: while True:
framestart = time_ns() framestart = time_ns()
@ -96,8 +95,10 @@ def mainLoop():
for i in drawn: for i in drawn:
pygame.draw.rect(display,i.color, (n,360 - (cap(i.height) * 500),10,cap(i.height) * 1000)) pygame.draw.rect(display,i.color, (n,360 - (cap(i.height) * 500),10,cap(i.height) * 1000))
n += 2 n += 2
font.render_to(display, (20, 150), str(gPlayer.cPos), (0, 0, 0))
font.render_to(display, (20, 250), str(gPlayer.cRot), (0, 0, 0)) font.render_to(display, (8, 8), "cPos: " + str(gPlayer.cPos), (255, 255, 255), (0, 0, 0))
font.render_to(display, (8, 26), "cRot: " + str(gPlayer.cRot), (255, 255, 255), (0, 0, 0))
pygame.display.update() pygame.display.update()
frameend = time_ns() frameend = time_ns()