0

Im using code-blocks and can not figure out how to use gdi32.

This is my code for trying to draw a point at the users current location.

If there is a better way for this please tell me, I have tried to link the gdi32 lib in the complior settings but it does not work. I have tried many sultions but none seem to work

    int progess = player.gameProgress;
    int selection;

    CONSOLE_SCREEN_BUFFER_INFO csbInfo;
    SMALL_RECT screenPos;

    HWND console = GetConsoleWindow();
    HDC hdc = GetDC(console);
    COLORREF color = RGB(255, 255, 255);
    
    HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);

    GetConsoleScreenBufferInfo(hConsole, &csbInfo);

    screenPos = csbInfo.srWindow;


    string titleString = "Developing " + player.gameName;
    titleThing(titleString);
     
        system("CLS");

        drawSquare(screenPos.Right - screenPos.Left, screenPos.Bottom - screenPos.Top);

        while(true){
            POINT mousePos = cursorPostion();
            SetPixel(hdc, mousePos.x, mousePos.y, color);
        }
        
        system("pause");

can someone help me with this

  • 1
    I don't know anything about CodeBlocks, but you need to link with `gdi32.lib` from the Windows SDK. This isn't something you change in your code, but in your project settings. – selbie Oct 23 '22 at 04:13
  • 1
    Which compiler are you using? Also, if you can download Visual Studio community edition, and install the "Desktop Development for C++ " option, you'll get this configuration by default. – selbie Oct 23 '22 at 04:16
  • i have tried that annd it just replaces the error with this `error: ld returned 1 exit status` – Dependra Khatri Oct 23 '22 at 04:17
  • i am useing the gnu gcc complior – Dependra Khatri Oct 23 '22 at 04:18
  • I can not install VS code since this is for a school project and we are not aloud to use other ide's on school computers – Dependra Khatri Oct 23 '22 at 04:21

0 Answers0