Browse Source

adding things2

shuvit 6 years ago
parent
commit
f60e474d8e
4 changed files with 130 additions and 16 deletions
  1. 8
    8
      Settings.py
  2. 7
    0
      Startup.py
  3. 19
    4
      inputs.py
  4. 96
    4
      menuV3.py

+ 8
- 8
Settings.py View File

@@ -167,14 +167,14 @@ def loadlevel():
167 167
     #readSettings()
168 168
     resx = own["resx"]
169 169
     resy = own["resy"]
170
-    #dict = bge.logic.globalDict #Get the global dictionary
171
-    #dict['resx'] = resx
172
-    #dict['resy'] = resy     
173
-    #bge.render.setWindowSize(resx, resy)
174
-    #fullscreen = bge.render.getFullScreen()
175
-    #print("fullscreen = ", fullscreen)
176
-    #if fullscreen != True:
177
-    #bge.render.setFullScreen(True)
170
+    dict = bge.logic.globalDict #Get the global dictionary
171
+    dict['resx'] = resx
172
+    dict['resy'] = resy
173
+    bge.render.setWindowSize(resx, resy)
174
+    fullscreen = bge.render.getFullScreen()
175
+    print("fullscreen = ", fullscreen)
176
+    if fullscreen != True:
177
+        bge.render.setFullScreen(True)
178 178
     print("resolution = ", resx, resy)
179 179
     #objList = scene.objects
180 180
     if own["framerate"] == 1:    

+ 7
- 0
Startup.py View File

@@ -118,10 +118,17 @@ def main():
118 118
     dict['mTrig'] = 0.0 
119 119
     dict['lTrig'] = 0.0
120 120
     dict['rTrig'] = 0.0 
121
+    
122
+    dict['last_ltsBut'] = 0.0
123
+    dict['last_rtsBut'] = 0.0    
124
+    
121 125
     #dict['shirt_color'] = [.5,1,1,1]
122 126
     
123 127
     dict['mu_last_track'] = ''
124 128
     dict['mu_artist'] = ''
125 129
     dict['mu_title'] = ''    
130
+    
131
+    dict['joy_con'] = 1
132
+    dict['last_joy_con'] = 1
126 133
 
127 134
 main()

+ 19
- 4
inputs.py View File

@@ -18,7 +18,10 @@ def main():
18 18
     aXis = cont.sensors['Joystick.001']
19 19
     bUtt = cont.sensors['Joystick'] 
20 20
     reduction = 400000
21
-    axisTh = 0.03    
21
+    axisTh = 0.03  
22
+    
23
+    joy_con = dict['joy_con']  
24
+    scenes = bge.logic.getSceneList()
22 25
     
23 26
 #hard controller mappings    
24 27
     lar_lts = 0
@@ -47,11 +50,22 @@ def main():
47 50
     axisTh = 0.03   
48 51
     
49 52
     if not any(bge.logic.joysticks):
50
-        print("joystick not connnected")
53
+        #print("joystick not connnected")
51 54
         dict['joy_con'] = 0
52 55
     else:    
53
-        dict['joy_con'] = 1     
54
-
56
+        dict['joy_con'] = 1 
57
+        
58
+    if dict['joy_con'] != dict['last_joy_con'] and own['counter'] > 500:
59
+        if dict['joy_con'] == 0 and dict['last_joy_con'] == 1:
60
+            if 'joy_warn' not in scenes:
61
+                #add scene
62
+                print('print add joy overlay')
63
+                cont.activate(cont.actuators['add_controller'])
64
+        else:
65
+            if dict['joy_con'] == 1 and dict['last_joy_con'] == 0:
66
+                #remove scene            
67
+                print('print remove joy overlay')            
68
+                cont.activate(cont.actuators['remove_controller'])
55 69
 #get controller axis value 0-100   
56 70
     if dict['joy_con'] == 1: 
57 71
         lLR = aXis.axisValues[lar_lts] / reduction 
@@ -210,6 +224,7 @@ def main():
210 224
         dict['mTrig'] = mTrig
211 225
         dict['rTrig'] = rTrig
212 226
         dict['lTrig'] = lTrig
227
+        dict['last_joy_con'] = joy_con
213 228
 
214 229
 
215 230
 main()

+ 96
- 4
menuV3.py View File

@@ -8,6 +8,14 @@ JUST_ACTIVATED = bge.logic.KX_INPUT_JUST_ACTIVATED
8 8
 def endpoint(funct, motion, dict, cont):
9 9
     print('endpoint', funct,motion)
10 10
     scene = bge.logic.getCurrentScene()
11
+    
12
+    scenes = bge.logic.getSceneList()
13
+    main_scene = [scene for scene in scenes if scene.name=="main"][0]
14
+    main_empty = main_scene.objects['Empty']    
15
+    own = cont.owner
16
+    import Settings
17
+    load_timer = 100
18
+    
11 19
     shirt = scene.objects["Char4:Zshirtt1"]  
12 20
     shoeR = scene.objects['Char4:Shoes02.R']
13 21
     shoeL = scene.objects['Char4:Shoes02.L']
@@ -406,7 +414,89 @@ def endpoint(funct, motion, dict, cont):
406 414
             rot = [ 0, b, 0]
407 415
             em.applyRotation(rot,True)
408 416
         cam['sun_rot_y'] = round(b,2)
409
-        dict['sun_rot_y'] = round(b,2)        
417
+        dict['sun_rot_y'] = round(b,2) 
418
+        
419
+        
420
+        
421
+    #levels
422
+    if funct == 'Demo Scene':
423
+        if motion == 'inc':
424
+            level = "pats"
425
+            main_empty["level"] = "pats"
426
+            own["level"] = level
427
+            Settings.writeSettings()
428
+            Settings.readSettings()
429
+            #cont.activate(own.actuators['restart']) 
430
+            #Settings.loadlevel()
431
+            dict['load_timer'] = load_timer
432
+            dict['reload_timer'] = 250
433
+            dict['overlay_fadein'] = 1              
434
+            
435
+    if funct == 'Park A':
436
+        if motion == 'inc':
437
+            level = "j_scene"
438
+            main_empty["level"] = "j_scene"
439
+            own["level"] = level
440
+            Settings.writeSettings()
441
+            Settings.readSettings()
442
+            #cont.activate(own.actuators['restart']) 
443
+            #Settings.loadlevel()
444
+            dict['load_timer'] = load_timer
445
+            dict['reload_timer'] = 250
446
+            dict['overlay_fadein'] = 1 
447
+            
448
+    if funct == 'Empty Lot':
449
+        if motion == 'inc':
450
+            level = "lot"
451
+            main_empty["level"] = "lot"
452
+            own["level"] = level
453
+            Settings.writeSettings()
454
+            Settings.readSettings()
455
+            #cont.activate(own.actuators['restart']) 
456
+            #Settings.loadlevel()
457
+            dict['load_timer'] = load_timer
458
+            dict['reload_timer'] = 250
459
+            dict['overlay_fadein'] = 1   
460
+            
461
+    if funct == 'Training':
462
+        if motion == 'inc':
463
+            level = "train"
464
+            main_empty["level"] = "train"
465
+            own["level"] = level
466
+            Settings.writeSettings()
467
+            Settings.readSettings()
468
+            #cont.activate(own.actuators['restart']) 
469
+            #Settings.loadlevel()
470
+            dict['load_timer'] = load_timer
471
+            dict['reload_timer'] = 250
472
+            dict['overlay_fadein'] = 1 
473
+            
474
+    if funct == 'Spine':
475
+        if motion == 'inc':
476
+            level = "spine"
477
+            main_empty["level"] = "spine"
478
+            own["level"] = level
479
+            Settings.writeSettings()
480
+            Settings.readSettings()
481
+            #cont.activate(own.actuators['restart']) 
482
+            #Settings.loadlevel()
483
+            dict['load_timer'] = load_timer
484
+            dict['reload_timer'] = 250
485
+            dict['overlay_fadein'] = 1 
486
+            
487
+    if funct == 'Warehouse':
488
+        if motion == 'inc':
489
+            level = "warehouse"
490
+            main_empty["level"] = "warehouse"
491
+            own["level"] = level
492
+            Settings.writeSettings()
493
+            Settings.readSettings()
494
+            #cont.activate(own.actuators['restart']) 
495
+            #Settings.loadlevel()
496
+            dict['load_timer'] = load_timer
497
+            dict['reload_timer'] = 250
498
+            dict['overlay_fadein'] = 1  
499
+                                                                                    
410 500
 
411 501
 #=======
412 502
 #end exit functions
@@ -414,7 +504,7 @@ def endpoint(funct, motion, dict, cont):
414 504
 def get_c_list(dict):
415 505
     #main menu
416 506
     if dict['mlevel'] == 0:
417
-        dict['current_list'] = ['exit', 'settings', 'level', 'replay', 'restart']
507
+        dict['current_list'] = ['settings', 'level', 'replay', 'restart', 'exit']
418 508
         
419 509
     #opt = dict['current_list'][dict['current_index']]
420 510
     
@@ -423,7 +513,9 @@ def get_c_list(dict):
423 513
         #if opt == 'settings':
424 514
             dict['current_list'] = ['graphics', 'player', 'level', 'camera', 'physics']
425 515
         if dict['lv0_opt'] == 'replay':
426
-            dict['current_list'] = ['enter replay', 'recorder on', 'record length']  
516
+            dict['current_list'] = ['enter replay', 'recorder on', 'record length'] 
517
+        if dict['lv0_opt'] == 'level':
518
+            dict['current_list'] = ['Demo Scene', 'Empty Lot', 'Park A', 'Training', 'Spine', 'Warehouse']     
427 519
     if dict['mlevel'] == 2:
428 520
         if dict['lv1_opt'] == 'graphics':
429 521
         #if opt == 'settings':
@@ -557,7 +649,7 @@ def init(own, dict):
557 649
     dict['mlevel'] = 0
558 650
     dict['current_opt'] = ''
559 651
     dict['pause_menu_text'] = ''
560
-    dict['menu_end_points'] = ['exit', 'restart', 'shirt color r', 'shirt color g', 'shirt color b', 'shoe color r', 'shoe color g', 'shoe color b','deck color r', 'deck color g', 'deck color b', 'shirt logo', 'brightness / contrast on', 'brightness value', 'contrast value', 'hdr on', 'avgL', 'hdr strength', 'ao on', 'ao radius', 'ao width', 'ao only', 'dof on', 'sun strength', 'sun rot x', 'sun rot y', 'shadow on', 'ambient strength']
652
+    dict['menu_end_points'] = ['exit', 'restart', 'shirt color r', 'shirt color g', 'shirt color b', 'shoe color r', 'shoe color g', 'shoe color b','deck color r', 'deck color g', 'deck color b', 'shirt logo', 'brightness / contrast on', 'brightness value', 'contrast value', 'hdr on', 'avgL', 'hdr strength', 'ao on', 'ao radius', 'ao width', 'ao only', 'dof on', 'sun strength', 'sun rot x', 'sun rot y', 'shadow on', 'ambient strength', 'Demo Scene', 'Empty Lot', 'Park A', 'Training', 'Spine', 'Warehouse']
561 653
     
562 654
 def output(dict):
563 655
     try:

Loading…
Cancel
Save