Versie 1.4- Nu met plugins...
- ... en Drag & Drop!
D&D:
Voorbeeldplugin:Maak een nieuwe project en sla hem op in een nieuwe map "Plugins" waar het programma in zit.
Zet in de script form_room_draw_room_data deze code:
/* Plugin: form_room_draw_room_data()
* Plugin script used when displaying window_data.room_data.
*/
var i;
draw_clear(irandom_range(192,255)*$10101)
draw_rectangle(sin(current_time/1000)*width/2+width/2,0,width,height)
draw_set_font(font_large)
draw_text(5,5,"Test room plugin")
draw_set_color(c_blue)
for(xx=0;xx<width+snap_x;xx+=snap_x)
draw_line(xx,0,xx,height)
for(yy=0;yy<height+snap_y;yy+=snap_y)
draw_line(0,yy,width,yy)
outside_border=0
Geavanceerde voorbeeld:
[spoiler]
/* Plugin: form_room_draw_room_data()
* Plugin script used when displaying window_data.room_data.
*/
//draw_set_blend_mode_ext(bm_one,bm_inv_src_alpha)
if bg_showcolor
{
draw_clear(bg_color)
draw_set_color(bg_color)
draw_rectangle(0,0,width,height,0)
}
/*else
{
draw_set_color(c_black)
draw_rectangle(0,0,width,height,0)
}*/
for(i=0;i<bg_count;i+=1)
{
img=data_get_path(global.project.resources,"Backgrounds\index="+string(bg_index[i])+"\<meta>\display_picture",-1)
if !background_exists(img)
{
bg_w[i]=0
bg_h[i]=0
bg_img[i]=-1
}
else
{
bg_w[i]=background_get_width(img)
bg_h[i]=background_get_height(img)
bg_img[i]=img
}
if bg_img[i]!=-1
{
if bg_htiled[i]||bg_vtiled[i]
{
d3d_transform_stack_push()
d3d_transform_add_translation(floor((-other.shifth)/bg_w[i])*bg_w[i],
floor((-other.shift)/bg_h[i])*bg_h[i],
0)
draw_background_tiled(bg_img[i],bg_x[i]+current_time/1000*spd*bg_hspeed[i],
bg_y[i]+current_time/1000*spd*bg_vspeed[i])
d3d_transform_add_translation(bg_w[i],bg_h[i],0)
draw_background_tiled(bg_img[i],bg_x[i]+current_time/1000*spd*bg_hspeed[i],
bg_y[i]+current_time/1000*spd*bg_vspeed[i])
d3d_transform_stack_pop()
}
else
draw_background(bg_img[i],bg_x[i]+current_time/1000*spd*bg_hspeed[i],bg_y[i]+current_time/1000*spd*bg_vspeed[i])
}
}
draw_set_color(background_color)
/*draw_set_color(background_color)
draw_rectangle(width,-24,-other.shifth+global.width,-other.shift+global.height,0)
draw_rectangle(-24,height,-other.shifth+global.width,-other.shift+global.height,0)
draw_rectangle(-24,-24,width,0,0)
draw_rectangle(-24,0,0,height,0)*/
draw_background_tiled_area(bg_grid+(color_get_value(background_color)<=128),room_data.shifth*-.75,room_data.shift*-.75,width,-24,-other.shifth+global.width-1,-other.shift+global.height)
draw_background_tiled_area(bg_grid+(color_get_value(background_color)<=128),room_data.shifth*-.75,room_data.shift*-.75,-24,height,-other.shifth+global.width,-other.shift+global.height-1)
draw_background_tiled_area(bg_grid+(color_get_value(background_color)<=128),room_data.shifth*-.75,room_data.shift*-.75,-24,-24,width,-1)
draw_background_tiled_area(bg_grid+(color_get_value(background_color)<=128),room_data.shifth*-.75,room_data.shift*-.75,-24,0,-1,height)
draw_sprite_stretchedcenter(spr_window_shadow_large,0,-76,-76,76,width+152,height+152,c_white,1,0)
if play
{
depth_list=ds_priority_create()
with(obj_instance) if inst_room=other.id||_persistent
ds_priority_add(depth_list,id,depth-(id-100000)/100000)
while(!ds_priority_empty(depth_list)) with(ds_priority_delete_max(depth_list)) //for(i=0;i<inst_count;i+=1)
event_user(0)
ds_priority_destroy(depth_list)
if error_occurred
{
global.error_panel_text+=nl+"Room "+other.name+" runtime error: "+nl+error_last+nl
play=0
with(obj_instance) if inst_room=other.id
instance_destroy()
error_occurred=0
error_last=""
}
}
else
{
for(i=0;i<inst_count;i+=1)
{
if inst_display_spr[i]=-1
img=data_get_path(global.project.resources,"Objects\index="+string(inst_object_index[i])+"\<meta>\display_picture",-1)
else
img=inst_display_spr[i]
if !sprite_exists(img)
{
inst_display_w[i]=0
inst_display_h[i]=0
inst_display_spr[i]=-1
}
else
{
inst_display_w[i]=sprite_get_width(img)
inst_display_h[i]=sprite_get_height(img)
inst_display_spr[i]=img
}
if inst_x[i]+inst_display_w[i]>=-other.shifth
if inst_y[i]+inst_display_h[i]>=-other.shift
if inst_x[i]-inst_display_w[i]<=-other.shifth+global.width
if inst_y[i]-inst_display_h[i]<=-other.shift+global.height
{
draw_set_color(c_white)
if inst_3d_model[i]!=-1
{
draw_set_color(c_white)
d3d_transform_stack_push()
d3d_transform_add_translation(-other.shifth,-other.shift,0)
d3d_transform_add_scaling(256,256,-global.width/2000*mouse_x/room_width)
//d3d_transform_add_rotation_y(current_time/30)
d3d_transform_add_translation(other.shifth,other.shift,0)
d3d_transform_add_translation(inst_x[i],inst_y[i],inst_z[i])
d3d_model_draw(inst_3d_model[i],0,0,0,inst_3d_tex[i])
d3d_transform_stack_pop()
}
else if inst_display_spr[i]=-1
draw_sprite(spr_icons,31,inst_x[i],inst_y[i])
else
{
//draw_sprite_part(inst_display_spr[i],0,0,0,inst_display_w[i],inst_display_h[i],inst_x[i],inst_y[i])
//draw_sprite_ext(inst_display_spr[i],0,inst_x[i],inst_y[i]+inst_display_h[i],1,-1,0,c_white,1)
if global.d3d
draw_sprite_part_ext(inst_display_spr[i],0,0,1,inst_display_w[i],inst_display_h[i],inst_x[i],inst_y[i]+inst_display_h[i],1,-1,c_white,1)
else
draw_sprite(inst_display_spr[i],0,inst_x[i],inst_y[i])
//d3d_draw_floor(inst_x[i],inst_y[i],0,inst_x[i]+inst_display_w[i],inst_y[i]+inst_display_h[i],0,sprite_get_texture(inst_display_spr[i],0),1,1)
}
}
}
draw_set_color(c_white)
draw_set_alpha(0)
if showgrid
{
draw_set_blend_mode_ext(bm_inv_dest_color,bm_inv_src_color)
for(xx=0;xx<width+snap_x;xx+=snap_x)
draw_line(xx,0,xx,height)
for(yy=0;yy<height+snap_y;yy+=snap_y)
draw_line(0,yy,width,yy)
}
draw_set_alpha(1)
draw_set_blend_mode(bm_normal)
img=data_get_path(global.project.resources,"Objects\index="+string(room_editor.selected_obj)+"\<meta>\display_picture",-1)
if global.click_r=other.id
|| (global.click=other.id&&sprite_get_xoffset(img)=0&&sprite_get_yoffset(img)=0)
for(i=0;i<inst_count;i+=1)
{
if inst_display_spr[i]=-1
img=data_get_path(global.project.resources,"Objects\index="+string(inst_object_index[i])+"\<meta>\display_picture",-1)
else
img=inst_display_spr[i]
if !sprite_exists(img)
{
inst_display_w[i]=16
inst_display_h[i]=16
inst_display_spr[i]=-1
}
else
{
inst_display_w[i]=sprite_get_width(img)
inst_display_h[i]=sprite_get_height(img)
inst_display_spr[i]=img
}
if !sprite_exists(img)
{
xoff=0
yoff=0
}
else
{
xoff=sprite_get_xoffset(img)
yoff=sprite_get_yoffset(img)
}
if mouse_box(inst_x[i]-xoff,inst_y[i]-yoff,inst_x[i]-xoff+inst_display_w[i],inst_y[i]-yoff+inst_display_h[i])
inst_y[i]=-10000
}
img=data_get_path(global.project.resources,"Objects\index="+string(room_editor.selected_obj)+"\<meta>\display_picture",-1)
if global.over=other.id if sprite_exists(img)
{
if sprite_get_xoffset(img)=0&&sprite_get_yoffset(img)=0
{
mx=floor(global.mousex/snap_x)*snap_x
my=floor(global.mousey/snap_y)*snap_y
//draw_set_blend_mode_ext(bm_one,bm_inv_src_alpha)
draw_sprite_ext(img,0,mx,my,1,1,0,merge_color(c_black,c_white,.5),.5)
draw_set_color(c_white)
draw_set_alpha(0)
draw_set_blend_mode_ext(bm_inv_dest_color,bm_inv_src_color)
draw_rectangle(mx-1,my-1,mx+snap_x,my+snap_y,1)
draw_set_alpha(1)
draw_set_blend_mode(bm_normal)//_ext(bm_one,bm_inv_src_alpha)
}
else
{
mx=round(global.mousex/snap_x)*snap_x
my=round(global.mousey/snap_y)*snap_y
draw_set_blend_mode(bm_normal)//_ext(bm_one,bm_inv_src_alpha)
draw_sprite_ext(img,0,mx,my,1,1,0,merge_color(c_black,c_white,.5),.5)
draw_set_color(c_white)
draw_set_alpha(0)
draw_set_blend_mode_ext(bm_inv_dest_color,bm_inv_src_color)
draw_line(mx-4,my,mx+4,my)
draw_line(mx,my-4,mx,my+4)
draw_set_alpha(1)
draw_set_blend_mode(bm_normal)//_ext(bm_one,bm_inv_src_alpha)
}
}
else
{
mx=floor(global.mousex/snap_x)*snap_x
my=floor(global.mousey/snap_y)*snap_y
draw_set_blend_mode(bm_normal)//_ext(bm_one,bm_inv_src_alpha)
draw_sprite_ext(spr_icons,31,mx,my,1,1,0,merge_color(c_black,c_white,.5),.5)
}
if global.click=other.id
{
inst_x[inst_count]=mx
inst_y[inst_count]=my
if inst_count
inst_id[inst_count]=inst_id[inst_count-1]+1
else
inst_id[inst_count]=100000
inst_object_index[inst_count]=room_editor.selected_obj
inst_code[inst_count]=""
inst_locked[inst_count]=0
inst_display_spr[inst_count]=img
inst_z[inst_count]=0
inst_3d_model[inst_count]=-1 //global.monkey
if inst_object_index[inst_count]=0
inst_3d_model[inst_count]=global.monkey
inst_3d_tex[inst_count]=-1
_obj=data_find_path(objects,"index="+string(inst_object_index[i]))
if _obj<0
obj=noone
else
{
obj=objects.value[_obj]
with(obj) if first_instance=noone
first_instance=other.inst_count
}
inst_count+=1
}
}
[/spoiler]