0 registered members (),
1,094
guests, and 1
spider. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Retina Burn/Flash Bang
#63637
02/11/06 18:37
02/11/06 18:37
|
Joined: Mar 2003
Posts: 1,524 Canada
Stansmedia
OP
Serious User
|
OP
Serious User
Joined: Mar 2003
Posts: 1,524
Canada
|
Code:
// A white pcx, probably 1280x960 so its big enough for any screensize bmap white_flash = <white.pcx>;
bmap screen_shot_map = <emptypanel.pcx>;// A 640x480 empty PCX bmap screen_shot_map2 = <emptypanel2.pcx>;// A 800x600 empty PCX bmap screen_shot_map3 = <emptypanel3.pcx>;// A 1024x768 empty PCX bmap screen_shot_map4 = <emptypanel4.pcx>;// A 1280x960 empty PCX
panel respawn_flash { bmap = white_flash; // compass_map as panel background pos_X = 0; pos_y = 0; layer = 4; // we want the flash in front of the burn image flags = VISIBLE,TRANSPARENT; }
// copies the screen into a bitmap function grab_screen() { if(video_mode == 6) // 640x480 { bmap_for_screen (screen_shot_map, 1, 0); } if(video_mode == 7) // 800x600 { bmap_for_screen (screen_shot_map2, 1, 0); } if(video_mode == 8) // 1024x768 { bmap_for_screen (screen_shot_map3, 1, 0); } if(video_mode == 9) // 1280x960 { bmap_for_screen (screen_shot_map4, 1, 0); } wait (1); // wait 1 frame until the bitmap can be saved }
panel respawn_burn { bmap = screen_shot_map; pos_X = 0; pos_y = 0; layer = 3; // we want the burn behind the flash flags = VISIBLE,TRANSPARENT; }
function flash() { if(video_mode == 6) // 640x480 { respawn_burn.bmap = screen_shot_map; } if(video_mode == 7) // 800x600 { respawn_burn.bmap = screen_shot_map2; } if(video_mode == 8) // 1024x768 { respawn_burn.bmap = screen_shot_map3; } if(video_mode == 9) // 1280x960 { respawn_burn.bmap = screen_shot_map4; } respawn_burn.alpha = 100; respawn_flash.alpha = 100; }
starter respawn_panel_control { while(1) { if(respawn_burn.alpha > 0) { respawn_burn.alpha -= time*2; } if(respawn_flash.alpha > 0) { respawn_flash.alpha -= time*3; } wait(1); } }
Put this at the top of your code, and when you want the magic to happen, just call the function: Code:
grab_screen(); flash(); in your code. Make sure you dont have it in a loop, and you create the images i mentioned in comments. The bigger the screen size, the longer it takes to capture the screen.. Theirs a small delay for me on 640x480 and 800x600 but after that it gets pretty laggy.
Last edited by bloodred; 02/11/06 20:46.
|
|
|
Re: Retina Burn/Flash Bang
[Re: Stansmedia]
#63639
02/11/06 20:57
02/11/06 20:57
|
Joined: Jun 2005
Posts: 656
Grafton
User
|
User
Joined: Jun 2005
Posts: 656
|
Very cool BloodRed! The only problem is how long it takes to grab the screen. You can scale the panels instead of using all the different sizes. Heres how I implemented your idea; Code:
bmap white_flash = <white.pcx>; //64x64 white pcx bmap screen_shot_map = <emptypnl.pcx>;// A 640x480 empty PCX
panel respawn_flash { bmap = white_flash; pos_X = 0; pos_y = 0; layer = 4; flags = transparent; }
panel respawn_burn { bmap = screen_shot_map; pos_X = 0; pos_y = 0; layer = 3; flags = transparent; }
function flash() { bmap_for_screen (screen_shot_map, 1, 0); wait (1); // wait 1 frame until the bitmap can be saved respawn_burn.bmap = screen_shot_map; respawn_burn.scale_x = screen_size.x / bmap_width(screen_shot_map); respawn_burn.scale_y = screen_size.y / bmap_height(screen_shot_map); respawn_burn.visible = on; respawn_burn.alpha = 100;
respawn_flash.scale_x = screen_size.x / bmap_width(white_flash); respawn_flash.scale_y = screen_size.y / bmap_height(white_flash); respawn_flash.visible = on; respawn_flash.alpha = 100;
while(respawn_burn.alpha > 0 || respawn_flash.alpha > 0) { if(respawn_burn.alpha > 0){respawn_burn.alpha -= time*2;} if(respawn_flash.alpha > 0){respawn_flash.alpha -= time*3;} wait(1); } respawn_burn.alpha = 0; respawn_burn.visible = off; respawn_flash.alpha = 0; respawn_flash.visible = off; }
on_f flash;
Scaling the panels this way seems to work fine! Rhuarc, a backbuffer.dll would be nice! could be used for all sorts of things, I hope you can find the time to follow up on it! Thanks again for sharing your idea and code BloodRed, very cool effect!
Not two, not one.
|
|
|
Re: Retina Burn/Flash Bang
[Re: Zio]
#63641
02/11/06 23:06
02/11/06 23:06
|
Joined: Jun 2005
Posts: 656
Grafton
User
|
User
Joined: Jun 2005
Posts: 656
|
Yes, I found it. Its called render_view.dll. From the included readme:
"This is a simple Dll plugin that grabs the backbuffer render target and blits it to an entity skin"
I am not sure how or even if we could use it to put the backbuffer to a panel though.
Not two, not one.
|
|
|
Re: Retina Burn/Flash Bang
[Re: Matt_Aufderheide]
#63645
02/13/06 13:21
02/13/06 13:21
|
Joined: Mar 2001
Posts: 3,298 Beverly, Massachusetts
Rhuarc
Expert
|
Expert
Joined: Mar 2001
Posts: 3,298
Beverly, Massachusetts
|
Quote:
PLEASE!! dont use my renderview.dll .. it is really slow..too slow to be used in a game i think. The main problem, for nayone who is interested, is that there is no easy way to transfer texturs genereated in the dll to the A6 interface.. so i have to use some slow D3DX function.. this is extremely slow...even if you use a very tiny texture.
Amen to that.
The better way would be to write the rendering routine in the dll itself. Just take my source and modfiy it.. if you have my orginal dll source, someone can do this with some basic D3D knowledge. Just take the backbuffer, and instead of sing D3DXLoadSurfaceFromSurface, define a screen alinged quad and render this with a shader.
This is how I would do it... just render a quad with the texture....
|
|
|
|