Results 1 to 6 of 6

Thread: draw sprites without background

  1. #1

    Default draw sprites without background

    Hi!

    Im very beginner in programming, but i need to write a game for 2010.jan.15
    I have a sprite, what can walk. But when im draw him, he draw a background for the sprite too..
    How can i remove it?
    I had read the things from Collosion Detection, but i think, is not for that...
    Thanks!
    Koli

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

    Default

    Using the image alpha channel.

    See - http://www.rtsoft.com/forums/showthread.php?t=2943

  3. #3

    Default

    He didn't use any alpha chanal... Or did he?

    I found this, in the Doc:

    void CL_SpriteDescription::add_alphaclipped_frames (const CL_Texture& texture, int xpos = 0,int ypos = 0, double trans_limit = 0.05f)

    void CL_SpriteDescription::add_alphaclipped_frames (const CL_PixelBuffer pixelbuffer, int xpos = 0, int ypos = 0,double trans_limit = 0.05f )

    What is the texture or the pielbuffer? Is it my images? (with my figure?)
    And what is the trans_limit thing?
    My code looks like this now(but it still dont work...):

    Code:
    CL_SpriteDescription desc_simple1;
    		desc_simple1.add_frame(CL_ImageProviderFactory::load("arnobitmaps/stopped0000.tga"));
    		desc_simple1.add_alphaclipped_frames(CL_ImageProviderFactory::load("arnobitmaps/stopped0000.tga"),0,0,0.05f);
    
    CL_Sprite sprite1(gc, desc_simple1);

  4. #4

    Default

    I have it with that perl script, but its not the best solution...
    I still cant use this alpha thing...
    My problem is that, im programming now the first time graphic things, and i don't know what mean what...
    So for example what that alpha and grid thing is, and a lot of concept...
    (and my english is bad too, so i don't understand a lot of things...)

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

    Default

    Have a look at the "rock.png" in Examples/LayeredWindow

    Load it into GIMP, and you will get:


    The checkerboard pattern has 0% alpha. The rock has 100% alpha

    (Depending on the current blend mode) - 0% alpha will be see though. 100% alpha you will see the image.

    See - http://en.wikipedia.org/wiki/Alpha_compositing

    add_alphaclipped_frames function - from the docs:
    "The alpha clipper will cut out frames from an image based on
    the transparency in the picture. It first determines the height
    of a row by searching for the first line that it considers
    completely transparent. Then it finds the width of each frame on
    this line by looking for columns that are completely transparency."
    ... to be used when you have multiple images in the same file (but i guess it works with a single image)

  6. #6

    Default

    Thanks man!

Similar Threads

  1. Background animation?
    By NinjaNumberNine in forum Novashell Game Creation System
    Replies: 6
    Last Post: 11-19-2009, 03:24 AM
  2. CL_Surface draw a picture
    By DavinciZhe in forum Official ClanLib SDK Forums
    Replies: 2
    Last Post: 08-08-2009, 02:01 AM
  3. GDI Target Draw Problems
    By rombust in forum Official ClanLib SDK Forums
    Replies: 1
    Last Post: 05-01-2009, 01:21 PM
  4. Scaling when some tile of parallaxed background selected.
    By Rrrichi in forum Novashell Game Creation System
    Replies: 4
    Last Post: 06-13-2007, 03:11 AM
  5. how to create a window with picture background
    By gison in forum Official ClanLib SDK Forums
    Replies: 2
    Last Post: 06-05-2007, 01:34 AM

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
  •