mirror of
https://forge.apps.education.fr/blender-edutech/ropy.git
synced 2024-01-27 08:23:20 +01:00
Configuration de la qualité du rendu
This commit is contained in:
parent
fbc1069d4a
commit
53c7cac39b
BIN
ropy-32.blend
BIN
ropy-32.blend
Binary file not shown.
162
rp.py
162
rp.py
@ -3,11 +3,11 @@ import bpy # Blender
|
|||||||
import aud # Sounds
|
import aud # Sounds
|
||||||
import math
|
import math
|
||||||
import mathutils
|
import mathutils
|
||||||
import numpy as np
|
# import numpy as np
|
||||||
import time
|
import time
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
import webbrowser # Lien internet
|
# import webbrowser # Lien internet
|
||||||
import threading # Multithreading
|
import threading # Multithreading
|
||||||
import subprocess # Multiprocessus
|
import subprocess # Multiprocessus
|
||||||
import xml.etree.ElementTree as ET # Creating/parsing XML file
|
import xml.etree.ElementTree as ET # Creating/parsing XML file
|
||||||
@ -25,7 +25,7 @@ import rp_about # About
|
|||||||
# @project: Ropy (Blender-EduTech)
|
# @project: Ropy (Blender-EduTech)
|
||||||
# @lang: fr
|
# @lang: fr
|
||||||
# @authors: Philippe Roy <philippe.roy@ac-grenoble.fr>
|
# @authors: Philippe Roy <philippe.roy@ac-grenoble.fr>
|
||||||
# @copyright: Copyright (C) 2020-2022 Philippe Roy
|
# @copyright: Copyright (C) 2020-2023 Philippe Roy
|
||||||
# @license: GNU GPL
|
# @license: GNU GPL
|
||||||
#
|
#
|
||||||
# Ropy est destiné à la découverte de la programmation procédurale et du language Python.
|
# Ropy est destiné à la découverte de la programmation procédurale et du language Python.
|
||||||
@ -413,9 +413,16 @@ def cmd_init(cont):
|
|||||||
if cont.sensors['Init'].positive == False: # 1 seule fois
|
if cont.sensors['Init'].positive == False: # 1 seule fois
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# Taille de la fenêtre
|
# Configuration de l'écran
|
||||||
# Read config (screen size : data/config/screen/width-> [0][3][0].text)
|
|
||||||
bge.render.setWindowSize(int(rp_config_tree[0][3][0].text),int(rp_config_tree[0][3][1].text))
|
bge.render.setWindowSize(int(rp_config_tree[0][3][0].text),int(rp_config_tree[0][3][1].text))
|
||||||
|
quality_eevee=('NOSMAA', 'LOW', 'MEDIUM','HIGH','ULTRA')
|
||||||
|
scene.objects['About']['quality'] = int(rp_config_tree[0][3][2].text)
|
||||||
|
if quality_eevee[scene.objects['About']['quality']] == 'NOSMAA':
|
||||||
|
eevee.smaa_quality= 'LOW'
|
||||||
|
eevee.use_eevee_smaa = False
|
||||||
|
else:
|
||||||
|
eevee.use_eevee_smaa = True
|
||||||
|
eevee.smaa_quality= quality_eevee[scene.objects['About']['quality']]
|
||||||
|
|
||||||
# UI : Commands
|
# UI : Commands
|
||||||
scene.objects['Run-Hl'].setVisible(False,False)
|
scene.objects['Run-Hl'].setVisible(False,False)
|
||||||
@ -708,10 +715,19 @@ def mode(cont):
|
|||||||
rp_config_tree[0][2][0].text=str(scene.objects['Camera']['current_lx'])
|
rp_config_tree[0][2][0].text=str(scene.objects['Camera']['current_lx'])
|
||||||
rp_config_tree[0][2][1].text=str(scene.objects['Camera']['current_ly'])
|
rp_config_tree[0][2][1].text=str(scene.objects['Camera']['current_ly'])
|
||||||
rp_config_tree[0][2][2].text=str(scene.objects['Camera']['current_lz'])
|
rp_config_tree[0][2][2].text=str(scene.objects['Camera']['current_lz'])
|
||||||
# print ("Fin :", scene.objects['Camera'].worldPosition.x, scene.objects['Camera'].worldPosition.y, scene.objects['Camera'].worldPosition.z)
|
|
||||||
|
# Maj du fichier de config (screen size : data/config/screen/width, height, quality-> [0][3][0].text, [0][3][1].text, [0][3][2].text)
|
||||||
|
screen_width = bge.render.getWindowWidth()
|
||||||
|
screen_height = bge.render.getWindowHeight()
|
||||||
|
rp_config_tree[0][3][0].text=str(screen_width)
|
||||||
|
rp_config_tree[0][3][1].text=str(screen_height)
|
||||||
|
rp_config_tree[0][3][2].text=str(scene.objects['About']['quality'])
|
||||||
|
|
||||||
buffer_xml = ET.tostring(rp_config_tree)
|
buffer_xml = ET.tostring(rp_config_tree)
|
||||||
with open("rp_config.xml", "wb") as f:
|
with open("rp_config.xml", "wb") as f:
|
||||||
f.write(buffer_xml)
|
f.write(buffer_xml)
|
||||||
|
|
||||||
|
# Sortir
|
||||||
bge.logic.endGame()
|
bge.logic.endGame()
|
||||||
|
|
||||||
# Fenêtre modale (inhibition des touches hors ESC)
|
# Fenêtre modale (inhibition des touches hors ESC)
|
||||||
@ -1415,78 +1431,78 @@ def about_close_click(cont):
|
|||||||
sound_play (snd_close)
|
sound_play (snd_close)
|
||||||
about_close()
|
about_close()
|
||||||
|
|
||||||
##
|
# ##
|
||||||
# Configuration de l'écran
|
# # Configuration de l'écran
|
||||||
##
|
# ##
|
||||||
|
|
||||||
def get_near_pos(array,value):
|
# def get_near_pos(array,value):
|
||||||
array = np.asarray(array)
|
# array = np.asarray(array)
|
||||||
idx = (np.abs(array-value)).argmin()
|
# idx = (np.abs(array-value)).argmin()
|
||||||
return idx
|
# return idx
|
||||||
|
|
||||||
def about_screen_up(cont):
|
# def about_screen_up(cont):
|
||||||
if cont.sensors['Click'].status == JUST_ACTIVATED and cont.sensors['MO'].positive :
|
# if cont.sensors['Click'].status == JUST_ACTIVATED and cont.sensors['MO'].positive :
|
||||||
screen_width_mode=[640, 960, 1280, 1920]
|
# screen_width_mode=[640, 960, 1280, 1920]
|
||||||
screen_height_mode=[360, 540, 720,1080]
|
# screen_height_mode=[360, 540, 720,1080]
|
||||||
screen_mode_txt=["640x360", "960x540", "1280x720", "1920x1080"]
|
# screen_mode_txt=["640x360", "960x540", "1280x720", "1920x1080"]
|
||||||
i = get_near_pos(screen_width_mode, bge.render.getWindowWidth())
|
# i = get_near_pos(screen_width_mode, bge.render.getWindowWidth())
|
||||||
if i>=0 and i<3 :
|
# if i>=0 and i<3 :
|
||||||
screen_width=screen_width_mode[i+1]
|
# screen_width=screen_width_mode[i+1]
|
||||||
screen_height=screen_height_mode[i+1]
|
# screen_height=screen_height_mode[i+1]
|
||||||
scene.objects['About_screen']['Text']= "SCREEN SIZE : "+str(screen_width) +" x "+str(screen_height)
|
# scene.objects['About_screen']['Text']= "SCREEN SIZE : "+str(screen_width) +" x "+str(screen_height)
|
||||||
bge.render.setWindowSize(screen_width,screen_height)
|
# bge.render.setWindowSize(screen_width,screen_height)
|
||||||
|
|
||||||
# Boutons < et >
|
# # Boutons < et >
|
||||||
if screen_width <=640:
|
# if screen_width <=640:
|
||||||
scene.objects['About_screen-down'].setVisible(False,True)
|
# scene.objects['About_screen-down'].setVisible(False,True)
|
||||||
scene.objects['About_screen-down-colbox'].suspendPhysics (True)
|
# scene.objects['About_screen-down-colbox'].suspendPhysics (True)
|
||||||
else:
|
# else:
|
||||||
scene.objects['About_screen-down'].setVisible(True,True)
|
# scene.objects['About_screen-down'].setVisible(True,True)
|
||||||
scene.objects['About_screen-down-colbox'].restorePhysics()
|
# scene.objects['About_screen-down-colbox'].restorePhysics()
|
||||||
if screen_width >= 1920:
|
# if screen_width >= 1920:
|
||||||
scene.objects['About_screen-up'].setVisible(False,True)
|
# scene.objects['About_screen-up'].setVisible(False,True)
|
||||||
scene.objects['About_screen-up-colbox'].suspendPhysics (True)
|
# scene.objects['About_screen-up-colbox'].suspendPhysics (True)
|
||||||
else:
|
# else:
|
||||||
scene.objects['About_screen-up'].setVisible(True,True)
|
# scene.objects['About_screen-up'].setVisible(True,True)
|
||||||
scene.objects['About_screen-up-colbox'].restorePhysics()
|
# scene.objects['About_screen-up-colbox'].restorePhysics()
|
||||||
|
|
||||||
# Maj du fichier de config (screen size : data/config/screen/width-> [0][3][0].text)
|
# # Maj du fichier de config (screen size : data/config/screen/width-> [0][3][0].text)
|
||||||
rp_config_tree[0][3][0].text=str(screen_width)
|
# rp_config_tree[0][3][0].text=str(screen_width)
|
||||||
rp_config_tree[0][3][1].text=str(screen_height)
|
# rp_config_tree[0][3][1].text=str(screen_height)
|
||||||
buffer_xml = ET.tostring(rp_config_tree)
|
# buffer_xml = ET.tostring(rp_config_tree)
|
||||||
with open("rp_config.xml", "wb") as f:
|
# with open("rp_config.xml", "wb") as f:
|
||||||
f.write(buffer_xml)
|
# f.write(buffer_xml)
|
||||||
|
|
||||||
def about_screen_down(cont):
|
# def about_screen_down(cont):
|
||||||
if cont.sensors['Click'].status == JUST_ACTIVATED and cont.sensors['MO'].positive :
|
# if cont.sensors['Click'].status == JUST_ACTIVATED and cont.sensors['MO'].positive :
|
||||||
screen_width_mode=[640, 960, 1280, 1920]
|
# screen_width_mode=[640, 960, 1280, 1920]
|
||||||
screen_height_mode=[360, 540, 720,1080]
|
# screen_height_mode=[360, 540, 720,1080]
|
||||||
screen_mode_txt=["640x360", "960x540", "1280x720", "1920x1080"]
|
# screen_mode_txt=["640x360", "960x540", "1280x720", "1920x1080"]
|
||||||
i = get_near_pos(screen_width_mode, bge.render.getWindowWidth())
|
# i = get_near_pos(screen_width_mode, bge.render.getWindowWidth())
|
||||||
if i>0 and i<=3 :
|
# if i>0 and i<=3 :
|
||||||
screen_width=screen_width_mode[i-1]
|
# screen_width=screen_width_mode[i-1]
|
||||||
screen_height=screen_height_mode[i-1]
|
# screen_height=screen_height_mode[i-1]
|
||||||
scene.objects['About_screen']['Text']= "SCREEN SIZE : "+str(screen_width) +" x "+str(screen_height)
|
# scene.objects['About_screen']['Text']= "SCREEN SIZE : "+str(screen_width) +" x "+str(screen_height)
|
||||||
bge.render.setWindowSize(screen_width,screen_height)
|
# bge.render.setWindowSize(screen_width,screen_height)
|
||||||
|
|
||||||
# Boutons < et >
|
# # Boutons < et >
|
||||||
if screen_width <=640:
|
# if screen_width <=640:
|
||||||
scene.objects['About_screen-down'].setVisible(False,True)
|
# scene.objects['About_screen-down'].setVisible(False,True)
|
||||||
scene.objects['About_screen-down-colbox'].suspendPhysics (True)
|
# scene.objects['About_screen-down-colbox'].suspendPhysics (True)
|
||||||
else:
|
# else:
|
||||||
scene.objects['About_screen-down'].setVisible(True,True)
|
# scene.objects['About_screen-down'].setVisible(True,True)
|
||||||
scene.objects['About_screen-down-colbox'].restorePhysics()
|
# scene.objects['About_screen-down-colbox'].restorePhysics()
|
||||||
if screen_width >= 1920:
|
# if screen_width >= 1920:
|
||||||
scene.objects['About_screen-up'].setVisible(False,True)
|
# scene.objects['About_screen-up'].setVisible(False,True)
|
||||||
scene.objects['About_screen-up-colbox'].suspendPhysics (True)
|
# scene.objects['About_screen-up-colbox'].suspendPhysics (True)
|
||||||
else:
|
# else:
|
||||||
scene.objects['About_screen-up'].setVisible(True,True)
|
# scene.objects['About_screen-up'].setVisible(True,True)
|
||||||
scene.objects['About_screen-up-colbox'].restorePhysics()
|
# scene.objects['About_screen-up-colbox'].restorePhysics()
|
||||||
|
|
||||||
# Maj du fichier de config (screen size : data/config/screen/width-> [0][3][0].text)
|
# # Maj du fichier de config (screen size : data/config/screen/width-> [0][3][0].text)
|
||||||
rp_config_tree[0][3][0].text=str(screen_width)
|
# rp_config_tree[0][3][0].text=str(screen_width)
|
||||||
rp_config_tree[0][3][1].text=str(screen_height)
|
# rp_config_tree[0][3][1].text=str(screen_height)
|
||||||
buffer_xml = ET.tostring(rp_config_tree)
|
# buffer_xml = ET.tostring(rp_config_tree)
|
||||||
with open("rp_config.xml", "wb") as f:
|
# with open("rp_config.xml", "wb") as f:
|
||||||
f.write(buffer_xml)
|
# f.write(buffer_xml)
|
||||||
|
|
||||||
|
172
rp_about.py
172
rp_about.py
@ -1,4 +1,6 @@
|
|||||||
import bge # Bibliothèque Blender Game Engine (UPBGE)
|
import bge # Bibliothèque Blender Game Engine (UPBGE)
|
||||||
|
import bpy # Blender
|
||||||
|
import sys
|
||||||
import webbrowser
|
import webbrowser
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
@ -7,11 +9,13 @@ import webbrowser
|
|||||||
# @project: Ropy (Blender-EduTech)
|
# @project: Ropy (Blender-EduTech)
|
||||||
# @lang: fr
|
# @lang: fr
|
||||||
# @authors: Philippe Roy <philippe.roy@ac-grenoble.fr>
|
# @authors: Philippe Roy <philippe.roy@ac-grenoble.fr>
|
||||||
# @copyright: Copyright (C) 2022 Philippe Roy
|
# @copyright: Copyright (C) 2022-2023 Philippe Roy
|
||||||
# @license: GNU GPL
|
# @license: GNU GPL
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
|
# UPBGE scene
|
||||||
scene = bge.logic.getCurrentScene()
|
scene = bge.logic.getCurrentScene()
|
||||||
|
eevee = bpy.context.scene.eevee
|
||||||
|
|
||||||
# Colors
|
# Colors
|
||||||
color_link = (0, 1, 0.857,1) # Turquoise
|
color_link = (0, 1, 0.857,1) # Turquoise
|
||||||
@ -58,10 +62,19 @@ def open():
|
|||||||
# Configuration
|
# Configuration
|
||||||
scene.objects['About_screen-up'].color= color_link
|
scene.objects['About_screen-up'].color= color_link
|
||||||
scene.objects['About_screen-down'].color= color_link
|
scene.objects['About_screen-down'].color= color_link
|
||||||
scene.objects['About_screen']['Text']= "SCREEN SIZE : "+str(bge.render.getWindowWidth()) +" x "+str(bge.render.getWindowHeight())
|
scene.objects['About_screen']['Text']= "Taille écran : "+str(bge.render.getWindowWidth()) +" x "+str(bge.render.getWindowHeight())
|
||||||
scene.objects['About_quality-up'].color= color_link
|
scene.objects['About_quality-up'].color= color_link
|
||||||
scene.objects['About_quality-down'].color= color_link
|
scene.objects['About_quality-down'].color= color_link
|
||||||
|
quality_txt=("Inconvenant", "Basse", "Moyenne", "Haute", "Épique")
|
||||||
|
scene.objects['About_quality']['Text']= "Qualité : "+quality_txt[scene.objects['About']['quality']]
|
||||||
|
|
||||||
|
# # Configuration
|
||||||
|
# scene.objects['About_screen-up'].color= color_link
|
||||||
|
# scene.objects['About_screen-down'].color= color_link
|
||||||
# scene.objects['About_screen']['Text']= "SCREEN SIZE : "+str(bge.render.getWindowWidth()) +" x "+str(bge.render.getWindowHeight())
|
# scene.objects['About_screen']['Text']= "SCREEN SIZE : "+str(bge.render.getWindowWidth()) +" x "+str(bge.render.getWindowHeight())
|
||||||
|
# scene.objects['About_quality-up'].color= color_link
|
||||||
|
# scene.objects['About_quality-down'].color= color_link
|
||||||
|
# # scene.objects['About_screen']['Text']= "SCREEN SIZE : "+str(bge.render.getWindowWidth()) +" x "+str(bge.render.getWindowHeight())
|
||||||
|
|
||||||
# Liens
|
# Liens
|
||||||
scene.objects['About_link-git'].color= color_link
|
scene.objects['About_link-git'].color= color_link
|
||||||
@ -74,7 +87,7 @@ def open():
|
|||||||
scene.objects['About']['timer'] = 0
|
scene.objects['About']['timer'] = 0
|
||||||
scene.objects['About']['anim'] = True
|
scene.objects['About']['anim'] = True
|
||||||
|
|
||||||
# Boutons < et > ("640x360", "960x540", "1280x720", "1920x1080")
|
# Taille de l'écran : Boutons < et > ("640x360", "960x540", "1280x720", "1920x1080")
|
||||||
if bge.render.getWindowWidth() <=640:
|
if bge.render.getWindowWidth() <=640:
|
||||||
scene.objects['About_screen-down'].setVisible(False,True)
|
scene.objects['About_screen-down'].setVisible(False,True)
|
||||||
scene.objects['About_screen-down-colbox'].suspendPhysics (True)
|
scene.objects['About_screen-down-colbox'].suspendPhysics (True)
|
||||||
@ -88,6 +101,34 @@ def open():
|
|||||||
scene.objects['About_screen-up'].setVisible(True,True)
|
scene.objects['About_screen-up'].setVisible(True,True)
|
||||||
scene.objects['About_screen-up-colbox'].restorePhysics()
|
scene.objects['About_screen-up-colbox'].restorePhysics()
|
||||||
|
|
||||||
|
# Qualité du rendu : Boutons < et >
|
||||||
|
if scene.objects['About']['quality']==4:
|
||||||
|
scene.objects['About_quality-up'].setVisible(False,True)
|
||||||
|
scene.objects['About_quality-up-colbox'].suspendPhysics (True)
|
||||||
|
else:
|
||||||
|
scene.objects['About_quality-up'].setVisible(True,True)
|
||||||
|
scene.objects['About_quality-up-colbox'].restorePhysics()
|
||||||
|
if scene.objects['About']['quality']==0:
|
||||||
|
scene.objects['About_quality-down'].setVisible(False,True)
|
||||||
|
scene.objects['About_quality-down-colbox'].suspendPhysics (True)
|
||||||
|
else:
|
||||||
|
scene.objects['About_quality-down'].setVisible(True,True)
|
||||||
|
scene.objects['About_quality-down-colbox'].restorePhysics()
|
||||||
|
|
||||||
|
# # Boutons < et > ("640x360", "960x540", "1280x720", "1920x1080")
|
||||||
|
# if bge.render.getWindowWidth() <=640:
|
||||||
|
# scene.objects['About_screen-down'].setVisible(False,True)
|
||||||
|
# scene.objects['About_screen-down-colbox'].suspendPhysics (True)
|
||||||
|
# else:
|
||||||
|
# scene.objects['About_screen-down'].setVisible(True,True)
|
||||||
|
# scene.objects['About_screen-down-colbox'].restorePhysics()
|
||||||
|
# if bge.render.getWindowWidth() >= 1920:
|
||||||
|
# scene.objects['About_screen-up'].setVisible(False,True)
|
||||||
|
# scene.objects['About_screen-up-colbox'].suspendPhysics (True)
|
||||||
|
# else:
|
||||||
|
# scene.objects['About_screen-up'].setVisible(True,True)
|
||||||
|
# scene.objects['About_screen-up-colbox'].restorePhysics()
|
||||||
|
|
||||||
##
|
##
|
||||||
# Animation de l'ouverture
|
# Animation de l'ouverture
|
||||||
##
|
##
|
||||||
@ -193,3 +234,128 @@ def credits_link(cont):
|
|||||||
obj = cont.owner
|
obj = cont.owner
|
||||||
idx=int(obj.name[12:-7])
|
idx=int(obj.name[12:-7])
|
||||||
webbrowser.open(credits_description[list(credits_description)[idx-1]][2])
|
webbrowser.open(credits_description[list(credits_description)[idx-1]][2])
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# Configuration
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
##
|
||||||
|
# Taille de l'écran
|
||||||
|
##
|
||||||
|
|
||||||
|
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):
|
||||||
|
if cont.sensors['Click'].status == JUST_ACTIVATED and cont.sensors['MO'].positive :
|
||||||
|
screen_width_mode=[640, 960, 1280, 1920]
|
||||||
|
screen_height_mode=[360, 540, 720,1080]
|
||||||
|
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)
|
||||||
|
bge.render.setWindowSize(screen_width,screen_height)
|
||||||
|
|
||||||
|
# Boutons < et >
|
||||||
|
if screen_width <=640:
|
||||||
|
scene.objects['About_screen-down'].setVisible(False,True)
|
||||||
|
scene.objects['About_screen-down-colbox'].suspendPhysics (True)
|
||||||
|
else:
|
||||||
|
scene.objects['About_screen-down'].setVisible(True,True)
|
||||||
|
scene.objects['About_screen-down-colbox'].restorePhysics()
|
||||||
|
if screen_width >= 1920:
|
||||||
|
scene.objects['About_screen-up'].setVisible(False,True)
|
||||||
|
scene.objects['About_screen-up-colbox'].suspendPhysics (True)
|
||||||
|
else:
|
||||||
|
scene.objects['About_screen-up'].setVisible(True,True)
|
||||||
|
scene.objects['About_screen-up-colbox'].restorePhysics()
|
||||||
|
|
||||||
|
# Taille de l'écran -
|
||||||
|
def screen_down(cont):
|
||||||
|
if cont.sensors['Click'].status == JUST_ACTIVATED and cont.sensors['MO'].positive :
|
||||||
|
screen_width_mode=[640, 960, 1280, 1920]
|
||||||
|
screen_height_mode=[360, 540, 720,1080]
|
||||||
|
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)
|
||||||
|
bge.render.setWindowSize(screen_width,screen_height)
|
||||||
|
|
||||||
|
# Boutons < et >
|
||||||
|
if screen_width <=640:
|
||||||
|
scene.objects['About_screen-down'].setVisible(False,True)
|
||||||
|
scene.objects['About_screen-down-colbox'].suspendPhysics (True)
|
||||||
|
else:
|
||||||
|
scene.objects['About_screen-down'].setVisible(True,True)
|
||||||
|
scene.objects['About_screen-down-colbox'].restorePhysics()
|
||||||
|
if screen_width >= 1920:
|
||||||
|
scene.objects['About_screen-up'].setVisible(False,True)
|
||||||
|
scene.objects['About_screen-up-colbox'].suspendPhysics (True)
|
||||||
|
else:
|
||||||
|
scene.objects['About_screen-up'].setVisible(True,True)
|
||||||
|
scene.objects['About_screen-up-colbox'].restorePhysics()
|
||||||
|
|
||||||
|
##
|
||||||
|
# Qualité du rendu
|
||||||
|
##
|
||||||
|
|
||||||
|
def quality_up(cont):
|
||||||
|
if cont.sensors['Click'].status == JUST_ACTIVATED and cont.sensors['MO'].positive :
|
||||||
|
quality_txt=("Inconvenant", "Basse", "Moyenne", "Haute", "Épique")
|
||||||
|
quality_eevee=('NOSMAA', 'LOW', 'MEDIUM','HIGH','ULTRA')
|
||||||
|
scene.objects['About']['quality'] +=1
|
||||||
|
scene.objects['About_quality']['Text']= "Qualité : "+quality_txt[scene.objects['About']['quality']]
|
||||||
|
if quality_eevee[scene.objects['About']['quality']] == 'NOSMAA':
|
||||||
|
eevee.smaa_quality= 'LOW'
|
||||||
|
eevee.use_eevee_smaa = False
|
||||||
|
else:
|
||||||
|
eevee.use_eevee_smaa = True
|
||||||
|
# print (sys.platform)
|
||||||
|
if sys.platform=="linux": # Plantage sur Windows
|
||||||
|
eevee.smaa_quality= quality_eevee[scene.objects['About']['quality']]
|
||||||
|
|
||||||
|
# Boutons < et >
|
||||||
|
if scene.objects['About']['quality']==4:
|
||||||
|
scene.objects['About_quality-up'].setVisible(False,True)
|
||||||
|
scene.objects['About_quality-up-colbox'].suspendPhysics (True)
|
||||||
|
if scene.objects['About']['quality']==1:
|
||||||
|
scene.objects['About_quality-down'].setVisible(True,True)
|
||||||
|
scene.objects['About_quality-down-colbox'].restorePhysics()
|
||||||
|
|
||||||
|
def quality_down(cont):
|
||||||
|
if cont.sensors['Click'].status == JUST_ACTIVATED and cont.sensors['MO'].positive :
|
||||||
|
quality_txt=("Inconvenant", "Basse", "Moyenne", "Haute", "Épique")
|
||||||
|
quality_eevee=('NOSMAA', 'LOW', 'MEDIUM','HIGH','ULTRA')
|
||||||
|
scene.objects['About']['quality'] -=1
|
||||||
|
scene.objects['About_quality']['Text']= "Qualité : "+quality_txt[scene.objects['About']['quality']]
|
||||||
|
if quality_eevee[scene.objects['About']['quality']] == 'NOSMAA':
|
||||||
|
eevee.smaa_quality= 'LOW'
|
||||||
|
eevee.use_eevee_smaa = False
|
||||||
|
else:
|
||||||
|
eevee.use_eevee_smaa = True
|
||||||
|
if sys.platform=="Linux": # Plantage sur Windows
|
||||||
|
eevee.smaa_quality= quality_eevee[scene.objects['About']['quality']]
|
||||||
|
|
||||||
|
# Boutons < et >
|
||||||
|
if scene.objects['About']['quality']==0:
|
||||||
|
scene.objects['About_quality-down'].setVisible(False,True)
|
||||||
|
scene.objects['About_quality-down-colbox'].suspendPhysics (True)
|
||||||
|
if scene.objects['About']['quality']==3:
|
||||||
|
scene.objects['About_quality-up'].setVisible(True,True)
|
||||||
|
scene.objects['About_quality-up-colbox'].restorePhysics()
|
||||||
|
42
rp_cmd-bak.py
Normal file
42
rp_cmd-bak.py
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
import time
|
||||||
|
from rp_lib import * # Bibliothèque Ropy
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# rp_cmd.py
|
||||||
|
# @title: Commandes pour le Rover Ropy
|
||||||
|
# @project: Ropy (Blender-EduTech)
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# Initialisation du niveau :
|
||||||
|
# Niveau 1 : Les premiers pas de Ropy
|
||||||
|
# Niveau 2 : Ma première fonction
|
||||||
|
# Niveau 3 : Sécuriser Ropy
|
||||||
|
# Niveau 4 : Partir au bout du monde
|
||||||
|
# Niveau 5 : Faire face à l'inconnu
|
||||||
|
# Niveau 6 : Se rendre utile
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# Fonctions
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# Commandes
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
def commandes():
|
||||||
|
|
||||||
|
# Ecrire votre code ici ...
|
||||||
|
|
||||||
|
rp_fin() # A garder
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# En: External call << DONT CHANGE THIS SECTION >>
|
||||||
|
# Fr: Appel externe << NE PAS MODIFIER CETTE SECTION >>
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
if __name__=='start':
|
||||||
|
thread_cmd_start(commandes)
|
||||||
|
if __name__=='stop':
|
||||||
|
thread_cmd_stop()
|
@ -2,7 +2,7 @@ import time
|
|||||||
from rp_lib import * # Bibliothèque Ropy
|
from rp_lib import * # Bibliothèque Ropy
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# rp_cmd-microbit.py
|
# rp_cmd.py
|
||||||
# @title: Commandes pour le Rover Ropy
|
# @title: Commandes pour le Rover Ropy
|
||||||
# @project: Ropy (Blender-EduTech)
|
# @project: Ropy (Blender-EduTech)
|
||||||
###############################################################################
|
###############################################################################
|
||||||
@ -27,7 +27,6 @@ from rp_lib import * # Bibliothèque Ropy
|
|||||||
|
|
||||||
def commandes():
|
def commandes():
|
||||||
|
|
||||||
# Ecrire votre code ici ...
|
|
||||||
print ('okok')
|
print ('okok')
|
||||||
rp_gauche()
|
rp_gauche()
|
||||||
rp_avancer()
|
rp_avancer()
|
||||||
|
26
rp_config-bak.xml
Normal file
26
rp_config-bak.xml
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<data>
|
||||||
|
<config>
|
||||||
|
<speed>1.0</speed>
|
||||||
|
<sound>False</sound>
|
||||||
|
<cam>
|
||||||
|
<worldPosition.x>0.0057830810546875</worldPosition.x>
|
||||||
|
<worldPosition.y>-26.440298080444336</worldPosition.y>
|
||||||
|
<worldPosition.z>20.22315788269043</worldPosition.z>
|
||||||
|
</cam>
|
||||||
|
<screen>
|
||||||
|
<width>1280</width>
|
||||||
|
<height>720</height>
|
||||||
|
<quality>1</quality>
|
||||||
|
</screen>
|
||||||
|
</config>
|
||||||
|
<mission>
|
||||||
|
<current>1</current>
|
||||||
|
<level>1</level>
|
||||||
|
</mission>
|
||||||
|
<upgrade>
|
||||||
|
<battery>False</battery>
|
||||||
|
<beacon>False</beacon>
|
||||||
|
<paint>False</paint>
|
||||||
|
<speed>False</speed>
|
||||||
|
</upgrade>
|
||||||
|
</data>
|
@ -8,8 +8,9 @@
|
|||||||
<worldPosition.z>20.22315788269043</worldPosition.z>
|
<worldPosition.z>20.22315788269043</worldPosition.z>
|
||||||
</cam>
|
</cam>
|
||||||
<screen>
|
<screen>
|
||||||
<width>1280</width>
|
<width>1632</width>
|
||||||
<height>720</height>
|
<height>918</height>
|
||||||
|
<quality>1</quality>
|
||||||
</screen>
|
</screen>
|
||||||
</config>
|
</config>
|
||||||
<mission>
|
<mission>
|
||||||
|
@ -8,7 +8,7 @@ import webbrowser
|
|||||||
# @project: Ropy (Blender-EduTech)
|
# @project: Ropy (Blender-EduTech)
|
||||||
# @lang: fr
|
# @lang: fr
|
||||||
# @authors: Philippe Roy <philippe.roy@ac-grenoble.fr>
|
# @authors: Philippe Roy <philippe.roy@ac-grenoble.fr>
|
||||||
# @copyright: Copyright (C) 2020-2022 Philippe Roy
|
# @copyright: Copyright (C) 2020-2023 Philippe Roy
|
||||||
# @license: GNU GPL
|
# @license: GNU GPL
|
||||||
#
|
#
|
||||||
# Ropy est destiné à la découverte de la programmation procédurale et du language Python.
|
# Ropy est destiné à la découverte de la programmation procédurale et du language Python.
|
||||||
|
@ -19,7 +19,7 @@ import rp_map1 as rp_map # Map definition
|
|||||||
# @project: Ropy (Blender-EduTech)
|
# @project: Ropy (Blender-EduTech)
|
||||||
# @lang: fr
|
# @lang: fr
|
||||||
# @authors: Philippe Roy <philippe.roy@ac-grenoble.fr>
|
# @authors: Philippe Roy <philippe.roy@ac-grenoble.fr>
|
||||||
# @copyright: Copyright (C) 2020-2022 Philippe Roy
|
# @copyright: Copyright (C) 2020-2023 Philippe Roy
|
||||||
# @license: GNU GPL
|
# @license: GNU GPL
|
||||||
#
|
#
|
||||||
# Bibliothèque des actions du robot
|
# Bibliothèque des actions du robot
|
||||||
|
Loading…
Reference in New Issue
Block a user