Skip to content

Commit

Permalink
multiple context hack
Browse files Browse the repository at this point in the history
  • Loading branch information
Michele Tampellini committed Jul 21, 2020
1 parent 02387f1 commit 6ddc54c
Show file tree
Hide file tree
Showing 4 changed files with 778 additions and 687 deletions.
72 changes: 72 additions & 0 deletions examples/core/core_basic_multiple-windows.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/*******************************************************************************************
*
* raylib [core] example - Basic window
*
* Welcome to raylib!
*
* To test examples in Notepad++, provided with default raylib installer package,
* just press F6 and run [raylib_compile_execute] script, it will compile and execute.
* Note that compiled executable is placed in the same folder as .c file
*
* You can find all basic examples on [C:\raylib\raylib\examples] directory and
* raylib official webpage: [www.raylib.com]
*
* Enjoy using raylib. :)
*
* This example has been created using raylib 1.0 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
*
* Copyright (c) 2013-2020 Ramon Santamaria (@raysan5)
*
********************************************************************************************/

#include "raylib.h"

int main(void)
{
// Initialization
//--------------------------------------------------------------------------------------
const int screenWidth = 800;
const int screenHeight = 450;

InitWindow(screenWidth, screenHeight, "raylib [core] example - window 1");
InitWindow(screenWidth, screenHeight, "raylib [core] example - window 2");

SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------

// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
//----------------------------------------------------------------------------------
// TODO: Update your variables here
//----------------------------------------------------------------------------------

// Draw
//----------------------------------------------------------------------------------
BeginDrawing(0);

ClearBackground(RAYWHITE);

DrawText("Congrats! You created your FIST window!", 190, 200, 20, LIGHTGRAY);

EndDrawing();

BeginDrawing(1);

ClearBackground(RAYWHITE);

DrawText("Congrats! You created your SECOND window!", 190, 200, 20, LIGHTGRAY);

EndDrawing();
//----------------------------------------------------------------------------------
}

// De-Initialization
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------

return 0;
}
Loading

2 comments on commit 6ddc54c

@dakota72
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi,
I tried to multiple window, It's work but the second windows is grayscale, the colours doesn't appears.
do you know why?

@MarcosLeonardoMendezGerencir

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, I tried to multiple window, It's work but the second windows is grayscale, the colours doesn't appears. do you know why?

I have the same problem as you. ceo it's something with rlSetContext(CORE.currentWindow)

Please sign in to comment.