remove_obj — Remove objects from an iconic object tuple. 从图形数组中移除对象
*
* This example demonstrates various use cases for the remove_obj operator.
*此示例演示了 remove_obj 运算符的各种用例
*
dev_update_off ()
dev_close_window ()
dev_open_window (0, 0, 640, 480, 'black', WindowHandle)
set_display_font (WindowHandle, 16, 'mono', 'true', 'false')
*
* Load images of Apples, Berries, Carrots and Potatoes.
read_image (ImagesAll, ['food/vegetables/apple_1','food/vegetables/blueberry_1','food/vegetables/carrot_1','food/vegetables/potato_1'])
*
* There are four objects in the iconic array.
tile_images (ImagesAll, TiledImagesAll, 1, 'vertical')
dev_display (TiledImagesAll)
dev_disp_text ('There are four objects in the iconic array.', 'window', 'top', 'left', 'black', [], [])
stop ()
*
* Remove the carrots (array element 3) from original.
remove_obj (ImagesAll, ImagesReduced, 3)
tile_images (ImagesReduced, TiledImage, 1, 'vertical')
dev_display (TiledImage)
dev_disp_text ('Removed the Carrots (array element 3) from original.', 'window', 'top', 'left', 'black', [], [])
stop ()
*
* Remove Carrots, Potatoes and Apples (Elements 1, 3, and 4).
remove_obj (ImagesAll, ImagesReduced, [1,3,4])
tile_images (ImagesReduced, TiledImage, 1, 'vertical')
dev_display (TiledImage)
dev_disp_text ('Removed Carrots, Potatoes and Apples (Elements 1, 3 and 4).', 'window', 'top', 'left', 'black', [], [])
stop ()
*
* Remove_obj is tolerant against duplicates.
*Remove_obj对重复行为持宽容态度
remove_obj (ImagesAll, ImagesReduced, [3,2,2,3,3])
tile_images (ImagesReduced, TiledImage, 1, 'vertical')
dev_display (TiledImage)
dev_disp_text (['remove_obj is tolerant against duplicates.','Removed Carrots and Blueberries with Index [3,2,2,3,3].'], 'window', 'top', 'left', 'black', [], [])
stop ()
*
* Remove none of the objects.
remove_obj (ImagesAll, ImagesReduced, [])
tile_images (ImagesReduced, TiledImage, 1, 'vertical')
dev_display (TiledImage)
dev_disp_text ('Remove none of the objects.', 'window', 'top', 'left', 'black', [], [])
stop ()
*
* 移除所有对象
remove_obj (ImagesAll, ImagesReduced, [1,2,3,4])
tile_images (ImagesReduced, TiledImage, 1, 'vertical')
dev_clear_window ()
dev_display (TiledImage)
count_obj (ImagesReduced, RemainCount)
dev_disp_text ('Removed all objects, there are ' + RemainCount + ' remaining objects', 'window', 'top', 'left', 'black', [], [])