Changeset 11608 for lang/d

Show
Ignore:
Timestamp:
05/15/08 00:25:32 (6 months ago)
Author:
omega
Message:

画面サイズ変更できるようにした

Location:
lang/d/koke/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • lang/d/koke/trunk/gamecore.d

    r11602 r11608  
    7272         
    7373        static const int CONFIG_RELOAD_CHECK_INTERVAL = 40 * 5;                 // コンフィグ再読み込み確認 
    74         static const int CONFIG_RELOAD_SHOW_INTERVAL = 40 * 3;                  // 「コンフィグ読み込んだ」表示時間 
     74        static const int MESSAGE_SHOW_INTERVAL = 40 * 3;                        // 「コンフィグ読み込んだ」表示時間 
    7575         
    7676        // 運営レーザー用タイマー数値 
     
    281281                        configparser.update(); 
    282282                        config_reload = 0; 
    283                         message_timer = CONFIG_RELOAD_SHOW_INTERVAL; 
     283                        message_timer = MESSAGE_SHOW_INTERVAL; 
    284284                        message = "CONFIG RELOAD"; 
    285285                } 
     
    436436                // fps/cpu 
    437437                Hell_drawFPS( 8 , getScreenHeight() - 24 ); 
    438 //              Hell_update(); 
     438                 
     439                 
     440        Hell_drawFont(std.string.toString(Hell_getMouseX()) ~ " / " ~ std.string.toString(Hell_getMouseY()) , 
     441                      8, 
     442                      40, 
     443                      2, 
     444                      255, 255, 255 
     445                      ); 
    439446        } 
    440447         
  • lang/d/koke/trunk/hell2.d

    r11602 r11608  
    106106{ 
    107107        g_videoFlags ^= SDL_FULLSCREEN; 
    108         // スクリーン初期化 
     108        _resetScreen(); 
     109} 
     110 
     111/** 
     112 * スクリーン初期化 
     113 */ 
     114void _resetScreen(){ 
    109115        if((g_screen = SDL_SetVideoMode(g_width, g_height, g_videoBpp, g_videoFlags)) is null) 
    110116        { 
     
    114120        glViewport(0, 0, g_width, g_height); 
    115121        glClearColor(0.0f, 0.0f, 0.0f, 0.0f); 
    116         _reloadTexture(); 
     122        _reloadTexture(true); 
    117123        Hell_setAlpha(g_alpha_prev); 
    118124} 
     
    162168 * テクスチャを全て読み直し 
    163169 */ 
    164 void _reloadTexture() 
     170void _reloadTexture(bool resetTexture = true) 
    165171{ 
    166172        delete g_fontTexture; 
     
    168174        foreach(key; g_poolTexture.keys) 
    169175        { 
     176                if(resetTexture) g_poolTexture[key].id = 0; 
     177                 
    170178                char[] path = g_poolTexture[key].getPath(); 
    171179                int mask[]  = g_poolTexture[key].getMaskInfo(); 
     
    441449        // イベント更新 
    442450        SDL_Event e; 
    443         while(SDL_PollEvent(&e)) g_quit = (e.type == SDL_QUIT); 
     451        while(SDL_PollEvent(&e)){ 
     452                g_quit = (e.type == SDL_QUIT); 
     453                switch(e.type){ 
     454                case SDL_VIDEORESIZE: 
     455                        g_width = e.resize.w; 
     456                        g_height = e.resize.h; 
     457                        _resetScreen(); 
     458                        break; 
     459                default: 
     460                        break; 
     461                } 
     462        } 
    444463        if(Hell_isPushKey(SDLK_F4))      _reloadTexture(); 
    445464        if(Hell_isPushKey(SDLK_F5))      SDL_WM_IconifyWindow(); 
     
    11221141        glMatrixMode(GL_PROJECTION); 
    11231142        glLoadIdentity(); 
    1124         glOrtho(0 , 640 , 480 , 0 , -1 , 1); 
     1143        glOrtho(0 , g_width , g_height , 0 , -1 , 1); 
    11251144        glMatrixMode(GL_MODELVIEW); 
    11261145        glLoadIdentity();