none
Any ideas on adding shapes w/o seeing them? RRS feed

  • Question

  • I'd like to add shape objects & images at the top left corner - mainly so that I can reference its top/left edges by the upper left corner of the object.  Adding images from a file also forces this behavior I believe.  But adding them this way lets you see the objects in the graphics window unless the window is hidden.  However I need to create graphic objects during a game.  Any thoughts on how I could add objects at 0,0 invisibly?
    Wednesday, June 3, 2009 10:10 PM

Answers

  • This a known feature of SmallBasic.  The only idea I have is to immediately move the object out of the GraphicsWindow as soon as you create it - for me, they then don't appear until they are moved into view later as required.  For example:

    GraphicsWindow.Show()

    For i = 1 To 20
      ball = Shapes.AddEllipse(100,100)
      Shapes.Move(ball,-1000,-1000)
      Array.SetValue("balls",i,ball)
    EndFor

    Program.Delay(1000)

    For i = 1 To 20
      ball = Array.GetValue("balls",i)
      Shapes.Move(ball,10*i,10*i)
      Program.Delay(100)
    EndFor
    • Marked as answer by bigdaddyo Thursday, June 4, 2009 2:22 AM
    Wednesday, June 3, 2009 10:49 PM
    Moderator

All replies

  • This a known feature of SmallBasic.  The only idea I have is to immediately move the object out of the GraphicsWindow as soon as you create it - for me, they then don't appear until they are moved into view later as required.  For example:

    GraphicsWindow.Show()

    For i = 1 To 20
      ball = Shapes.AddEllipse(100,100)
      Shapes.Move(ball,-1000,-1000)
      Array.SetValue("balls",i,ball)
    EndFor

    Program.Delay(1000)

    For i = 1 To 20
      ball = Array.GetValue("balls",i)
      Shapes.Move(ball,10*i,10*i)
      Program.Delay(100)
    EndFor
    • Marked as answer by bigdaddyo Thursday, June 4, 2009 2:22 AM
    Wednesday, June 3, 2009 10:49 PM
    Moderator
  • Thanks, that helped quite a bit.  I still see a shape or two flash by, I'm adding alot of objects.  But it's acceptable now.
    Thursday, June 4, 2009 2:22 AM