Thread: Easiest 2D drawing library for bloodshed compiler?

  1. #1
    Registered User
    Join Date
    Nov 2005
    Posts
    1

    Easiest 2D drawing library for bloodshed compiler?

    I need to do some basic 2d graphics with some data.

    Ive been going over various graphics libraries and im having trouble finding one that will work with this compiler. Ive searched various threads and found windows based GUI stuff but that seems to be just for visual c++?

    any help?

    thanks.

  2. #2
    Computer guy
    Join Date
    Sep 2005
    Location
    I'm lost!!!
    Posts
    200
    use OpenGL:
    www.nehe.gamedev.net
    you'll find alot of stuff on this site. (go into the lesson sections)
    Hello, testing testing. Everthing is running perfectly...for now

  3. #3
    Sweet
    Join Date
    Aug 2002
    Location
    Tucson, Arizona
    Posts
    1,820
    Well If you just need basic 2d just use SDL or Allegro.
    Woop?

  4. #4
    Super Moderater.
    Join Date
    Jan 2005
    Posts
    374
    Allegro certainly simplifies matters, however, you can draw 2D lines using bloodshed as a compiler if you start your project in win32.

    1. File >> new >>project >> windows application >>name your file etc.


    Cut and paste the code from your internet source and you should be able to draw 2d lines.

    Code:
    //---------------------------------------------------------------------------
    #include <windows.h>
    
    //---------------------------------------------------------------------------
    HWND hWnd;
    const char ClsName[] = "GDIFund";
    const char WindowCaption[] = "GDI Fundamentals";
    LRESULT CALLBACK WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
    //---------------------------------------------------------------------------
    INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
                       LPSTR lpCmdLine, int nCmdShow)
    {
        MSG         Msg;
        WNDCLASSEX  WndClsEx;
    
        WndClsEx.cbSize        = sizeof(WNDCLASSEX);
        WndClsEx.style         = CS_HREDRAW | CS_VREDRAW;
        WndClsEx.lpfnWndProc   = WndProc;
        WndClsEx.cbClsExtra    = NULL;
        WndClsEx.cbWndExtra    = NULL;
        WndClsEx.hInstance     = hInstance;
        WndClsEx.hIcon         = LoadIcon(hInstance, IDI_APPLICATION);
        WndClsEx.hCursor       = LoadCursor(NULL, IDC_ARROW);
        WndClsEx.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
        WndClsEx.lpszMenuName  = NULL;
        WndClsEx.lpszClassName = ClsName;
        WndClsEx.hIconSm       = LoadIcon(hInstance, IDI_APPLICATION);
    
        RegisterClassEx(&WndClsEx);
    
        hWnd = CreateWindowEx(WS_EX_OVERLAPPEDWINDOW,
                              ClsName,
                              WindowCaption,
                              WS_OVERLAPPEDWINDOW,
                              100,
                              120,
                              640,
                              480,
                              NULL,
                              NULL,
                              hInstance,
                              NULL);
    
        ShowWindow(hWnd, nCmdShow);
        UpdateWindow(hWnd);
    
        while( GetMessage(&Msg, NULL, 0, 0) )
        {
            TranslateMessage(&Msg);
            DispatchMessage(&Msg);
        }
    
        return 0;
    }
    //---------------------------------------------------------------------------
    LRESULT CALLBACK WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
    {
        HDC hDC;
        PAINTSTRUCT Ps;
    
        switch(Msg)
        {
        case WM_PAINT:
            hDC = BeginPaint(hWnd, &Ps);
            MoveToEx(hDC, 60, 20, NULL);
            LineTo(hDC, 60, 122);
            LineTo(hDC, 264, 122);
            LineTo(hDC, 60, 20);
            EndPaint(hWnd, &Ps);
            break;
        case WM_DESTROY:
            PostQuitMessage(WM_QUIT);
            break;
        default:
            return DefWindowProc(hWnd, Msg, wParam, lParam);
        }
        return 0;
    }
    //---------------------------------------------------------------------------

    ...Draws a simple triangle
    Last edited by treenef; 11-12-2005 at 04:13 AM.

  5. #5
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    treenef, your code formatter doesn't highlight const.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  6. #6
    Registered User Queatrix's Avatar
    Join Date
    Apr 2005
    Posts
    1,342
    It doesn't bold switch, case, default or break either.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 3
    Last Post: 04-29-2009, 06:42 AM
  2. added start menu crashes game
    By avgprogamerjoe in forum Game Programming
    Replies: 6
    Last Post: 08-29-2007, 01:30 PM
  3. Need a 2D graphics library with following reqs
    By bigdreamer in forum Game Programming
    Replies: 19
    Last Post: 12-01-2005, 06:17 AM
  4. very weird .h problem
    By royuco77 in forum C++ Programming
    Replies: 1
    Last Post: 09-11-2005, 07:55 AM
  5. OpenScript2.0 Compiler
    By jverkoey in forum C++ Programming
    Replies: 3
    Last Post: 10-30-2003, 01:52 PM