zoukankan      html  css  js  c++  java
  • hge source explor 0x3 windows module

    Windows窗口

      在这里继续看窗口相关的函数,前面看到的部分能够生成一个窗口。在hge的代码中,我们可以看到别的函数处理窗口相关的事情,当然不是指的消息处理函数。

      在hge中消息处理函数是最主要的函数之一,完成了整个游戏的信息输入。

      另外的和窗口相关的函数是

    graphics.cpp
    void HGE_Impl::_AdjustWindow()
    void HGE_Impl::_Resize(int width, int height)

      从函数的名字中可以看到都是处理窗口的变化的函数

      实现 出现位置 作用
    AdjustWindow
    void HGE_Impl::_AdjustWindow()
    {
        RECT *rc;
        LONG style;
    
        if(bWindowed) {rc=&rectW; style=styleW; }
        else  {rc=&rectFS; style=styleFS; }
        SetWindowLong(hwnd, GWL_STYLE, style);
    
        style=GetWindowLong(hwnd, GWL_EXSTYLE);
        if(bWindowed)
        {
            SetWindowLong(hwnd, GWL_EXSTYLE, style & (~WS_EX_TOPMOST));
            SetWindowPos(hwnd, HWND_NOTOPMOST, rc->left, rc->top, rc->right-rc->left, rc->bottom-rc->top, SWP_FRAMECHANGED);
        }
        else
        {
            SetWindowLong(hwnd, GWL_EXSTYLE, style | WS_EX_TOPMOST);
            SetWindowPos(hwnd, HWND_TOPMOST, rc->left, rc->top, rc->right-rc->left, rc->bottom-rc->top, SWP_FRAMECHANGED);
        }
    }
    View Code

    在graphics.cpp中被定义

    1.在设置为窗口模式时调用(system.cpp:368);

    2.在初始化DX的时候被调用(graphics.cpp:720)

    设置窗口的格式、位置
    Resize
    void HGE_Impl::_Resize(int width, int height)
    {
        if(hwndParent)
        {
            //if(procFocusLostFunc) procFocusLostFunc();
    
            d3dppW.BackBufferWidth=width;
            d3dppW.BackBufferHeight=height;
            nScreenWidth=width;
            nScreenHeight=height;
    
            _SetProjectionMatrix(nScreenWidth, nScreenHeight);
            _GfxRestore();
    
            //if(procFocusGainFunc) procFocusGainFunc();
        }
    }
    View Code

    在graphics.cpp中被定义

    1.在窗口发生大小变化时被调用(system.cpp:849)

    在有父窗口的情况下要重新设置大小

     

    对于Resize函数:

    1.窗口模式下,hge中设置为窗口模式是不可调节大小的

    2.全屏模式下,切换到桌面

  • 相关阅读:
    属性注入(依赖注入)
    Spring之ioc
    Spring初始案例
    ::before和::after伪元素、:visited和:link、transform: scaleX(2);的使用
    给博客博文加上日期分类(set、map)
    Jquery父子选取心得
    先从css3开始拾起
    尝试博客文章一号
    Response.setContentType()
    pom配置详解
  • 原文地址:https://www.cnblogs.com/yoru/p/5503326.html
Copyright © 2011-2022 走看看