Results 1 to 4 of 4

Thread: How to use the PSDL_Rect type

  1. #1

    How to use the PSDL_Rect type

    I have created a PSDL_Rect object using the “new” command, can anyone tell me how to then free this object to release the memory. I’ve tried different methods but keep getting access violations.

  2. #2

    Re: How to use the PSDL_Rect type

    (I use FPC's SDL units, so it's barely different)

    You shouldn't (AFAIK) need to create or free a rect.
    [pascal]
    procedure useless;
    var
    r: TSDL_Rect;
    begin
    r.x := 0;
    r.y := 0;
    r.w := 100;
    r.h := 100;
    SDL_BlitSurface(img,nil,scr,@r);
    end;
    [/pascal]
    Keep in mind I haven't actually checked for memory leaks this way but even the C++ SDL tutorials on the internet don't seem to bother creating or freeing the rects.

  3. #3

    Re: How to use the PSDL_Rect type

    I'm using the PSDR_Rect and not the TSDR_Rect. The one I use is a pointer to a rect so I create it by using "new". I'm guessing it should be freed but thanks for you reply.

  4. #4

    Re: How to use the PSDL_Rect type

    You should dispose it with the Dispose function, but really, why bother?

    Why not use pointers to an automatically allocated TSDL_Rect?
    Peregrinus, expectavi pedes meos in cymbalis
    Nullus norvegicorum sole urinat

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •