Subversion Repositories Kolibri OS

Rev

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

  1. ; Copyright (c) 2009, <Lrz>
  2. ; All rights reserved.
  3. ;
  4. ; Redistribution and use in source and binary forms, with or without
  5. ; modification, are permitted provided that the following conditions are met:
  6. ;       * Redistributions of source code must retain the above copyright
  7. ;       notice, this list of conditions and the following disclaimer.
  8. ;       * Redistributions in binary form must reproduce the above copyright
  9. ;       notice, this list of conditions and the following disclaimer in the
  10. ;       documentation and/or other materials provided with the distribution.
  11. ;       * Neither the name of the <organization> nor the
  12. ;       names of its contributors may be used to endorse or promote products
  13. ;       derived from this software without specific prior written permission.
  14. ;
  15. ; THIS SOFTWARE IS PROVIDED BY Alexey Teplov nickname <Lrz> ''AS IS'' AND ANY
  16. ; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  17. ; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  18. ; DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
  19. ; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  20. ; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  21. ; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  22. ; ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  23. ; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  24. ; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  25. ;*****************************************************************************
  26.  
  27. ;§ £®«®¢®ª ¯à¨«®¦¥­¨ï
  28. use32                ; âà ­á«ïâ®à, ¨á¯®«ì§ãî騩 32 à §à來ëå ª®¬ ­¤ë
  29.     org 0x0                ; ¡ §®¢ë©  ¤à¥á ª®¤ , ¢á¥£¤  0x0
  30.     db 'MENUET01'        ; ¨¤¥­â¨ä¨ª â®à ¨á¯®«­ï¥¬®£® ä ©«  (8 ¡ ©â)
  31.     dd 0x1                ; ¢¥àá¨ï ä®à¬ â  § £®«®¢ª  ¨á¯®«­ï¥¬®£® ä ©« 
  32.     dd start                ;  ¤à¥á, ­  ª®â®àë© á¨á⥬  ¯¥à¥¤ ñâ ã¯à ¢«¥­¨¥
  33.                         ; ¯®á«¥ § £à㧪¨ ¯à¨«®¦¥­¨ï ¢ ¯ ¬ïâì
  34.     dd mem                ; à §¬¥à ¯à¨«®¦¥­¨ï
  35.     dd mem                  ; Ž¡ê¥¬ ¨á¯®«ì§ã¥¬®© ¯ ¬ïâ¨, ¤«ï á⥪  ®â¢¥¤¥¬ 0å100 ¡ ©â ¨ ¢ë஢­¨¬ ­  £à­¨æã 4 ¡ ©â 
  36.     dd mem                  ; à á¯®«®¦¨¬ ¯®§¨æ¨î á⥪  ¢ ®¡« á⨠¯ ¬ïâ¨, áࠧ㠧  ⥫®¬ ¯à®£à ¬¬ë. ‚¥à設  á⥪  ¢ ¤¨ ¯ §®­¥ ¯ ¬ïâ¨, 㪠§ ­­®¬ ¢ëè¥
  37.     dd 0x0              ; 㪠§ â¥«ì ­  áâபã á ¯ à ¬¥âà ¬¨.
  38.     dd way_of_ini
  39. include '../../../../macros.inc'
  40. include '../../box_lib/trunk/box_lib.mac'
  41. include '../../box_lib/load_lib.mac'
  42.         @use_library    ;use load lib macros
  43. start:
  44. ;universal load library/librarys
  45. sys_load_libraries l_libs_start,end_l_libs
  46. ;if return code =-1 then exit, else nornary work
  47.         cmp     eax,-1
  48.         jz      exit
  49.         mcall   40,0x27         ;ãáâ ­®¢¨âì ¬ áªã ¤«ï ®¦¨¤ ¥¬ëå ᮡë⨩
  50.  
  51.         mov  eax,48
  52.         mov  ebx,3
  53.         mov  ecx,sc
  54.         mov  edx,sizeof.system_colors
  55.         mcall
  56.         mov  eax,dword [sc.work]
  57.         mov  dword [con_colors+4],eax
  58.  
  59. ;       mcall   66,1,0
  60.        call [initialization_font]       ; ¨­¨æ¨ «¨§ æ¨ï ᯨ᪠ èà¨ä⮢
  61.        push dword (8 shl 16 +16)        ; ¯®¨áª ­ã¦­®£® èà¨äâ  ¢ ­ ¡®à¥ èà¨ä⮢ (¯®ª  ¤®áâ㯥­ ⮫쪮 8å16)
  62.        call [get_font]
  63.         test    eax,eax                 ;­ è«¨ ?
  64.         jnz     exit
  65. ;;;;;;;;;;;;;;;;;;;;
  66.         mcall   40,0x27         ;ãáâ ­®¢¨âì ¬ áªã ¤«ï ®¦¨¤ ¥¬ëå ᮡë⨩
  67. red_win:
  68.     call draw_window            ;¯¥à¢®­ ç «ì­® ­¥®¡å®¤¨¬® ­ à¨á®¢ âì ®ª­®
  69. align 4
  70. still:                          ;®á­®¢­®© ®¡à ¡®â稪
  71.         mcall   10              ;Ž¦¨¤ âì ᮡëâ¨ï
  72.         dec  eax
  73.         jz   red_win
  74.         dec  eax
  75.         jz   key
  76.         dec  eax
  77.         jz   button
  78.  
  79.         push    dword edit1
  80.         call    [edit_box_mouse]
  81.  
  82.         jmp still    ;¥á«¨ ­¨ç¥£® ¨§ ¯¥à¥ç¨á«¥­­®£® â® á­®¢  ¢ 横«
  83. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  84. button:
  85.         mcall   17      ;¯®«ãç¨âì ¨¤¥­â¨ä¨ª â®à ­ ¦ â®© ª« ¢¨è¨
  86.         test ah,ah      ;¥á«¨ ¢ ah 0, â® ¯¥à¥©â¨ ­  ®¡à ¡®â稪 ᮡë⨩ still
  87.         jz  still
  88. exit:  
  89.         call    [free_fulder_info]
  90.         call    [free_font]
  91.         mcall   -1
  92. key:
  93.         mcall   2       ;§ £à㧨¬ §­ ç¥­¨¥ 2 ¢ ॣ¨áâ®à eax ¨ ¯®«ã稬 ª®¤ ­ ¦ â®© ª« ¢¨è¨
  94.  
  95.         push    dword edit1
  96.         call    [edit_box_key]
  97.  
  98.  
  99.         mcall   13,<20,650>,<40,16>, dword[con_colors+4]
  100.  
  101.  
  102.         push    dword 20 shl 16 + 40    ; esp+12= dd x shl 16 + y x- ª®®à¤¨­ â  ¯® •, y - ª®®à¤¨­ â  ¯® Y
  103.         push    dword con_colors        ; esp+8 = dd point to color of background and font
  104.         push    dword text              ; esp+4 = dd point to ASCIIZ
  105. ; esp+0 = dd back
  106.         call    [font_draw_on_string]   ; ¢ë¢¥á⨠¯® £«¨ä ¬ áâà®çªã
  107.  
  108.  
  109.         jmp still
  110.  
  111. ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
  112. align 4
  113. draw_window:            ;à¨á®¢ ­¨¥ ®ª­  ¯à¨«®¦¥­¨ï
  114.         mcall   12,1
  115.         xor  eax,eax             ;®¡­ã«¨âì eax
  116.         mov  ebx,50*65536+680    ;[ª®®à¤¨­ â  ¯® ®á¨ x]*65536 + [à §¬¥à ¯® ®á¨ x]
  117.         mov  ecx,30*65536+200    ;[ª®®à¤¨­ â  ¯® ®á¨ y]*65536 + [à §¬¥à ¯® ®á¨ y]
  118.         mov  edx,[sc.work]       ; color of work area RRGGBB,8->color gl
  119.         or   edx,0x34000000
  120.         mov  edi,hed
  121.         mcall                    ;­ à¨á®¢ âì ®ª­® ¯à¨«®¦¥­¨ï
  122.        
  123.         push    dword edit1
  124.         call    [edit_box_draw]
  125. ;
  126.         push    dword 20 shl 16 + 40    ; esp+12= dd x shl 16 + y x- ª®®à¤¨­ â  ¯® •, y - ª®®à¤¨­ â  ¯® Y
  127.         push    dword con_colors        ; esp+8 = dd point to color of background and font
  128.         push    dword text; esp+4 = dd point to ASCIIZ
  129. ; esp+0 = dd back
  130.         call    [font_draw_on_string]   ; ¢ë¢¥á⨠¯® £«¨ä ¬ áâà®çªã
  131.         mov eax,12               ;”ã­ªæ¨ï 12 - ­ ç âì/§ ª®­ç¨âì ¯¥à¥à¨á®¢ªã ®ª­ .
  132.         mov ebx,2                ;®¤äã­ªæ¨ï 2 - § ª®­ç¨âì ¯¥à¥à¨á®¢ªã ®ª­ .
  133.         mcall
  134.         ret
  135. ;;;;;;;;;;;;
  136. ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
  137. ;DATA ¤ ­­ë¥
  138. l_libs_start:
  139. library01 l_libs library_name, way_of_ini, library_path, system_path, err_message_found_lib, head_f_l, font_import, err_message_import, head_f_i
  140.  
  141. library02 l_libs library_name1, way_of_ini, library_path, system_path1, err_message_found_lib1, head_f_l, import_box_lib, err_message_import1, head_f_i
  142.  
  143. end_l_libs:
  144.  
  145. ;
  146. system_path      db '/sys/lib/'
  147. library_name     db 'fonts_lib.obj',0
  148.  
  149. system_path1      db '/sys/lib/'
  150. library_name1     db 'box_lib.obj',0
  151.  
  152. err_message_found_lib   db 'Sorry I cannot load library fonts_lib.obj',0
  153. err_message_found_lib1  db 'Sorry I cannot load library box_lib.obj',0
  154.  
  155. head_f_i:
  156. head_f_l        db 'System error',0
  157. err_message_import      db 'Error on load import library fonts_lib.obj',0
  158. err_message_import1     db 'Error on load import library box_lib.obj',0
  159.  
  160. align 4
  161. import_box_lib:  
  162.  
  163. edit_box_draw   dd      aEdit_box_draw
  164. edit_box_key    dd      aEdit_box_key
  165. edit_box_mouse  dd      aEdit_box_mouse
  166. version_ed      dd      aVersion_ed
  167.  
  168.                 dd      0
  169.                 dd      0
  170.  
  171. aEdit_box_draw  db 'edit_box',0
  172. aEdit_box_key   db 'edit_box_key',0
  173. aEdit_box_mouse db 'edit_box_mouse',0
  174. aVersion_ed     db 'version_ed',0
  175.  
  176. font_import:
  177. initialization_font     dd      a_initialization_font
  178. get_font                dd      a_get_font
  179. free_fulder_info        dd      a_free_fulder_info
  180. free_font               dd      a_free_font
  181. font_draw_on_string     dd      a_font_draw_on_string
  182. show_all_glif           dd      a_show_all_glif
  183. Version_fn            dd      a_Version_fn
  184.                       dd      0,0
  185.  
  186. a_initialization_font   db 'initialization_font',0
  187. a_get_font              db 'get_font',0
  188. a_free_fulder_info      db 'free_fulder_info',0
  189. a_free_font             db 'free_font',0
  190. a_font_draw_on_string   db 'font_draw_on_string',0
  191. a_show_all_glif         db 'show_all_glif',0
  192. a_Version_fn          db 'version_fn',0
  193.  
  194.  
  195.  
  196. edit1 edit_box 350,175,5,0xffffff,0x6f9480,0,0xAABBCC,0,test_leght,text,ed_focus,text_end-text-1,text_end-text-1
  197.  
  198. text db   'à¨¬¥à ¨á¯®«ì§®¢ ­¨ï ¡¨¡«¨®â¥ª¨ èà¨ä⮢ fonts_lib.obj',0
  199. text_end:
  200. rb  256
  201. test_leght = ($-text)-1
  202.  
  203. hed db   "Font's demo <Lrz>",0
  204. align 4
  205. con_colors      dd      0x1E1EFF, 0x96FFCF
  206.  
  207. align 4
  208. sc     system_colors
  209. way_of_ini      rb 4096
  210. library_path    rb 4096
  211.  
  212. align 4
  213. i_end:
  214. rb 1024
  215. mem:
  216.                 ;ª®­¥æ ª®¤