Can't do multiple windows in different threads

-2

The title says it all. I'm trying to run multiple programs at the same time with Raylib-Cs

In the class of my main window, i do this:

Thread SecondaryProgram = new Thread(DebugWindow.Run);
SecondaryProgram.Start();

The DebugWindow variable is an instance of the DebuggerWindowInstance class. Here are it's contents:

    class DebuggerWindowInstance
    {
        const int WINDOW_WIDTH = 1280;
        const int WINDOW_HEIGHT = 720;

        public void Run()
        {

            InitWindow(WINDOW_WIDTH, WINDOW_HEIGHT, "Debugger");
            
            while (true)
            {
                BeginDrawing();
                ClearBackground(DARKGRAY);



                EndDrawing();
            }
        }
    }

What was expected:

My main window working as usual and a blank secondary window.

What i got:

[NOTHING WORKS]
The program was exited with the code -1073740771 (0xc000041d).

(That's all of my debug info, this is the only thing that appears in console.

I noticed that if i delete the line "InitWindow(WINDOW_WIDTH, WINDOW_HEIGHT, "Debugger");", the program works (still got an error for not initializating the window).

Seems like the program can't handle multiple windows? I don't know. Please help me.

c#
multithreading
raylib
asked on Stack Overflow Sep 27, 2020 by user14351661 • edited Sep 28, 2020 by user14351661

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0