Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

# LampCore.cpp

Go to the documentation of this file.

    00001 //------------------------------------------------------------------------------
    00002 // Lamp : Open source game middleware
    00003 // Copyright (C) 2004  Junpei Ohtani ( Email : junpee@users.sourceforge.jp )
    00004 //
    00005 // This library is free software; you can redistribute it and/or
    00006 // modify it under the terms of the GNU Lesser General Public
    00007 // License as published by the Free Software Foundation; either
    00008 // version 2.1 of the License, or (at your option) any later version.
    00009 //
    00010 // This library is distributed in the hope that it will be useful,
    00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
    00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00013 // Lesser General Public License for more details.
    00014 //
    00015 // You should have received a copy of the GNU Lesser General Public
    00016 // License along with this library; if not, write to the Free Software
    00017 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    00018 //------------------------------------------------------------------------------
    00019
    00020 /** @file
    00021  * Lamp実装
    00022  * @author Junpee
    00023  */
    00024
    00025 #include "LampBasic.h"
    00026 #include "Core/System/LampCore.h"
    00027 #include "Graphics/System/LampGraphics.h"
    00028 #include "Input/System/LampInput.h"
    00029 #include "Core/Utility/Timer.h"
    00030 #include "Core/Thread/Thread.h"
    00031
    00032 namespace Lamp{
    00033
    00034 // 初期化フラグ
    00035 bool LampCore::isInitialized_ = false;
    00036
    00037 //------------------------------------------------------------------------------
    00038 // 初期化
    00039 void LampCore::initialize(){
    00040     // 初期化済みなら無視する
    00041     if(isInitialized_){ return; }
    00042     // メモリ初期化
    00043     MemoryChecker::initialize();
    00044     // エラー出力初期化
    00045 //  ErrorOutInitialize();
    00046     ErrorOutInitialize(NULL);
    00047     // デバッグ出力初期化
    00048     DebugOutInitialize();
    00049     // スレッド初期化
    00050     Thread::initialize();
    00051     // タイマ初期化
    00052     Timer::initialize();
    00053     // 初期化フラグ立てる
    00054     isInitialized_ = true;
    00055 }
    00056 //------------------------------------------------------------------------------
    00057 // 後始末
    00058 void LampCore::finalize(){
    00059     // スレッド後始末
    00060     Thread::finalize();
    00061     // デバッグ出力後始末
    00062     DebugOutFinalize();
    00063     // エラー出力後始末
    00064     ErrorOutFinalize();
    00065     // 初期化フラグクリア
    00066     isInitialized_ = false;
    00067 }
    00068 //------------------------------------------------------------------------------
    00069 // ウィンドウプロシージャ
    00070 LRESULT LampCore::windowProcedure(
    00071     HWND windowHandle, u_int message, WPARAM wParam, LPARAM lParam){
    00072     LRESULT result;
    00073     // グラフィックスのプロシージャを呼ぶ
    00074     result = LampGraphics::windowProcedure(
    00075         windowHandle, message, wParam, lParam);
    00076     if(result != 0){ return result; }
    00077
    00078     // 入力のプロシージャを呼ぶ
    00079     result = LampInput::windowProcedure(
    00080         windowHandle, message, wParam, lParam);
    00081     if(result != 0){ return result; }
    00082
    00083     // メッセージの処理
    00084     switch(message){
    00085     // アプリケーション終了
    00086     case WM_CLOSE:
    00087         PostQuitMessage(0);
    00088         break;
    00089     }
    00090     return 0;
    00091 }
    00092 //------------------------------------------------------------------------------
    00093 } // End of namespace Lamp
    00094 //------------------------------------------------------------------------------