Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
what is the difference between a sprite class object and a bitmap class object — Gideros Forum

what is the difference between a sprite class object and a bitmap class object

fozbstudiosfozbstudios Member
edited May 2012 in General questions
just as the title says, I'm a total newb!
Tagged:

Comments

  • atilimatilim Maintainer
    edited May 2012
    Hi and welcome :)

    Mainly, Sprite class is used to contain and group other sprites and Bitmap class is used to display Textures or TextureRegions on the stage.

    You can create a Sprite class object by:
    local sprite = Sprite.new()
    and a Bitmap class object by:
    local texture = Texture.new("image.png")
    local bitmap = Bitmap.new(texture)
    Because Bitmap class inherits from Sprite class, you can use all of the Sprite functions with a Bitmap object.

    Likes: fozbstudios

    +1 -1 (+1 / -0 )Share on Facebook
  • so for displaying a control use bitmap
  • atilimatilim Maintainer
    edited May 2012
    If your control consists of a single image, yes. Otherwise you need to create multiple bitmaps and add them to a parent sprite.
  • ok thanks for the help!!!!
  • any performance gains to be had from adding all of my controls in the right places then putting them in a single sprite object?
  • atilimatilim Maintainer
    I recommend to put them in a single sprite object for ease of use. I think the performance difference between two is negligible.
  • How is it easier? Sorry for all the noob questions!
  • last question can sprites be multi-nested? ex: floor sprite inside building sprite inside city sprite.
  • bowerandybowerandy Guru
    edited May 2012
    @fozbstudios, yes Sprites can be multiply nested.

    I think the name, Sprite, is perhaps a bit misleading since I've previously thought of sprites as moveable/animatable graphic images inside games. This is not exactly what they are in Gideros.

    A better name might be "Group" (or Layer) because they behave pretty much like group objects inside graphic editor programs like Illustrator. In particular, the width/height of a Sprite is determined by its contents, e.g. an empty Sprite doesn't have a size.

    In order to have a size and be visible on screen a Sprite must have some visible contents as its children. These children must be Bitmaps, Shapes or TextFields as these objects are the classes that are directly visible.

    best regards

  • I think the name is probably inspired by Flash - as Sprite is used in Flash terminology to represent a group of objects.

    When I think of the gideros display hierarchy I imagine it as a tree structure, sprites are the branches and bitmaps are the leaves
    WhiteTree Games - Home, home on the web, where the bits and bytes they do play!
    #MakeABetterGame! "Never give up, Never NEVER give up!" - Winston Churchill
  • I am totally up to speed now (they're like groups in the other lua based sdk, you know, the one that sounds like nonona) ;)
  • I think the name is probably inspired by Flash - as Sprite is used in Flash terminology to represent a group of objects.
    The term sprite existed long before Flash.
    http://en.wikipedia.org/wiki/Sprite_(computer_graphics)
  • gorkemgorkem Maintainer
    Commodore used "sprite" officially to represent an object on the screen. E.g there used to be a maximum of 8 sprites on the screen at once, and this was mentioned in docs.
  • I was actually referring it is use as a container for other objects which mirrors it's use in the flash vernacular :)
    WhiteTree Games - Home, home on the web, where the bits and bytes they do play!
    #MakeABetterGame! "Never give up, Never NEVER give up!" - Winston Churchill
  • I was actually referring it is use as a container for other objects which mirrors it's use in the flash vernacular :)
    So do I, but I wonder if it is lightweight enough for just act a container?


Sign In or Register to comment.