Bugfix : supression de numpy dans le about

This commit is contained in:
Philippe Roy 2023-01-27 15:56:11 +01:00
parent ef8892f104
commit ca4ddfc21f
3 changed files with 19 additions and 13 deletions

View File

@ -2,7 +2,6 @@ import bge # Bibliothèque Blender Game Engine (UPBGE)
import bpy # Blender
import sys
import webbrowser
import numpy as np
###############################################################################
# twin_about.py
@ -143,10 +142,11 @@ def link(cont):
# Taille de l'écran
##
def get_near_pos(array,value):
array = np.asarray(array)
idx = (np.abs(array-value)).argmin()
return idx
def get_near_pos(value_list,value):
delta=[]
for i in range (len(value_list)):
delta.append(abs(value-value_list[i]))
return delta.index(min(delta))
# Taille de l'écran +
def screen_up(cont):
@ -156,6 +156,10 @@ def screen_up(cont):
screen_mode_txt=["640x360", "960x540", "1280x720", "1920x1080"]
i = get_near_pos(screen_width_mode, bge.render.getWindowWidth())
if i>=0 and i<3 :
if bge.render.getWindowWidth()<screen_width_mode[i]:
screen_width=screen_width_mode[i]
screen_height=screen_height_mode[i]
else:
screen_width=screen_width_mode[i+1]
screen_height=screen_height_mode[i+1]
scene.objects['About_screen']['Text']= "Taille écran : "+str(screen_width) +" x "+str(screen_height)
@ -183,6 +187,10 @@ def screen_down(cont):
screen_mode_txt=["640x360", "960x540", "1280x720", "1920x1080"]
i = get_near_pos(screen_width_mode, bge.render.getWindowWidth())
if i>0 and i<=3 :
if bge.render.getWindowWidth()>screen_width_mode[i]:
screen_width=screen_width_mode[i]
screen_height=screen_height_mode[i]
else:
screen_width=screen_width_mode[i-1]
screen_height=screen_height_mode[i-1]
scene.objects['About_screen']['Text']= "Taille écran : "+str(screen_width) +" x "+str(screen_height)

View File

@ -1,7 +1,7 @@
<data>
<screen>
<width>1280</width>
<height>720</height>
<width>1609</width>
<height>905</height>
<quality>1</quality>
</screen>
<plot>

View File

@ -1,8 +1,6 @@
import bge # Bibliothèque Blender Game Engine (UPBGE)
import numpy as np
import importlib
import time
import serial # Liaison série
import pyfirmata # Protocole Firmata
from serial.tools.list_ports import comports # Détection du port automatique