New engine features |
Top Previous Next |
pan_setbmap (panel, element_type, element_number, new_bitmap)
Replaces the bmap for any panel element.
panel test_pan { layer = 5; button = 50, 150, movie1_pcx, movie1_pcx, movie1_pcx, null, null, null; flags = visible; }
// press "R" to replace the first movie1_pcx bitmap in the "button" definition function replace_button() { pan_setbmap (test_pan, 3, 0.1, movie2_pcx); }
on_r = replace_button;
panel.angle, panel.center
These new instructions allow us to rotate a panel about its center.
bmap main_pcx = <main.pcx>;
panel* pan;
panel test_pan { pos_x = 400; pos_y = 200; bmap = main_pcx; flags = overlay, visible; }
function pan_rotate(p) { pan = p; // set the panel pointer from the function parameter pan.center_x = pan.size_x * 0.5; // set the rotation center at the panel center pan.center_y = pan.size_y * 0.5; while (pan.angle < 360) // one full rotation { pan.angle += 10 * time_step; wait (1); pan = p; // local variables are preserved during wait(), global pointers aren't } pan.angle = 0; }
function rotate_panel() { pan_rotate (test_pan); }
on_r = rotate_panel; // press "R" to rotate the panel
layer_sort (element, new_layer)
Places a panel, a text, a view, a view entity or a sky entity on a specified layer. bmap movie1_pcx = <movie1.pcx>; bmap movie2_pcx = <movie2.pcx>;
panel one_pan { bmap = movie1_pcx; layer = 5; flags = overlay, visible; }
panel two_pan { bmap = movie2_pcx; layer = 6; // two_pan appears over one_pan at game start flags = overlay, visible; }
function switch_layers() { layer_sort(one_pan, 7); // press "S" to make one_pan appear over two_pan }
on_s = switch_layers;
|