从窗口过程中的原始输入传递值

发布于 2025-01-05 02:56:37 字数 476 浏览 5 评论 0原文

目前,这是我的窗口过程 (WINDPROC) 中的 WM_INPUT 情况。

case WM_INPUT:
{
    // ... Some code to pull out the input from the message
    if(InputType == Keyboard)
    {
        if(KeyCode == KEY_W)
        {
             // Do Stuff Here
        }
    }
 // And so on...
}

但是,我希望能够执行以下操作...

if(KeyCode == KEY_W)
{
    g_InputManager->PressKey(KEY_W);
}

以便我的游戏引擎知道何时按下某个键,我想知道如何将数据输入/输出窗口过程,或者如何处理外部的原始输入的窗口过程。 提前致谢。

Currently, this is the WM_INPUT case in my Window Procedure (WINDPROC).

case WM_INPUT:
{
    // ... Some code to pull out the input from the message
    if(InputType == Keyboard)
    {
        if(KeyCode == KEY_W)
        {
             // Do Stuff Here
        }
    }
 // And so on...
}

But, I want to be able to do the following...

if(KeyCode == KEY_W)
{
    g_InputManager->PressKey(KEY_W);
}

So that my game engine knows when a key is pressed, I would like to know how to get data in/out of the window procedure, or how to process raw input outside of the window procedure.
Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

苏辞 2025-01-12 02:56:37

这是一个非常简单的问题,我发现现在我所做的就是创建一个全局类指针,将其暴露给窗口过程,然后用它将数据推送到外部类。

This was a pretty simple question and I see that now, all I did was make a global class pointer, exposed it to the window procedure, and then used it to push data to the external class.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文