Esempio n. 1
0
void MultiplexerLogger::addConsoleLogger(Log::Severity severity,
                                         bool autoRemovable) {
  QFile *console = new QFile;
  console->open(1, QIODevice::WriteOnly|QIODevice::Unbuffered);
  FileLogger *logger = new FileLogger(console, severity);
  addLogger(logger, autoRemovable, true);
}
Esempio n. 2
0
CGameApplication::CGameApplication(const CString& title) :
CApplication    (title),
m_multiplayer   (false),
m_showBullet    (false),
m_gamedata      (nullptr),
m_gamedataNew   (nullptr),
m_loggerConsole (nullptr),
m_debugDraw     (nullptr),
m_debugBuffer   (nullptr)
#ifdef T_ACTIVE_DEBUG_MODE
                         ,
m_activityMenu  (nullptr),
m_activityDebug (nullptr)
#endif // T_ACTIVE_DEBUG_MODE
{
    if (Game::app)
        exit(-1);

    Game::app = this;
    Game::console = new CConsole();
    new CSoundEngine();
    new CRenderer();
    new CGuiEngine();
    new CPhysicEngine();
    new CEntityManager();
    new CModelManager();

    Game::renderer->initOpenGL();

    m_debugDraw = new CBulletDebugDraw();
    m_debugBuffer = m_debugDraw->getBuffer();
    Game::physicEngine->getWorld()->setDebugDrawer(m_debugDraw);

    m_loggerConsole = new CLoggerConsole(Game::console);
    addLogger(m_loggerConsole);
}
Esempio n. 3
0
CApplication::CApplication(const CString& title) :
IEventReceiver    (),
m_time            (0),
m_inGame          (false),
m_gameActive      (false),
m_active          (true),
m_fps             (50.0f),
m_window          (nullptr),
m_cursorPos       (Origin2US),
m_gameTime        (0),
m_cursorVisible   (true),
m_frameTimeList   (100),
m_fpsList         (100),

#ifndef T_NO_DEFAULT_LOGGER
m_defaultLogger   (nullptr),
#endif // T_NO_DEFAULT_LOGGER

m_receiver        (nullptr),
m_title           (title/*"TEngine Application"*/),
m_videoMode       (800, 600, 32),
m_fullscreen      (false)
{
    if (m_instance)
        exit(-1);

    m_instance = this;

    // Création du logger par défaut
#ifndef T_NO_DEFAULT_LOGGER
    m_defaultLogger = new CLoggerFile(CDateTime::getCurrentDateTime().toString("logs/log-%Y-%m-%d-%H-%i-%s.txt"));
    T_ASSERT(m_defaultLogger != nullptr);
    addLogger(m_defaultLogger);
#endif // T_NO_DEFAULT_LOGGER

    log("Chargement du moteur");

    // Lecture des paramètres
    m_settings.loadFromFile("../../config.ini");

    // Initialisation de l'état des boutons de la souris
    m_buttons[MouseButtonLeft]   = false;
    m_buttons[MouseButtonRight]  = false;
    m_buttons[MouseButtonMiddle] = false;
    m_buttons[MouseWheelUp]      = false;
    m_buttons[MouseWheelDown]    = false;

    // Touches par défaut
    m_keyActions[ActionForward]     = getKeyCode(m_settings.getValue("Keys", "forward"    , "Key_Z"));
    m_keyActions[ActionBackward]    = getKeyCode(m_settings.getValue("Keys", "backward"   , "Key_S"));
    m_keyActions[ActionStrafeLeft]  = getKeyCode(m_settings.getValue("Keys", "strafeleft" , "Key_Q"));
    m_keyActions[ActionStrafeRight] = getKeyCode(m_settings.getValue("Keys", "straferight", "Key_D"));
    m_keyActions[ActionTurnLeft]    = getKeyCode(m_settings.getValue("Keys", "turnleft"   , "Key_Left"));
    m_keyActions[ActionTurnRight]   = getKeyCode(m_settings.getValue("Keys", "turnright"  , "Key_Right"));
    m_keyActions[ActionJump]        = getKeyCode(m_settings.getValue("Keys", "jump"       , "Key_Space"));
    m_keyActions[ActionCrunch]      = getKeyCode(m_settings.getValue("Keys", "crunch"     , "Key_LShift"));
    m_keyActions[ActionZoom]        = getKeyCode(m_settings.getValue("Keys", "zoom"       , "Key_G"));

    m_window = new sf::Window();
    T_ASSERT(m_window != nullptr);
    m_window->setMouseCursorVisible(false);
}
Esempio n. 4
0
void MultiplexerLogger::addQtLogger(Log::Severity severity,
                                    bool autoRemovable) {
  QtLogLogger *logger = new QtLogLogger(severity);
  addLogger(logger, autoRemovable, true);
}