You are not logged in.
Pages: 1
This is a simple script I recently wrote at request. It can be used to create that Web 2.0 - like reflection:
/*
** Usage:
** draw_reflection(source x, source y, source w, source h, target x, target y, target w, target h);
**
** Arguments:
** source x, source y, source w, source h: the coordinates of the source, reals
** target x, target y, target w, target h: the coordinates of the target, reals
**
** Returns:
** nothing
**
** Notes:
** This script automatically:
** - Flips the reflection upside-down
** - Makes the reflection fade away
**
** GMLscripts.com
*/
var bg, tex;
bg = background_create_from_screen(argument[0],argument[1],argument[2],argument[3],false,false)
tex = background_get_texture(bg)
draw_primitive_begin_texture(pr_trianglefan,tex)
draw_vertex_texture_color(argument[4],argument[5],0,1,c_white,1)
draw_vertex_texture_color(argument[4]+argument[6],argument[5],1,1,c_white,1)
draw_vertex_texture_color(argument[4]+argument[6],argument[5]+argument[7],1,0,c_white,0)
draw_vertex_texture_color(argument[4],argument[5]+argument[7],0,0,c_white,0)
draw_primitive_end()
background_delete(bg)
An example: http://updo.nl/file/5f42c8b7.gmk
Last edited by BlueMoonProductions (2011-02-24 07:58:38)
Offline
This pretty neat when it is used with care. It could use some refinement, although it would complicate the script significantly. The problem is gracefully handling cases where the reflection or area being reflected extend beyond the confines of the window. View support would also be welcome, although it may not be technically feasible to mirror areas that are outside of the immediate view.
Thank you for supplying an example.
Abusing forum power since 1986.
Offline
I'll write a more usable script soon
Offline
Pages: 1