Results 1 to 5 of 5

Thread: how to detect the outline of a drawing drawn by CL_Draw?

  1. #1

    Default how to detect the outline of a drawing drawn by CL_Draw?

    I want to create a circle, then assign an outline to it for collision detection. That is basically the idea but I don't know how to go about that. Anyone can help?

    I use Clanlib 2.1.1 and it's my first time to use Clanlib. My game has one window and one graphic context gc1, for eg, provided by it.
    I draw background picture via gc1
    I draw sprites via gc1
    I draw a circle using CL_Draw::circle() via gc1
    --> I'm stuck here.

    In SDL, I could achieve this by drawing my circle in a separate surface, then make my surface transparent. However in Clanlib 2.1.1, since everything is drawn by gc I can't isolate my circle from the rest. I tried searching for another function to draw a circle but was in vain.
    I would appreciate if anybody give some light.

  2. #2
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    You can draw it to a framebuffer.

    And use "gc.get_pixeldata" to obtain the CL_PixelBuffer for use in the collisions.

    See Examples/Canvas

    (I have not tried this)

  3. #3

    Default

    Quote Originally Posted by rombust View Post

    See Examples/Canvas

    (I have not tried this)
    Thanks for your reply . I visited clanlib.org/wiki/Canvas but there's no codes there, just the picture

  4. #4
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    Download the ClanLib 2.1.1 source at: http://clanlib.org/wiki/Download
    The examples can be found inside that package

  5. #5

    Default

    Quote Originally Posted by rombust View Post
    Download the ClanLib 2.1.1 source at: http://clanlib.org/wiki/Download
    The examples can be found inside that package
    Thanks a lot. I will study the codes and hopefully I'll get the solution soon.

    Have a great weekend

Similar Threads

  1. Outline Collision Resolution Mayhem!
    By Dincu in forum Official ClanLib SDK Forums
    Replies: 4
    Last Post: 07-24-2009, 11:18 PM
  2. CL_Draw question
    By catch22 in forum Official ClanLib SDK Forums
    Replies: 3
    Last Post: 07-08-2009, 05:11 PM
  3. About CL_Draw question?
    By Eng C. Born in forum Official ClanLib SDK Forums
    Replies: 4
    Last Post: 05-14-2009, 09:38 PM
  4. detect thread support
    By gergo in forum Official ClanLib SDK Forums
    Replies: 5
    Last Post: 02-13-2009, 10:12 AM
  5. How to detect when the editor is opening?
    By Uhfgood in forum Novashell Game Creation System
    Replies: 1
    Last Post: 07-07-2008, 11:55 PM

Bookmarks

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
  •