diff --git a/ropy-28.blend b/ropy-28.blend index 6bab38f..39945ed 100644 Binary files a/ropy-28.blend and b/ropy-28.blend differ diff --git a/rp.py b/rp.py index 9554b5f..0b428cf 100644 --- a/rp.py +++ b/rp.py @@ -1349,32 +1349,46 @@ def about_close_click(cont): # Configuration de l'écran ## -def getnearpos(array,value): +def get_near_pos(array,value): array = np.asarray(array) idx = (np.abs(array-value)).argmin() return idx -def about_screen(cont): +def about_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 = getnearpos(screen_width_mode, bge.render.getWindowWidth()) + i = get_near_pos(screen_width_mode, bge.render.getWindowWidth()) if i>=0 and i<3 : screen_width=screen_width_mode[i+1] screen_height=screen_height_mode[i+1] - elif i==3 : - screen_width=screen_width_mode[0] - screen_height=screen_height_mode[0] - else: - screen_width=screen_width_mode[1] - screen_height=screen_height_mode[1] - scene.objects['About_screen']['Text']= "SCREEN SIZE : "+str(screen_width) +" x "+str(screen_height) - bge.render.setWindowSize(screen_width,screen_height) + scene.objects['About_screen']['Text']= "SCREEN SIZE : "+str(screen_width) +" x "+str(screen_height) + bge.render.setWindowSize(screen_width,screen_height) + + # 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][1].text=str(screen_height) + buffer_xml = ET.tostring(rp_config_tree) + with open("rp_config.xml", "wb") as f: + f.write(buffer_xml) + +def about_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 : + screen_width=screen_width_mode[i-1] + screen_height=screen_height_mode[i-1] + scene.objects['About_screen']['Text']= "SCREEN SIZE : "+str(screen_width) +" x "+str(screen_height) + bge.render.setWindowSize(screen_width,screen_height) + + # 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][1].text=str(screen_height) + buffer_xml = ET.tostring(rp_config_tree) + with open("rp_config.xml", "wb") as f: + f.write(buffer_xml) - # 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][1].text=str(screen_height) - buffer_xml = ET.tostring(rp_config_tree) - with open("rp_config.xml", "wb") as f: - f.write(buffer_xml) diff --git a/rp_about.py b/rp_about.py index f61e30f..30774dc 100644 --- a/rp_about.py +++ b/rp_about.py @@ -29,7 +29,8 @@ ACTIVATE = bge.logic.KX_INPUT_ACTIVE def open(): scene.objects['About_close'].color= color_link - scene.objects['About_screen'].color= color_link + 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_link-git'].color= color_link diff --git a/rp_config.xml b/rp_config.xml index f13a7df..aae8bf8 100644 --- a/rp_config.xml +++ b/rp_config.xml @@ -8,8 +8,8 @@ 20.22315788269043 - 960 - 540 + 1280 + 720 diff --git a/rp_doc.py b/rp_doc.py index 445fd0c..0e44eac 100644 --- a/rp_doc.py +++ b/rp_doc.py @@ -73,7 +73,7 @@ card_description.update({"detect-card" : [rp_detect_title, rp_detect_text, rp_de # Radar rp_radar_title="Radar" -rp_radar_text=" Le radar n'est toujours pas \n opérationnel ! \n\n Mais où est donc encore passé Thomas ! \n\n\n\n\n\n\n\n" +rp_radar_text=" Le radar n'est toujours pas \n opérationnel ! \n\n Mais où est donc encore passé Thomas ! \n\n\n\n\n\n\n\n\n" rp_radar_type="mission" card_description.update({"radar-card" : [rp_radar_title, rp_radar_text, rp_radar_type]}) @@ -131,7 +131,7 @@ python_card=["function-card", "alternative-card", "loop-card", "flow-card", "con rp_function_title="Fonction" rp_function_text=" La définition d'une fonction se fait \n avec \"def\". La fonction peut \n renvoyer une valeur avec \"return\". \n\n" rp_function_text=rp_function_text + " def fonction_1 (arguments) : \n instruction_1 \n instruction_2 \n ....\n return valeurs_renvoyées \n\n" -rp_function_text=rp_function_text + " Les arguments sont des données \n transmises à la fonction." +rp_function_text=rp_function_text + " Les arguments sont des données \n transmises à la fonction. \n\n" rp_function_url=[["w3schools.com : functions","https://www.w3schools.com/python/python_functions.asp"]] card_description.update({"function-card" : [rp_function_title, rp_function_text, rp_function_url]}) @@ -271,6 +271,8 @@ def open(): scene.objects['Doc'].worldPosition = [0, -21, 15.8] scene.objects['Doc_close'].color = color_doc_chap scene.objects['Doc'].setVisible(True,True) + scene.objects['Doc_title']['Text'] = "" + scene.objects['Doc_text']['Text'] = "" scene.objects['Doc_title'].setVisible(False,True) scene.objects['Doc_text'].setVisible(False,True) @@ -298,10 +300,10 @@ def open(): for i in range(len(upgrade_card)): if scene.objects['Points']['upgrade_'+upgrade_card[i]]==True: scene.objects[upgrade_card[i]+'-card'].setVisible(True,True) - scene.objects[upgrade_card[i]+'-card_colbox'].restorePhysics() + scene.objects[upgrade_card[i]+'-card-colbox'].restorePhysics() else: scene.objects[upgrade_card[i]+'-card'].setVisible(False,True) - scene.objects[upgrade_card[i]+'-card_colbox'].suspendPhysics() + scene.objects[upgrade_card[i]+'-card-colbox'].suspendPhysics() # URL Python if name_chap == "python": @@ -431,6 +433,8 @@ def chapter(cont): if cont.sensors['Click'].status == JUST_ACTIVATED and cont.sensors['MO'].positive and cont.sensors['Click'].positive: # sound_play (sndbuff_book_flip) obj = cont.owner + scene.objects['Doc_title']['Text'] = "" + scene.objects['Doc_text']['Text'] = "" # Enlever l'ancien chapitre scene.objects['Doc-'+scene.objects['Doc']['page_chap']].color = color_doc_chap @@ -508,8 +512,8 @@ def card (cont): obj = cont.owner name_chap = scene.objects['Doc']['page_chap'] name_fct= obj.name[:-7] - scene.objects['Doc_title']['Text'] = " " - scene.objects['Doc_text']['Text'] = " " + scene.objects['Doc_title']['Text'] = "" + scene.objects['Doc_text']['Text'] = "" # Enlever l'ancienne carte if scene.objects['Doc_chap-'+name_chap]['page_fct'] !="":