Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7481 in orxonox.OLD for branches/qt_gui/src


Ignore:
Timestamp:
May 2, 2006, 10:49:55 PM (19 years ago)
Author:
bensch
Message:

compiles again

Location:
branches/qt_gui/src/lib/gui/qt_gui
Files:
1 edited
2 copied

Legend:

Unmodified
Added
Removed
  • branches/qt_gui/src/lib/gui/qt_gui/Makefile.am

    r7470 r7481  
    1313
    1414libORXqtgui_a_SOURCES = \
    15                 qt_gui.cc
     15                qt_gui.cc \
     16                \
     17                gui_video.cc
    1618
    1719noinst_HEADERS= \
    18                 qt_gui.h
     20                qt_gui.h \
     21                \
     22                gui_video.h
    1923
    2024EXTRA_DIST =
  • branches/qt_gui/src/lib/gui/qt_gui/gui_video.cc

    r7478 r7481  
    2626
    2727#include "gui_video.h"
     28#include "sdlincl.h"
     29#include "debug.h"
    2830
    29 #include "gui_gtk.h"
    30 #include "sdlincl.h"
    31 #include <stdlib.h>
     31namespace OrxGui
     32{
     33  /**
     34   *  Creates the Video-Option-Frame
     35  */
     36  GuiVideo::GuiVideo()
     37  {
     38/*    Frame* videoFrame;        //!< The Frame that holds the video options.
    3239
    33 /**
    34  *  Creates the Video-Option-Frame
    35 */
    36 GuiVideo::GuiVideo()
    37 {
    38   Frame* videoFrame;        //!< The Frame that holds the video options.
     40    videoFrame = new Frame("Video-Options:");
     41    videoFrame->setGroupName("video");
     42    {
     43      Box* videoBox;            //!< The Box that holds the video options.
    3944
    40   videoFrame = new Frame("Video-Options:");
    41   videoFrame->setGroupName("video");
    42   {
    43     Box* videoBox;            //!< The Box that holds the video options.
     45      videoBox = new Box('v');
     46      {
     47        CheckButton* fullscreen;  //!< CheckButton for fullscreen-mode
     48        Menu* resolution;         //!< Menu for the resolution
     49        CheckButton* wireframe;   //!< CheckButton for wireframe Mode.
    4450
    45     videoBox = new Box('v');
    46     {
    47       CheckButton* fullscreen;  //!< CheckButton for fullscreen-mode
    48       Menu* resolution;         //!< Menu for the resolution
    49       CheckButton* wireframe;   //!< CheckButton for wireframe Mode.
     51        fullscreen = new CheckButton(CONFIG_NAME_FULLSCREEN);
     52        fullscreen->setFlagName("windowed", "q", 1);
     53        fullscreen->setDescription("Starts orxonox in windowed mode");
     54        fullscreen->saveability();
     55        videoBox->fill(fullscreen);
     56        resolution = new Menu(CONFIG_NAME_RESOLUTION);
     57        getResolutions(resolution);
     58        resolution->saveability();
     59        resolution->setFlagName("resolution", "r", 0);
     60        resolution->setDescription("Sets the resolution of orxonox");
     61        videoBox->fill(resolution);
     62        wireframe = new CheckButton(CONFIG_NAME_WIREFRAME);
     63        wireframe->setFlagName("wireframe", "w", 0);
     64        wireframe->setDescription("Starts orxonox in wireframe mode");
     65        wireframe->saveability();
     66        videoBox->fill(wireframe);
    5067
    51       fullscreen = new CheckButton(CONFIG_NAME_FULLSCREEN);
    52       fullscreen->setFlagName("windowed", "q", 1);
    53       fullscreen->setDescription("Starts orxonox in windowed mode");
    54       fullscreen->saveability();
    55       videoBox->fill(fullscreen);
    56       resolution = new Menu(CONFIG_NAME_RESOLUTION);
    57       getResolutions(resolution);
    58       resolution->saveability();
    59       resolution->setFlagName("resolution", "r", 0);
    60       resolution->setDescription("Sets the resolution of orxonox");
    61       videoBox->fill(resolution);
    62       wireframe = new CheckButton(CONFIG_NAME_WIREFRAME);
    63       wireframe->setFlagName("wireframe", "w", 0);
    64       wireframe->setDescription("Starts orxonox in wireframe mode");
    65       wireframe->saveability();
    66       videoBox->fill(wireframe);
    67 
    68       videoBox->fill(advancedWindowCreate());
     68        videoBox->fill(advancedWindowCreate());
     69      }
     70      videoFrame->fill(videoBox);
    6971    }
    70     videoFrame->fill(videoBox);
    71   }
    72   setMainWidget(videoFrame);
    73 }
    74 
    75 /**
    76  *  Destructs the Video-stuff
    77 */
    78 GuiVideo::~GuiVideo()
    79 {
    80   // nothing to do here.
    81 }
    82 
    83 /**
    84  *  Creates a window, and all it contains for the Source-update.
    85 */
    86 Widget* GuiVideo::advancedWindowCreate()
    87 {
    88   // advanced-Performance-Options
    89   Window* advancedWindow;   //!< A Window to display advanced options.
    90   Button* advancedButton;   //!< A Button to open the Advanced Video Performance Window.
    91   // the button, that opens this Window.
    92   advancedButton = new Button("advanced");
    93 
    94   // the Window itself
    95   advancedWindow = new Window("Advanced Video Options");
    96   advancedWindow->setGroupName(CONFIG_SECTION_VIDEO_ADVANCED);
    97   {
    98     Box* advancedBox;         //!< A Box to pack the options into.
    99 
    100     advancedBox = new Box('v');
    101     {
    102       CheckButton* shadows;     //!< CheckButton for shadows
    103       CheckButton* fog;         //!< CheckButton for fog.
    104       CheckButton* reflections; //!< CheckButton for reflections
    105       CheckButton* textures;    //!< CheckButton for textures
    106       Menu* textureDetail;      //!< Menu for the Texture-Detail.
    107       Label* modelDetailLabel;  //!< Label for model-detail.
    108       Menu* modelDetail;        //!< model-detail.
    109       CheckButton* particles;   //!< If the Particles should be enabled
    110       Label* antiAliasingLabel; //!< Label for the anti-aliasing mode.
    111       Menu* antiAliasing;       //!< Menu for the Antialiasing-mode.
    112       Label* filterMethodLabel; //!< Label for filtering-Method.
    113       Menu* filterMethod;       //!< Menu for filtering Method.
    114       Button* closeButton;      //!< A Button to close the Advanced-settingsWindow.
    115 
    116       // Advanced Performance Options
    117       shadows = new CheckButton(CONFIG_NAME_SHADOWS);
    118       shadows->saveability();
    119       advancedBox->fill(shadows);
    120 
    121       fog = new CheckButton(CONFIG_NAME_FOG);
    122       fog->saveability();
    123       advancedBox->fill(fog);
    124 
    125       reflections = new CheckButton(CONFIG_NAME_REFLECTIONS);
    126       reflections->saveability();
    127       advancedBox->fill(reflections);
    128 
    129       textures = new CheckButton(CONFIG_NAME_TEXTURES);
    130       textures->setDefaultValue(1);
    131       textures->saveability();
    132       advancedBox->fill(textures);
    133 
    134       textureDetail = new Menu(CONFIG_NAME_TEXTURE_DETAIL, "low", "medium", "high", "lastItem");
    135       textureDetail->setDefaultValue(1);
    136       textureDetail->saveability();
    137       advancedBox->fill(textureDetail);
    138 
    139       modelDetailLabel = new Label(CONFIG_NAME_MODEL_DETAIL);
    140       advancedBox->fill(modelDetailLabel);
    141       modelDetail = new Menu(CONFIG_NAME_MODEL_DETAIL, "low", "high", "lastItem");
    142       modelDetail->setDefaultValue(1);
    143       modelDetail->saveability();
    144       advancedBox->fill(modelDetail);
    145 
    146       particles = new CheckButton(CONFIG_NAME_PARTICLES_ENABLED);
    147       particles->saveability();
    148       particles->setDefaultValue(1);
    149       advancedBox->fill(particles);
    150 
    151       antiAliasingLabel = new Label("Anti-Aliasing-depth:");
    152       advancedBox->fill(antiAliasingLabel);
    153       antiAliasing = new Menu(CONFIG_NAME_ANTI_ALIASING, "0", "1", "2", "4", "8",  "lastItem");
    154       antiAliasing->setDefaultValue(2);
    155       antiAliasing->saveability();
    156       advancedBox->fill(antiAliasing);
    157 
    158       filterMethodLabel = new Label("Filtering Method:");
    159       advancedBox->fill(filterMethodLabel);
    160       filterMethod = new Menu(CONFIG_NAME_FILTER_METHOD, "none", "linear", "bilinear", "trilinear", "anisortopic", "lastItem");
    161       filterMethod->setDefaultValue(1);
    162       filterMethod->saveability();
    163       advancedBox->fill(filterMethod);
    164 
    165 
    166 
    167       closeButton = new Button("close");
    168 #ifdef HAVE_GTK2
    169       closeButton->connectSignal("button_press_event", advancedWindow, Window::windowClose);
    170 #endif /* HAVE_GTK2 */
    171 
    172       advancedBox->fill(closeButton);
    173     }
    174     advancedWindow->fill(advancedBox);
    175   }
    176 #ifdef HAVE_GTK2
    177   advancedButton->connectSignal("button_press_event", advancedWindow, Window::windowOpen);
    178   advancedWindow->connectSignal("destroy", advancedWindow, Window::windowClose);
    179   advancedWindow->connectSignal("delete_event", advancedWindow, Window::windowClose);
    180 #endif /* HAVE_GTK2 */
    181   Window::addWindow(advancedWindow);
    182 
    183   return advancedButton;
    184 }
    185 
    186 /**
    187  *  sets all resolutions to the menu
    188  * @param menu the Menu to set The resolutions to.
    189 */
    190 void GuiVideo::getResolutions(Menu* menu)
    191 {
    192   SDL_Init(SDL_INIT_VIDEO);
    193   SDL_Rect **modes;
    194   int i;
    195   int x = 0,y =0; // check for difference
    196   char tmpChar[100];
    197 
    198   /* Get available fullscreen/hardware modes */
    199   modes=SDL_ListModes(NULL, SDL_FULLSCREEN|SDL_HWSURFACE);
    200 
    201   /* Check is there are any modes available */
    202   if(modes == (SDL_Rect **)0){
    203     PRINTF(2)("No video-modes available!\n");
    204     exit(-1);
     72    setMainWidget(videoFrame);*/
    20573  }
    20674
    207   /* Check if our resolution is restricted */
    208   if(modes == (SDL_Rect **)-1){
    209     PRINTF(2)("All resolutions available.\n");
     75  /**
     76   *  Destructs the Video-stuff
     77  */
     78  GuiVideo::~GuiVideo()
     79  {
     80    // nothing to do here.
    21081  }
    211   else{
    212     /* Print valid modes */
    213     PRINT(5)("Available Modes\n");
    214     for(i = 0; modes[i] ;++i)
     82
     83  /**
     84   *  sets all resolutions to the menu
     85   * @param menu the Menu to set The resolutions to.
     86  */
     87  void GuiVideo::getResolutions(std::vector<std::string>& resolutionList)
     88  {
     89    SDL_Init(SDL_INIT_VIDEO);
     90    SDL_Rect **modes;
     91    int i;
     92    int x = 0,y =0; // check for difference
     93    char tmpChar[100];
     94
     95    /* Get available fullscreen/hardware modes */
     96    modes=SDL_ListModes(NULL, SDL_FULLSCREEN|SDL_HWSURFACE);
     97
     98    /* Check is there are any modes available */
     99    if(modes == (SDL_Rect **)0)
     100    {
     101      PRINTF(2)("No video-modes available!\n");
     102      exit(-1);
     103    }
     104
     105    /* Check if our resolution is restricted */
     106    if(modes == (SDL_Rect **)-1)
     107    {
     108      PRINTF(2)("All resolutions available.\n");
     109    }
     110    else
     111    {
     112      /* Print valid modes */
     113      PRINT(5)("Available Modes\n");
     114      for(i = 0; modes[i] ;++i)
    215115      {
    216116        if (x != modes[i]->w || y != modes[i]->h)
    217           {
    218             PRINTF(5)("  %d x %d\n", modes[i]->w, modes[i]->h);
    219             sprintf(tmpChar, "%dx%d", modes[i]->w, modes[i]->h);
    220             menu->addItem(tmpChar);
    221             x = modes[i]->w; y = modes[i]->h;
    222           }
     117        {
     118          PRINTF(5)("  %d x %d\n", modes[i]->w, modes[i]->h);
     119          sprintf(tmpChar, "%dx%d", modes[i]->w, modes[i]->h);
     120          resolutionList.push_back(std::string(tmpChar));
     121          x = modes[i]->w; y = modes[i]->h;
     122        }
    223123      }
     124    }
     125    SDL_QuitSubSystem(SDL_INIT_VIDEO);
     126    SDL_Quit();
    224127  }
    225   SDL_QuitSubSystem(SDL_INIT_VIDEO);
    226   SDL_Quit();
     128
    227129}
  • branches/qt_gui/src/lib/gui/qt_gui/gui_video.h

    r7478 r7481  
    66#define _GUI_VIDEO_H
    77
    8 #include "gui.h"
    98#include "gui_element.h"
     9#include <vector>
     10#include <string>
    1011
    11 // FORWARD DECLARATIONS
    12 class Widget;
    13 class Menu;
     12namespace OrxGui
     13{
     14  //! Class that creates the Video-Options.
     15  class GuiVideo : public GuiElement
     16  {
     17  public:
     18    GuiVideo();
     19    virtual ~GuiVideo();
    1420
    15 //! Class that creates the Video-Options.
    16 class GuiVideo : public GuiElement
    17 {
    18  private:
    19   //  Button* advancedWindowGetButton();
     21  private:
     22    void getResolutions(std::vector<std::string>& resolutionList);
     23  };
     24}
    2025
    21  public:
    22   GuiVideo();
    23   virtual ~GuiVideo();
    24 
    25  private:
    26   void getResolutions(Menu* menu);
    27   Widget* advancedWindowCreate();
    28 };
    2926#endif /* _GUI_VIDEO_H */
Note: See TracChangeset for help on using the changeset viewer.