81
Other Discussion / Jesus
« on: May 25, 2006, 10:26:45 pm »
Jesus didn't walk on water. I believe it is connotation that he walked on ice, bitces.
Any Game Maker user who uses "treat uninitialized variables as 0" for anything other than testing purposes deserves the unterminating hell it brings upon the game making process.
var temp;
temp = 20;
execute_string("if(temp > 15) {keyboard_wait();};");
s = surface_create(view_wview,view_hview);
surface_set_target(s);
draw_clear_alpha(c_black,0);
screen_redraw();
draw_set_blend_mode_ext(bm_inv_dest_alpha,bm_one);
draw_set_color(c_black);
draw_rectangle(view_xview,view_yview,view_xview+view_wview,view_yview+view_hview,0);
draw_set_blend_mode(bm_normal);
surface_reset_target();
instance_deactivate_all(1);
Now, let me explain what this does. First of all, it creates a surface on whic the screen will be drawn. All graphics on the screen are captured onto this surface. Then, all instances are deactivated, all of their drawing stops, but the menu object is still activated. In the draw event, all you must do is draw the surface onto the screen, redrawing all of the previous graphics that aren't drawn when deactivated. Even so, there is a slight problem. Surfaces have a weird error in which rather than combining alpha values on top of each other (.3 + .4 = .7), only the last alpha value is drawn (.3 + .4 = .4). To remedy this, first, the whole surface is cleared (draw_clear_alpha), and then after the sccreen is captured, a special blend mode is set. A black rectangle is drawn, but since the blend mode forces black to become transparent, it resets the alpha to 1 without actually adding or drawing anyhting else to the screen! This fixes any alpha problems there might be in a simple, quick line of code.//draw_line_thickness(x1,y1,x2,y2,thickness);
var thickness, startX, startY, endX, endY, tX;
startX = argument0;
startY = argument1;
endX = argument2;
endY = argument3;
thickness = argument4; //in pixels
tX = abs(endX - startX);
draw_sprite_ext(sprLine,0,startX,startY,tX,thickness,point_direction(startX,startY,endX,endY),c_white,1);
temp_id = instance_position(mouse_x,mouse_y,all);
if(temp_id != noone) {
var tx, ty, tsw, tsh;
tx = temp_id.x;
ty = temp_id.y;
tsw = sprite_get_width(temp_id.sprite_index);
tsh = sprite_get_height(temp_id.sprite_index);
screen_save_part("sprite.bmp",tx,ty,tsw,tsh);
}