Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6582847
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:19:57+00:00 2026-05-25T16:19:57+00:00

I am working on a small game and game engine in C++ using DirectX.

  • 0

I am working on a small game and game engine in C++ using DirectX. The purpose is educational & recreational.

My next goal is to build a simple world editor that uses the game engine. For this I will need to move the engine into a dll so it can be consumed by the game and/or by the editor. The world editor will be a stand-alone tool and not part of the game. The main purpose of the world editor will be to read in and display my (custom) scene file, and allow me to annotate/modify properties on world objects (meshes), clone objects, pick up and move objects about and drop them, scale objects, etc., and then save out the modified scene so it can later be read by the game.

It has been recommended that I use wxWidgets for the editor. A bit of research makes me feel that wxWidgets is a bit old and clunky, though I am sure very fine GUIs can be written using it. It’s just a steep learning curve that I don’t look forward to. I have gotten the samples to build and run, but it was a headache.

A little more research and I find that I can integrate DirectX into a WPF app using a D3DImage. I have done a little with WPF and do not find it too intimidating and there are plenty of good books available (there is only one old one for wxWidgets), as well as scads of information on the web. I have gotten the rotating triangle example working and it seemed pretty straightforward.

So my question is:

Will WPF allow me to build a decent little world editor app that re-uses my game engine?

My game engine currently uses RawInput for mouse and keyboard; how will this work with WPF?

How does WPF affect my message pump?

It looks like I will have to write a lot of functions (facade pattern?) to allow WPF to interact with my game engine. Is there an easy way to factor this out so it doesn’t get compiled into the game?

Any other tips or ideas on how to proceed would be greatly appreciated!

Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T16:19:58+00:00Added an answer on May 25, 2026 at 4:19 pm

    You need to create a wrapper class that exposes certain functionality of your game.

    For example. This function is in my c++ game engine editor wrapper.

    extern "C" _declspec(dllexport) void SetPlayerPos(int id, const float x, const float y, const float z);
    

    Then in your c# wpf application you can create a static class allowing you to use those functions

    [DllImport(editorDllName, CallingConvention = CallingConvention.Cdecl)]
    public static extern void SetPlayerPos(int id, float x, float y, float z);
    

    You will have to have functions for your basic functionality of the game engine through the dll.
    things like

    EditorMain
    RenderFrame / Update
    DXShutdown

    So then you can call editormain in your wpf app constructor

    System.IntPtr hInstance = System.Runtime.InteropServices.Marshal.GetHINSTANCE(this.GetType().Module);
    IntPtr hwnd = this.DisplayPanel.Handle;
    NativeMethods.EditorMain(hInstance, IntPtr.Zero, hwnd, 1, this.DisplayPanel.Width, this.DisplayPanel.Height);
    

    You will need to create a message filter class and initialize it in the constructor as well

    m_messageFilter = new MessageHandler(this.Handle, this.DisplayPanel.Handle, this);
    

    here’s how your message filter class could look

    public class MessageHandler : IMessageFilter 
    {
        const int WM_LBUTTONDOWN = 0x0201;
        const int WM_LBUTTONUP = 0x0202;
    
    
        IntPtr m_formHandle;
        IntPtr m_displayPanelHandle;
        EngineDisplayForm m_parent;
    
        public MessageHandler( IntPtr formHandle, IntPtr displayPanelHandle, EngineDisplayForm parent )
        {
            m_formHandle = formHandle;
            m_displayPanelHandle = displayPanelHandle;
            m_parent = parent;
        }
    
        public bool PreFilterMessage(ref Message m)
        {
            if (m.HWnd == m_displayPanelHandle || m.HWnd == m_formHandle)
            {
                switch (m.Msg)
                {
                    case WM_LBUTTONDOWN:
                    case WM_LBUTTONUP:
                        {
                            NativeMethods.WndProc(m_displayPanelHandle, m.Msg, m.WParam.ToInt32(), m.LParam.ToInt32());
                            if (m.Msg == WM_LBUTTONUP)
                            {
                                m_parent.SelectActor();
                            }
                            return true;
                        }
                }
            }
            return false;
        }
    
        public void Application_Idle(object sender, EventArgs e)
        {
            try
            {
                // Render the scene
                NativeMethods.RenderFrame();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
    

    for doing win forms and wpf interop look here
    http://msdn.microsoft.com/en-us/library/ms742474.aspx

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on a small isometric engine for my next iPhone game. To
I'm working on a small templating engine, and I'm using DOMDocument to parse the
I am writing a small shooting game using cocos2d. It's working good in simulator.
I'm currently working on a small 2D game-engine in C++, but I am now
I'm currently working on a small iPhone game, and am porting the 3d engine
I am working on a small game using C++, and I used Eclipse CDT's
I'm working on a small game engine and I've encountered a problem. So far,
I'm working on a small and simple XNA game and I'm noticing I'm spending
I'm working on a small game engine. One of the features of it is
The game engine I am working with is too slow in the debug build

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.