Subversion Repositories Kolibri OS

Rev

Rev 2230 | Rev 8236 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. use32
  2.         org 0x0
  3.         db 'MENUET01' ;¨¤¥­â¨ä. ¨á¯®«­ï¥¬®£® ä ©«  ¢á¥£¤  8 ¡ ©â
  4.         dd 0x1
  5.         dd start
  6.         dd i_end ;à §¬¥à ¯à¨«®¦¥­¨ï
  7.         dd mem,stacktop
  8.         dd 0,cur_dir_path
  9.  
  10. include '../../../../../macros.inc'
  11. include '../../../../../proc32.inc'
  12. include '../../../../../develop/libraries/box_lib/load_lib.mac'
  13. include '../../../../../dll.inc'
  14.  
  15. @use_library_mem mem.Alloc,mem.Free,mem.ReAlloc, 0 ;dll.Load
  16.  
  17. buf2d_l equ word[edi+4] ;®âáâ㯠᫥¢ 
  18. buf2d_t equ word[edi+6] ;®âáâ㯠ᢥàåã
  19. buf2d_color equ dword[edi+16] ;梥â ä®­  ¡ãä¥à 
  20.  
  21. align 4
  22. start:
  23.         load_library vectors_name, cur_dir_path, library_path, system_path, \
  24.                 err_message_found_lib, head_f_l, import_buf2d_lib, err_message_import, head_f_i
  25.         cmp eax,-1
  26.         jz button.exit
  27.  
  28.         mcall 40,0x27
  29.         stdcall [buf2d_create], buf_0 ;ᮧ¤ ¥¬ ¡ãä¥à
  30.         ;à¨á㥬 ¯¥à¢®­ ç «ì­ë© ª ¤à
  31.         stdcall [buf2d_filled_rect_by_size], buf_0, 100-50,70-25, 100,50, 0xffffff ;à¨á㥬 ¯àאַ㣮«ì­¨ª
  32.         stdcall [buf2d_line], buf_0, 10,10, 100,75, 0xff0000 ;à¨á㥬 ¯à®áâãî «¨­¨î
  33.         stdcall [buf2d_line_sm], buf_0, 100,75, 190,140, 0xff0000 ;à¨á㥬 ᣫ ¦¥­­ãî «¨­¨î
  34.  
  35. align 4
  36. red_win:
  37.         call draw_window
  38.  
  39. align 4
  40. still:
  41.         mcall 10
  42.         cmp al,1 ;¨§¬¥­¨«®áì ¯®«®¦¥­¨¥ ®ª­ 
  43.         jz red_win
  44.         cmp al,2
  45.         jz key
  46.         cmp al,3
  47.         jz button
  48.         cmp al,6
  49.         jz mouse
  50.         jmp still
  51.  
  52. align 4
  53. draw_window:
  54.         pushad
  55.         mcall 12,1
  56.  
  57.         ;mov edx,0x32000000
  58.         mov edx,0x33000000
  59.         mcall 0,(50 shl 16)+330,(30 shl 16)+275,,,caption
  60.  
  61.         stdcall [buf2d_draw], buf_0
  62.  
  63.         mcall 12,2
  64.         popad
  65.         ret
  66.  
  67. align 4
  68. key:
  69.         mcall 2
  70.  
  71.         cmp ah,27 ;Esc
  72.         je button.exit
  73.  
  74.         jmp still
  75.  
  76. align 4
  77. button:
  78.         mcall 17 ;¯®«ãç¨âì ª®¤ ­ ¦ â®© ª­®¯ª¨
  79.         cmp ah,1
  80.         jne still
  81. .exit:
  82.         stdcall [buf2d_delete],buf_0 ;㤠«ï¥¬ ¡ãä¥à
  83.         mcall -1 ;¢ë室 ¨§ ¯à®£à ¬¬ë
  84.  
  85. align 4
  86. mouse:
  87.         ;®¡à ¡ â뢠¥¬ ®ª­® । ªâ®à 
  88.         mcall 37,2 ;get mouse buttons
  89.         cmp al,1
  90.         jne @f
  91.                 mcall 37,1 ;get mouse coords
  92.                 mov ebx,eax
  93.                 shr ebx,16 ;¢ eax ª®®à¤¨­ â  ¬¨è¨ ¯® ®á¨ 'x'
  94.                 and eax,0xffff ;¢ eax ª®®à¤¨­ â  ¬¨è¨ ¯® ®á¨ 'y'
  95.                 mov edi,buf_0
  96.                 sub ax,buf2d_t ;ᤢ¨£ ¥¬ ª®®à¤¨­ âë ãç¨â뢠ï ᬥ饭¨¥ ¡ãä¥à 
  97.                 sub bx,buf2d_l
  98.  
  99.                 ;à¨á®¢ ­¨¥ ¯à¨ ­ ¦ â¨¨
  100.                 stdcall [buf2d_clear], edi, buf2d_color ;®ç¨é ¥¬ íªà ­ ®â ¯à¥¤ë¤ãé¨å à¨á®¢ ­¨©
  101.                 stdcall [buf2d_filled_rect_by_size], edi, 100-50,70-25, 100,50, 0xffffff ;à¨á㥬 ¯àאַ㣮«ì­¨ª
  102.  
  103.                 stdcall [buf2d_line], edi, 10,10, ebx,eax, 0xff0000 ;à¨á㥬 ¯à®áâãî «¨­¨î
  104.                 stdcall [buf2d_line_sm], edi, 190,140, ebx,eax, 0xff0000 ;à¨á㥬 ᣫ ¦¥­­ãî «¨­¨î
  105.                 stdcall [buf2d_draw], edi ;®¡­®¢«ï¥¬ íªà ­
  106.         @@:
  107.         jmp still
  108.  
  109. caption db 'Press left mouse button, [Esc] - exit',0
  110.  
  111. ;--------------------------------------------------
  112. align 4
  113. import_buf2d_lib:
  114.         dd sz_lib_init
  115.         buf2d_create dd sz_buf2d_create
  116.         buf2d_create_f_img dd sz_buf2d_create_f_img
  117.         buf2d_clear dd sz_buf2d_clear
  118.         buf2d_draw dd sz_buf2d_draw
  119.         buf2d_delete dd sz_buf2d_delete
  120.         buf2d_line dd sz_buf2d_line
  121.         buf2d_line_sm dd sz_buf2d_line_sm
  122.         buf2d_filled_rect_by_size dd sz_buf2d_filled_rect_by_size
  123.         buf2d_circle dd sz_buf2d_circle
  124.         buf2d_img_hdiv2 dd sz_buf2d_img_hdiv2
  125.         buf2d_img_wdiv2 dd sz_buf2d_img_wdiv2
  126.         buf2d_conv_24_to_8 dd sz_buf2d_conv_24_to_8
  127.         buf2d_conv_24_to_32 dd sz_buf2d_conv_24_to_32
  128.         buf2d_bit_blt dd sz_buf2d_bit_blt
  129.         buf2d_bit_blt_transp dd sz_buf2d_bit_blt_transp
  130.         buf2d_bit_blt_alpha dd sz_buf2d_bit_blt_alpha
  131.         buf2d_curve_bezier dd sz_buf2d_curve_bezier
  132.         buf2d_convert_text_matrix dd sz_buf2d_convert_text_matrix
  133.         buf2d_draw_text dd sz_buf2d_draw_text
  134.         dd 0,0
  135.         sz_lib_init db 'lib_init',0
  136.         sz_buf2d_create db 'buf2d_create',0
  137.         sz_buf2d_create_f_img db 'buf2d_create_f_img',0
  138.         sz_buf2d_clear db 'buf2d_clear',0
  139.         sz_buf2d_draw db 'buf2d_draw',0
  140.         sz_buf2d_delete db 'buf2d_delete',0
  141.         sz_buf2d_line db 'buf2d_line',0
  142.         sz_buf2d_line_sm db 'buf2d_line_sm',0
  143.         sz_buf2d_filled_rect_by_size db 'buf2d_filled_rect_by_size',0
  144.         sz_buf2d_circle db 'buf2d_circle',0 ;à¨á®¢ ­¨¥ ®ªà㦭®áâ¨
  145.         sz_buf2d_img_hdiv2 db 'buf2d_img_hdiv2',0
  146.         sz_buf2d_img_wdiv2 db 'buf2d_img_wdiv2',0
  147.         sz_buf2d_conv_24_to_8 db 'buf2d_conv_24_to_8',0
  148.         sz_buf2d_conv_24_to_32 db 'buf2d_conv_24_to_32',0
  149.         sz_buf2d_bit_blt db 'buf2d_bit_blt',0
  150.         sz_buf2d_bit_blt_transp db 'buf2d_bit_blt_transp',0
  151.         sz_buf2d_bit_blt_alpha db 'buf2d_bit_blt_alpha',0
  152.         sz_buf2d_curve_bezier db 'buf2d_curve_bezier',0
  153.         sz_buf2d_convert_text_matrix db 'buf2d_convert_text_matrix',0
  154.         sz_buf2d_draw_text db 'buf2d_draw_text',0
  155.  
  156. align 4
  157. buf_0:
  158.         dd 0 ;㪠§ â¥«ì ­  ¡ãä¥à ¨§®¡à ¦¥­¨ï
  159.         dw 20 ;+4 left
  160.         dw 10 ;+6 top
  161.         dd 200 ;+8 w
  162.         dd 150 ;+12 h
  163.         dd 0x80 ;+16 color
  164.         db 24 ;+20 bit in pixel
  165.  
  166. ;--------------------------------------------------
  167. system_path db '/sys/lib/'
  168. vectors_name db 'buf2d.obj',0
  169. err_message_found_lib db 'Sorry I cannot load library buf2d.obj',0
  170. head_f_i:
  171. head_f_l db 'System error',0
  172. err_message_import db 'Error on load import library buf2d.obj',0
  173. ;--------------------------------------------------
  174.  
  175. i_end: ;ª®­¥æ ª®¤ 
  176.         rb 1024
  177. stacktop:
  178. cur_dir_path:
  179.         rb 4096
  180. library_path:
  181.         rb 4096
  182. mem:
  183.  
  184.