![]() Then just use this number with the other object functions in the place The #PB_Any constant instead of the indexed number, and the dynamic number will be returned as To create a dynamic object, you just have to specify Both methods (indexed and dynamic) can be used togetherĪt the same time without any conflict. PureBasic provides an easy and complementary way To deal with an unknown number of objects. Sometimes, indexed numbering isn't very handy to handle dynamic situations where we need You plan to use sequential constants to identify your objects (which is alsoĮxample CreateImage(0, 640, 480) Create an image, the n☀ ResizeImage(0, 320, 240) Resize the n☀ imageĮxample CreateImage(2, 640, 480) Create an image, the n☂ ResizeImage(2, 320, 240) Resize the n☂ image CreateImage(2, 800, 800) Create a new image in the n☂ index, the old one is automatically free'edĬreateImage(k, 640, 480) Create 10 different images, numbered from 0 to 9 ResizeImage(k, 320, 240) Create a new image in the n☂ index, the old one is automatically free'ed NextĬreateImage( #ImageBackground, 640, 480) Create an image (n☀) ResizeImage( #ImageBackground, 320, 240) Resize the background image CreateImage( #ImageButton, 800, 800) Create an image (n☁) The maximum index number is limited to an upper bound, depending of the object An object that is associated with an index is automatically freed when reusing that index. Use the object in procedures without declaring anything in global (if using a constant or a number). 'Group' processing, without the need to use an intermediate array. Easier handling, since no variables or arrays are required. The indexed way offers several advantages: More flexible method, use the dynamic way of allocating objects, as described The number 1000, 1001 indexes will be allocated and 999 (from 1 to 999) willīe unused, which is not an efficient way to use indexed objects. This means that if you use the number 0 and then The first available index number is 0 and subsequent indexesĪre allocated sequentially. ![]() The static, indexed way, allows you to reference an object by a predefined When creating an Image object, weĬan do it in two ways: indexed and dynamic. Same logic applies to all other PureBasic objects. For the demonstration, we will use the Image object, but the The purpose of this section is to describe the behavior, creation, and handling of
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |