none
Load All Shapes and images when a Program start RRS feed

  • Question

  • Hi Everyone ! I got some puzzles again!  :  )

    This time I want to know how to make a loading bar to load images and shapes, or just load the shapes and images BEFORE program go to main interface.

    Why did this problem come to me? Because I noticed that when I write a bounch of code for adding shapes,and setting the shapes positions and Zoom rate,it will be a very very fast moving of the shapes.

    For example:

    If i add many shapes:

    s[1] = Shapes.AddEllipse  (80,80)

    s[2] = Shapes.AddEllipse (80,80)

    s[3] = Shapes.AddEllipse (80,80)

    s[4] = Shapes.AddEllipse (80,80)

    s[5] = Shapes.AddEllipse (80,80)

    s[6] = Shapes.AddEllipse (80,80)......

    Then set the position of the shapes :

    Shapes.move(s[1],100,100)

    Shapes.move(s[2],110,100)

    Shapes.move(s[3],120,100)

    Shapes.move(s[4],130,100)

    Shapes.move(s[5],140,100)

    Shapes.move(s[6],150,100)

    Now I start the program ,we will see a very fast move of these shapes from original positions to the new positions.

    So, How to fix this? The fast move or fast zoom of a shape will damage the beauty of interface. is there any way to pre-load shapes and images?

    With best Regards

    Zaoeyo

    Wednesday, January 25, 2012 1:08 PM

Answers

  • How about this technique.  Refer HTW116

    Load_shapes()  ....  loads all images and add shapes, zoom,rotate,move

    graphics.window.hide()

    Init_view()    ....  sets window width,height,backgroundcolor ,etc..

    graphicswindow.show() .... shapes appears from here

    • Marked as answer by Zaoeyo Friday, January 27, 2012 2:30 AM
    Thursday, January 26, 2012 8:39 AM
    Answerer

All replies

  • The only thing is to move the shape immediately after creating it, or use an extension to pause the GraphicsWindow updates while the images are being created, then restart the updates when everything is positioned.

    The LitDev extension (see sticky thread 'List of SmallBasic Extensions') has methods to do this, LDUtilities.PauseUpdates() and LDUtilities.ResumeUpdates().

    Wednesday, January 25, 2012 6:37 PM
    Moderator
  • Hi litdev,

    Thanks for your reply!!I will find a new way to stop the Graphic updating using the non-extension way .

    I think that making a big delay for Graphic to stop images or shapes update,maybe a bounch of loops to get the updates stopped.

    With best regards

    Zaoeyo

    Thursday, January 26, 2012 8:19 AM
  • How about this technique.  Refer HTW116

    Load_shapes()  ....  loads all images and add shapes, zoom,rotate,move

    graphics.window.hide()

    Init_view()    ....  sets window width,height,backgroundcolor ,etc..

    graphicswindow.show() .... shapes appears from here

    • Marked as answer by Zaoeyo Friday, January 27, 2012 2:30 AM
    Thursday, January 26, 2012 8:39 AM
    Answerer
  • Hi Naochan,

    Thanks for answering !!! That's the way to resolve the problem !

    With best regards

    Zaoeyo

    Friday, January 27, 2012 2:32 AM