Исправьте ошибку с++ библиотека raylib?

Ошибка Process finished with exit code -1073741819 (0xC0000005)
#include <iostream>
#include "raylib.h"

#define RAYGUI_IMPLEMENTATION
int angle;

#include "extras/raygui.h"

#define NUM_PROCESSES    9





static void DrawStyleEditControls(void);  // Draw and process scroll bar style edition controls

//------------------------------------------------------------------------------------
// Program main entry point
//------------------------------------------------------------------------------------
int main()
{
    // Initialization
    //---------------------------------------------------------------------------------------
    const int screenWidth = 1850;
    const int screenHeight = 1000;

    InitWindow(screenWidth, screenHeight, "raygui - GuiScrollPanel()");
    int display = GetCurrentMonitor();
    SetWindowSize(GetMonitorWidth(display)*0.8, GetMonitorHeight(display)*0.8);

    Rectangle panelContentRec = {0, 0, 340, 340 };

    Image imOrigin = LoadImage("parrots.png");   // Loaded in CPU memory (RAM)
    std::cout << imOrigin.width << ' ' <<  imOrigin.height;

    Texture2D texture = LoadTextureFromImage(imOrigin);

    ImageFormat(&imOrigin, PIXELFORMAT_UNCOMPRESSED_R8G8B8A8);         // Format image to RGBA 32bit (required for texture update) <-- ISSUE


    Image imCopy = ImageCopy(imOrigin);


    bool textureReload = false;

    Rectangle toggleRecs[NUM_PROCESSES] = { 0 };
    int mouseHoverRec = -1;

    for (int i = 0; i < NUM_PROCESSES; i++) toggleRecs[i] = (Rectangle){ 40.0f, (float)(50 + 32*i), 150.0f, 30.0f };


    bool showContentArea = true;

    SetTargetFPS(60);
    //---------------------------------------------------------------------------------------

    // Main game loop
    while (!WindowShouldClose())    // Detect window close button or ESC key
    {
        // Update
        //----------------------------------------------------------------------------------
        // TODO: Implement required update logic
//        angle = 0.04;
        //----------------------------------------------------------------------------------


            UnloadImage(imCopy);                // Unload image-copy data
            imCopy = ImageCopy(imOrigin);     // Restore image-copy from image-origin

            // NOTE: Image processing is a costly CPU process to be done every frame,
            // If image processing is required in a frame-basis, it should be done
            // with a texture and by shaders

     //        ImageColorGrayscale(&imCopy);
   //          ImageColorTint(&imCopy, GREEN);
 //            ImageColorInvert(&imCopy);




            Color *pixels = LoadImageColors(imCopy);    // Load pixel data from image (RGBA 32bit)
            UpdateTexture(texture, pixels);             // Update texture with new image data
            UnloadImageColors(pixels);                  // Unload pixels data from RAM

            textureReload = false;





        BeginDrawing();

        ClearBackground(RAYWHITE);

        // Draw rectangles

        DrawTexture(texture, screenWidth - texture.width - 60, screenHeight/2 - texture.height/2, WHITE);
        DrawRectangleLines(screenWidth - texture.width - 60, screenHeight/2 - texture.height/2, texture.width, texture.height, BLACK);


        panelContentRec.width = GuiSliderBar((Rectangle){ 590, 385, 145, 15}, "WIDTH", TextFormat("%i", (int)panelContentRec.width), panelContentRec.width, 1, 600);
        panelContentRec.height = GuiSliderBar((Rectangle){ 590, 410, 145, 15 }, "HEIGHT", TextFormat("%i", (int)panelContentRec.height), panelContentRec.height, 1, 400);
        panelContentRec.one= GuiSliderBar((Rectangle){ 590, 435, 145, 15 }, "hne", TextFormat("%i", (int)panelContentRec.one), panelContentRec.one, 1, 400);
        ImageColorContrast(&imCopy,  panelContentRec.width);
        ImageColorBrightness(&imCopy, panelContentRec.one);
        //-----------------------------------------------------------------

        EndDrawing();

        UnloadTexture(texture);       // Unload texture from VRAM
        UnloadImage(imOrigin);        // Unload image-origin from RAM
        UnloadImage(imCopy);

    }



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

    return 0;
}

// Draw and process scroll bar style edition controls
static void DrawStyleEditControls(void)
{
    // ScrollPanel style controls
    //----------------------------------------------------------
    GuiGroupBox((Rectangle){ 550, 170, 220, 205 }, "SCROLLBAR STYLE");

    int style = GuiGetStyle(SCROLLBAR, BORDER_WIDTH);
    GuiLabel((Rectangle){ 555, 195, 110, 10 }, "BORDER_WIDTH");
    GuiSpinner((Rectangle){ 670, 190, 90, 20 }, NULL, &style, 0, 6, false);
    GuiSetStyle(SCROLLBAR, BORDER_WIDTH, style);








}
  • Вопрос задан
  • 152 просмотра
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы