Changeset 268 for trunk/game/scripts


Ignore:
Timestamp:
09/02/09 07:34:50 (10 years ago)
Author:
b0rland_parpg
Message:

Ticket #77:

  • Hud class now gets the list of supported fullscreen resolutions from SDL
  • Hud elements placement is made more or less universal
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/game/scripts/hud.py

    r261 r268  
    6363        ready4 = self.hud.findChild(name='hudReady4') 
    6464        actions_scroll_area = self.hud.findChild(name='actionsScrollArea') 
     65        if (screen_width <=800) : 
     66            gap = 0 
     67        else : 
     68            gap = 40 
    6569        # annoying code that is both essential and boring to enter 
    66         if (screen_width == 1440): 
    67             ready1.position = (screen_width-1235, 7) 
    68             ready2.position = (screen_width-1175, 7) 
    69             ready3.position = (screen_width-215, 7) 
    70             ready4.position = (screen_width-155, 7) 
    71             actions_scroll_area.position = (325, 5) 
    72             actions_width = screen_width - 550 
    73         elif (screen_width == 1280): 
    74             ready1.position = (screen_width-1075, 7) 
    75             ready2.position = (screen_width-1015, 7) 
    76             ready3.position = (screen_width-215, 7) 
    77             ready4.position = (screen_width-155, 7) 
    78             actions_scroll_area.position = (325, 5) 
    79             actions_width = screen_width - 550 
    80         elif (screen_width == 1024): 
    81             ready1.position = (screen_width-820, 7) 
    82             ready2.position = (screen_width-760, 7) 
    83             ready3.position = (screen_width-215, 7) 
    84             ready4.position = (screen_width-155, 7) 
    85             actions_scroll_area.position = (325, 5) 
    86             actions_width = screen_width - 550 
    87         elif (screen_width == 800): 
    88             ready1.position = (screen_width-640, 7) 
    89             ready2.position = (screen_width-580, 7) 
    90             ready3.position = (screen_width-185, 7) 
    91             ready4.position = (screen_width-125, 7) 
    92             actions_scroll_area.position = (280, 5) 
    93             actions_width = screen_width - 475 
    94         else: 
    95             ready1.position = (screen_width-475, 7) 
    96             ready2.position = (screen_width-420, 7) 
    97             ready3.position = (screen_width-175, 7) 
    98             ready4.position = (screen_width-120, 7) 
    99             actions_scroll_area.position = (280, 5) 
    100             actions_width = screen_width - 465 
     70        ready1.position = (160+gap, 7) 
     71        ready2.position = (220+gap, 7) 
     72        ready3.position = (screen_width-180-gap, 7) 
     73        ready4.position = (screen_width-120-gap, 7) 
     74        actions_scroll_area.position = (280+gap, 5) 
     75        actions_width = screen_width - 470 - 2*gap 
     76 
    10177        # and finally add an actions box 
    10278        self.hud.findChild(name="actionsBox").min_size = (actions_width, 0) 
     
    208184                               "defaultsButton":self.setToDefaults, 
    209185                               "InitialVolumeSlider":self.updateVolumeText} 
    210  
    211         self.Resolutions = ['640x480', '800x600', 
    212                             '1024x768', '1280x1024', '1440x900'] 
     186         
     187        settings = self.engine.getSettings() 
     188        current_fullscreen = settings.isFullScreen() 
     189        settings.setFullScreen(True) 
     190        availableResolutions = settings.getPossibleResolutions() 
     191        self.Resolutions = [str(x[0])+'x'+str(x[1]) for x in availableResolutions]; 
     192        settings.setFullScreen(current_fullscreen) 
    213193        self.RenderBackends = ['OpenGL', 'SDL'] 
    214194        self.renderNumber = 0 
Note: See TracChangeset for help on using the changeset viewer.