Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4770 in orxonox.OLD for orxonox/trunk/src


Ignore:
Timestamp:
Jul 2, 2005, 1:20:56 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: GraphicsEngine now parses the INI-file

Location:
orxonox/trunk/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/lib/graphics/graphics_engine.cc

    r4769 r4770  
    2121#include "debug.h"
    2222#include "text_engine.h"
     23
     24#include "ini_parser.h"
     25#include "substring.h"
    2326
    2427using namespace std;
     
    102105  glEnable(GL_DEPTH_TEST);
    103106}
     107
     108/**
     109 * loads the GraphicsEngine's settings from a given ini-file and section
     110 * @param iniParser the iniParser to load from
     111 * @param section the Section in the ini-file to load from
     112 * @returns nothing usefull
     113 */
     114int GraphicsEngine::loadFromIniFile(IniParser* iniParser, const char* section)
     115{
     116  // searching for a usefull resolution
     117  SubString resolution(iniParser->getVar(CONFIG_NAME_RESOLUTION, section, "640x480"), 'x');
     118  this->setResolution(atoi(resolution.getString(0)), atoi(resolution.getString(1)), 16);
     119
     120  // looking if we are in fullscreen-mode
     121  const char* fullscreen = iniParser->getVar(CONFIG_NAME_FULLSCREEN, section, "0");
     122  if (strchr(fullscreen, '1'))
     123    this->setFullscreen(true);
     124}
     125
    104126
    105127
  • orxonox/trunk/src/lib/graphics/graphics_engine.h

    r4768 r4770  
    1717// Forward Declaration
    1818class Text;
     19class IniParser;
    1920
    2021//! class to handle graphics
     
    3031
    3132    int initVideo();
     33    int loadFromIniFile(IniParser* iniParser, const char* section);
    3234
    3335    void setWindowName(const char* windowName, const char* icon);
  • orxonox/trunk/src/orxonox.cc

    r4769 r4770  
    153153  GraphicsEngine::getInstance()->setWindowName(PACKAGE_NAME " " PACKAGE_VERSION, PACKAGE_NAME " " PACKAGE_VERSION);
    154154
    155 
    156   SubString resolution(this->iniParser->getVar(CONFIG_NAME_RESOLUTION, CONFIG_SECTION_VIDEO, "640x480"), 'x');
    157   GraphicsEngine::getInstance()->setResolution(atoi(resolution.getString(0)), atoi(resolution.getString(1)), 16);
    158 
    159   const char* fullscreen = this->iniParser->getVar(CONFIG_NAME_FULLSCREEN, CONFIG_SECTION_VIDEO, "0");
    160   printf("%s\n", fullscreen);
    161   if (strchr(fullscreen, '1'))
    162     GraphicsEngine::getInstance()->setFullscreen(true);
     155  GraphicsEngine::getInstance()->loadFromIniFile(this->iniParser, CONFIG_SECTION_VIDEO);
    163156
    164157  return 0;
  • orxonox/trunk/src/subprojects/gui/Makefile.am

    r4751 r4770  
    2424             $(MAINSRCDIR)/util/resource_manager.cc \
    2525             $(MAINSRCDIR)/lib/util/substring.cc \
    26              $(MAINSRCDIR)/util/loading/load_param.cc
     26             $(MAINSRCDIR)/util/loading/load_param.cc \
     27             $(MAINSRCDIR)/lib/util/ini_parser.cc
    2728
    2829noinst_HEADERS=
  • orxonox/trunk/src/subprojects/gui/Makefile.in

    r4751 r4770  
    5656        gui-base_object.$(OBJEXT) gui-class_list.$(OBJEXT) \
    5757        gui-vector.$(OBJEXT) gui-resource_manager.$(OBJEXT) \
    58         gui-substring.$(OBJEXT) gui-load_param.$(OBJEXT)
     58        gui-substring.$(OBJEXT) gui-load_param.$(OBJEXT) \
     59        gui-ini_parser.$(OBJEXT)
    5960gui_OBJECTS = $(am_gui_OBJECTS)
    6061am__DEPENDENCIES_1 =
     
    6667@AMDEP_TRUE@    ./$(DEPDIR)/gui-graphics_engine.Po \
    6768@AMDEP_TRUE@    ./$(DEPDIR)/gui-gui_main.Po \
     69@AMDEP_TRUE@    ./$(DEPDIR)/gui-ini_parser.Po \
    6870@AMDEP_TRUE@    ./$(DEPDIR)/gui-load_param.Po \
    6971@AMDEP_TRUE@    ./$(DEPDIR)/gui-resource_manager.Po \
     
    206208             $(MAINSRCDIR)/util/resource_manager.cc \
    207209             $(MAINSRCDIR)/lib/util/substring.cc \
    208              $(MAINSRCDIR)/util/loading/load_param.cc
     210             $(MAINSRCDIR)/util/loading/load_param.cc \
     211             $(MAINSRCDIR)/lib/util/ini_parser.cc
    209212
    210213noinst_HEADERS =
     
    279282@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gui-graphics_engine.Po@am__quote@
    280283@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gui-gui_main.Po@am__quote@
     284@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gui-ini_parser.Po@am__quote@
    281285@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gui-load_param.Po@am__quote@
    282286@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gui-resource_manager.Po@am__quote@
     
    427431@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    428432@am__fastdepCXX_FALSE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gui_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o gui-load_param.obj `if test -f '$(MAINSRCDIR)/util/loading/load_param.cc'; then $(CYGPATH_W) '$(MAINSRCDIR)/util/loading/load_param.cc'; else $(CYGPATH_W) '$(srcdir)/$(MAINSRCDIR)/util/loading/load_param.cc'; fi`
     433
     434gui-ini_parser.o: $(MAINSRCDIR)/lib/util/ini_parser.cc
     435@am__fastdepCXX_TRUE@   if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gui_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT gui-ini_parser.o -MD -MP -MF "$(DEPDIR)/gui-ini_parser.Tpo" -c -o gui-ini_parser.o `test -f '$(MAINSRCDIR)/lib/util/ini_parser.cc' || echo '$(srcdir)/'`$(MAINSRCDIR)/lib/util/ini_parser.cc; \
     436@am__fastdepCXX_TRUE@   then mv -f "$(DEPDIR)/gui-ini_parser.Tpo" "$(DEPDIR)/gui-ini_parser.Po"; else rm -f "$(DEPDIR)/gui-ini_parser.Tpo"; exit 1; fi
     437@AMDEP_TRUE@@am__fastdepCXX_FALSE@      source='$(MAINSRCDIR)/lib/util/ini_parser.cc' object='gui-ini_parser.o' libtool=no @AMDEPBACKSLASH@
     438@AMDEP_TRUE@@am__fastdepCXX_FALSE@      depfile='$(DEPDIR)/gui-ini_parser.Po' tmpdepfile='$(DEPDIR)/gui-ini_parser.TPo' @AMDEPBACKSLASH@
     439@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     440@am__fastdepCXX_FALSE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gui_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o gui-ini_parser.o `test -f '$(MAINSRCDIR)/lib/util/ini_parser.cc' || echo '$(srcdir)/'`$(MAINSRCDIR)/lib/util/ini_parser.cc
     441
     442gui-ini_parser.obj: $(MAINSRCDIR)/lib/util/ini_parser.cc
     443@am__fastdepCXX_TRUE@   if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gui_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT gui-ini_parser.obj -MD -MP -MF "$(DEPDIR)/gui-ini_parser.Tpo" -c -o gui-ini_parser.obj `if test -f '$(MAINSRCDIR)/lib/util/ini_parser.cc'; then $(CYGPATH_W) '$(MAINSRCDIR)/lib/util/ini_parser.cc'; else $(CYGPATH_W) '$(srcdir)/$(MAINSRCDIR)/lib/util/ini_parser.cc'; fi`; \
     444@am__fastdepCXX_TRUE@   then mv -f "$(DEPDIR)/gui-ini_parser.Tpo" "$(DEPDIR)/gui-ini_parser.Po"; else rm -f "$(DEPDIR)/gui-ini_parser.Tpo"; exit 1; fi
     445@AMDEP_TRUE@@am__fastdepCXX_FALSE@      source='$(MAINSRCDIR)/lib/util/ini_parser.cc' object='gui-ini_parser.obj' libtool=no @AMDEPBACKSLASH@
     446@AMDEP_TRUE@@am__fastdepCXX_FALSE@      depfile='$(DEPDIR)/gui-ini_parser.Po' tmpdepfile='$(DEPDIR)/gui-ini_parser.TPo' @AMDEPBACKSLASH@
     447@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     448@am__fastdepCXX_FALSE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gui_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o gui-ini_parser.obj `if test -f '$(MAINSRCDIR)/lib/util/ini_parser.cc'; then $(CYGPATH_W) '$(MAINSRCDIR)/lib/util/ini_parser.cc'; else $(CYGPATH_W) '$(srcdir)/$(MAINSRCDIR)/lib/util/ini_parser.cc'; fi`
    429449uninstall-info-am:
    430450
Note: See TracChangeset for help on using the changeset viewer.