update 'voxel_editor' add cursors

git-svn-id: svn://kolibrios.org@2933 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
IgorA 2012-08-23 19:57:13 +00:00
parent 26eb4cbcc9
commit 76bf409d84
4 changed files with 75 additions and 7 deletions

View File

@ -1,4 +1,6 @@
if not exist bin mkdir bin
if not exist bin\cursors.png @copy cursors.png bin\cursors.png
if not exist bin\cursors_gr.png @copy cursors_gr.png bin\cursors_gr.png
if not exist bin\toolbar.png @copy toolbar.png bin\toolbar.png
@copy *.vox bin\*.vox
if not exist bin\buf2d.obj @fasm.exe -m 16384 ..\..\..\develop\libraries\buf2d\trunk\buf2d.asm bin\buf2d.obj

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 531 B

View File

@ -17,7 +17,7 @@ include 'dll.inc'
include 'vox_draw.inc'
@use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
caption db 'Voxel editor 19.07.12',0 ;ŻŽ¤Ż¨áě ŽŞ­ 
caption db 'Voxel editor 23.08.12',0 ;¯®¤¯¨áì ®ª­ 
struct FileInfoBlock
Function dd ?
@ -36,6 +36,8 @@ fn_toolbar db 'toolbar.png',0
IMAGE_TOOLBAR_ICON_SIZE equ 16*16*3
IMAGE_TOOLBAR_SIZE equ IMAGE_TOOLBAR_ICON_SIZE*21
image_data_toolbar dd 0
cursors_count equ 4
IMAGE_CURSORS_SIZE equ 4096*cursors_count ;à §¬¥à ª à⨭ª¨ á ªãàá®à ¬¨
;§­ çĽ­¨ď § ¤ ˘ ĽŹëĽ ŻŽ ㏎Ťç ­¨î, ĄĽ§ ini ä ŠŤ 
ini_def_window_t equ 10
@ -105,6 +107,8 @@ OT_MAP_X equ 0
OT_MAP_Y equ 0
OT_CAPT_X_COLOR equ 5 ;Žâáâ㯠¤Ťď ŻŽ¤Ż¨á¨ 梼â 
OT_CAPT_Y_COLOR equ 30
PEN_MODE_NONE equ -1
PEN_MODE_CLEAR equ 0 ;०¨¬ áâ¨à ­¨ï
PEN_MODE_SELECT_COLOR equ 2 ;༌¨Ź ˘ëĄŽŕ  梼â 
align 4
@ -165,6 +169,19 @@ start:
add eax,[tile_size]
mov [buf_pl.h],eax
;*** § £à㧪  ªãàá®à®¢
load_image_file 'cursors_gr.png',image_data_toolbar,IMAGE_CURSORS_SIZE
stdcall [buf2d_create_f_img], buf_curs_8,[image_data_toolbar] ;ᮧ¤ ¥¬ ¡ãä¥à
stdcall mem.Free,[image_data_toolbar] ;®á¢®¡®¦¤ ¥¬ ¯ ¬ïâì
load_image_file 'cursors.png',image_data_toolbar, IMAGE_CURSORS_SIZE
stdcall [buf2d_create_f_img], buf_curs,[image_data_toolbar] ;ᮧ¤ ¥¬ ¡ãä¥à
stdcall mem.Free,[image_data_toolbar] ;®á¢®¡®¦¤ ¥¬ ¯ ¬ïâì
stdcall [buf2d_conv_24_to_8], buf_curs_8,1 ;¤¥« ¥¬ ¡ãä¥à ¯à®§à ç­®á⨠8¡¨â
stdcall [buf2d_conv_24_to_32],buf_curs,buf_curs_8 ;¤¥« ¥¬ ¡ãä¥à rgba 32¡¨â
stdcall [buf2d_create], buf_0 ;Ꭷ¤ ­¨Ľ ĄăäĽŕ  ¨§ŽĄŕ ŚĽ­¨ď
stdcall [buf2d_create], buf_0z ;Ꭷ¤ ­¨Ľ ĄăäĽŕ  ŁŤăĄ¨­ë
stdcall [buf2d_create], buf_pl ;Ꭷ¤ ­¨Ľ ĄăäĽŕ  ¤Ťď áĽçĽ­¨ď
@ -178,6 +195,9 @@ start:
call but_new_file
;¯¥à¢®­ ç «ì­ ï ãáâ ­®¢ª  ªãàá®à 
stdcall set_pen_mode,1,0,((9 shl 8)+9) shl 16 ;pen
align 4
red_win:
call draw_window
@ -294,7 +314,7 @@ mouse:
div ecx
mov [v_cur_x],eax ;X-coord
cmp dword[v_pen_mode],0
cmp dword[v_pen_mode],PEN_MODE_CLEAR
jl .end_1
cmp dword[v_pen_mode],1
jg .end_1
@ -697,7 +717,7 @@ button:
@@:
cmp ah,15
jne @f
mov dword[v_pen_mode],PEN_MODE_SELECT_COLOR
stdcall set_pen_mode,PEN_MODE_SELECT_COLOR,3,((9 shl 8)+9) shl 16
call draw_palete
@@:
cmp ah,16
@ -743,6 +763,8 @@ button:
stdcall [buf2d_delete],buf_r_z
@@:
stdcall [buf2d_vox_brush_delete], buf_vox
stdcall [buf2d_delete],buf_curs
stdcall [buf2d_delete],buf_curs_8
stdcall mem.Free,[image_data_toolbar]
stdcall mem.Free,[open_file_vox]
mcall -1
@ -1000,7 +1022,7 @@ align 4
but_mode_pen:
push eax
mov eax,dword[v_pen_mode]
mov dword[v_pen_mode],1 ;pen
stdcall set_pen_mode,1,0,((9 shl 8)+9) shl 16 ;pen
cmp eax,PEN_MODE_SELECT_COLOR
jne @f
call draw_objects
@ -1012,7 +1034,7 @@ align 4
but_mode_brush:
push eax
mov eax,dword[v_pen_mode]
mov dword[v_pen_mode],3 ;brush
stdcall set_pen_mode,3,1,((9 shl 8)+9) shl 16 ;brush
cmp eax,PEN_MODE_SELECT_COLOR
jne @f
call draw_objects
@ -1024,7 +1046,7 @@ align 4
but_mode_clear:
push eax
mov eax,dword[v_pen_mode]
mov dword[v_pen_mode],0 ;clear
stdcall set_pen_mode,PEN_MODE_CLEAR,2,((15 shl 8)+9) shl 16
cmp eax,PEN_MODE_SELECT_COLOR
jne @f
call draw_objects
@ -1308,7 +1330,7 @@ v_cur_x dd 0 ;
v_cur_y dd 0 ;ŞŽŽŕ¤¨­ â  ŞăŕáŽŕ  y (­Ž Žáě ˘ ŽĄęĽŞâĽ z)
n_plane dd 0 ;ŻŤŽáŞŽáâě áĽçĽ­¨ď
v_color dd 0xff ;梼⠪ ŕ ­¤ č 
v_pen_mode dd 1 ;༌¨Ź: 0-áâ¨ŕ ­¨ď, 1-ŕ¨áŽ˘ ­¨ď
v_pen_mode dd PEN_MODE_NONE ;०¨¬ à ¡®âë ªãàá®à  (á¬. ª®­áâ ­âë PEN_MODE_...)
mode_light dd 1 ;༌¨Ź Žá˘ĽéĽ­¨ď
cam_x dd 0
cam_y dd 0
@ -1464,6 +1486,28 @@ pushad
popad
ret
;hot_p - ª®®à¤¨­ âë £®àï祩 â®çª¨ ªãàá®à , ᬥ饭­ë¥ ­  ¡¨â 16 ((cx shl 8) + cy) shl 16
align 4
proc set_pen_mode uses eax ebx ecx edx, mode:dword, icon:dword, hot_p:dword
mov eax,[mode]
cmp [v_pen_mode],eax
je @f
mov [v_pen_mode],eax
mov edx,[hot_p]
mov dx,2 ;LOAD_INDIRECT
mov ecx,[icon]
shl ecx,12 ;㬭®¦ ¥¬ ­  4 ª¡
add ecx,[buf_curs.data]
mcall 37,4
cmp eax,0
je @f
mov [cursor_pointer],eax
mcall 37,5,[cursor_pointer]
@@:
ret
endp
if 0
;input:
; buf - 㪠§ âĽŤě ­  áâபă, ç¨áŤŽ ¤ŽŤŚ­Ž Ąëâě ˘ 10 ¨Ť¨ 16 ŕ¨ç­ŽŹ ˘¨¤Ľ
@ -1860,6 +1904,28 @@ align 4
buf_r_z:
rb BUF_STRUCT_SIZE
align 4
cursor_pointer dd 0 ;㪠§ â¥«ì ­  ¤ ­­ë¥ ¤«ï ªãàá®à 
buf_curs: ;¡ãä¥à á ªãàá®à ¬¨
.data: dd 0 ;㪠§ â¥«ì ­  ¡ãä¥à ¨§®¡à ¦¥­¨ï
dw 0 ;+4 left
dw 0 ;+6 top
dd 32 ;+8 w
dd 32*cursors_count ;+12 h
dd 0 ;+16 color
db 24 ;+20 bit in pixel
align 4
buf_curs_8: ;¡ãä¥à á ¯à®§à ç­®áâìî ¤«ï ªãàá®à®¢
.data: dd 0 ;㪠§ â¥«ì ­  ¡ãä¥à ¨§®¡à ¦¥­¨ï
dw 0 ;+4 left
dw 0 ;+6 top
dd 32 ;+8 w
dd 32*cursors_count ;+12 h
dd 0 ;+16 color
db 24 ;+20 bit in pixel
;¤ ­­ëĽ ¤Ťď Ꭷ¤ ­¨ď Ź¨­¨Ź Ťě­ŽŁŽ Ľ¤¨­¨ç­ŽŁŽ ˘ŽŞáĽŤď
align 4
vox_6_7_z: