From 860026c56752673b69b59692d6d8a40c7d7873fb Mon Sep 17 00:00:00 2001
From: Frederic Aust <frederic.aust@hs-bochum.de>
Date: Fri, 5 Feb 2021 20:06:46 +0100
Subject: [PATCH] =?UTF-8?q?Bugfix:=20Realtimemode=20konnte=20auch=20au?=
 =?UTF-8?q?=C3=9Ferhalb=20des=20Trainingsmodus=20aktiviert=20werden,=20was?=
 =?UTF-8?q?=20das=20spielen=20zwischen=202=20Agenten=20potentiell=20sehr?=
 =?UTF-8?q?=20verlangsamen=20kann.\=20Die=20Unterscheidung=20ob=20L8=20ode?=
 =?UTF-8?q?r=20RGB8=20kann=20nun=20ueber=20die=20Einstellungen=20gewaehlt?=
 =?UTF-8?q?=20werden.=20Fallbach:=20L8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 Battle Pong/Main.gd | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/Battle Pong/Main.gd b/Battle Pong/Main.gd
index 7951019..5a743b8 100644
--- a/Battle Pong/Main.gd	
+++ b/Battle Pong/Main.gd	
@@ -278,7 +278,7 @@ func _on_data(id):
                         action_trainer_two = "nothing"          
                         
     if(next_step_player_one and next_step_player_two):
-        if($"/root/GameSettings".trainer_realtime_enabled):
+        if($"/root/GameSettings".trainings_mode_enabled and $"/root/GameSettings".trainer_realtime_enabled):
             yield(get_tree().create_timer(game_playtime_per_step), "timeout")
         unpause()
         $PlayerOne.run(game_playtime_per_step)
@@ -309,8 +309,12 @@ func get_screenshot():
     var thumbnail = get_viewport().get_texture().get_data()
     thumbnail.flip_y()    
     thumbnail.resize(100, 60 )
-    thumbnail.convert(Image.FORMAT_RGB8 ) # Farbe
-    #thumbnail.convert(Image.FORMAT_L8 ) # S/W
+    if $"/root/GameSettings".image_format == "RGB8": 
+        thumbnail.convert(Image.FORMAT_RGB8 ) # Farbe
+    elif $"/root/GameSettings".image_format =="L8":
+        thumbnail.convert(Image.FORMAT_L8 ) # S/W
+    else:
+        thumbnail.convert(Image.FORMAT_L8 ) # Settings
     
     #thumbnail.save_png('test.png') # Save Image as file - to debug
 
-- 
GitLab