Results 1 to 4 of 4

Thread: How to set clan::Cursor from clan::Sprite frame

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Default How to set clan::Cursor from clan::Sprite frame

    Hi. I wish set cursor icon from sprite frame. It worked, but cursor pixels is mixed. Where is my bug?

    Code:
    	clan::Texture2D texture = pointer.get_frame_texture(0).get_texture();
    	clan::PixelBuffer buffer = texture.get_pixeldata(canvas.get_gc());
    	buffer.lock(canvas.get_gc(), clan::BufferAccess::access_read_only);
    	clan::CursorDescription description;
    
    	description.add_frame(buffer);
    	clan::Cursor cursor = clan::Cursor(window, description);
    
    	window.set_cursor(cursor);
    clan::Image created in this way is drawn correctly

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

    Default

    afaik, buffer.lock(canvas.get_gc(), clan::BufferAccess::access_read_only); isn't required (and your not calling unlock anywhere)

    btw, you might find it easier to load the pixelbuffer via PixelBuffer(const std::string &fullname) or clan::PNGProvider::load()

    Else it looks fine.

    Possibly a bug in ClanLib.

    Ensure your using https://github.com/sphair/ClanLib repo

  3. #3

    Default

    Yes, latest version. master branch
    well, I will try to fix or set cursor to a different way

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

    Default

    maybe its a rgba8 vs abgr8 issue

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
  •