kolibrios-fun/programs/develop/libraries/fontslib/trunk/font_ex.asm
IgorA 2aad33c4e5 deleted file 'editbox_ex.mac' all programs
git-svn-id: svn://kolibrios.org@1373 a494cfbc-eb01-0410-851d-a64ba20cac60
2010-01-09 22:01:26 +00:00

216 lines
7.2 KiB
NASM
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

; Copyright (c) 2009, <Lrz>
; All rights reserved.
;
; Redistribution and use in source and binary forms, with or without
; modification, are permitted provided that the following conditions are met:
; * Redistributions of source code must retain the above copyright
; notice, this list of conditions and the following disclaimer.
; * Redistributions in binary form must reproduce the above copyright
; notice, this list of conditions and the following disclaimer in the
; documentation and/or other materials provided with the distribution.
; * Neither the name of the <organization> nor the
; names of its contributors may be used to endorse or promote products
; derived from this software without specific prior written permission.
;
; THIS SOFTWARE IS PROVIDED BY Alexey Teplov nickname <Lrz> ''AS IS'' AND ANY
; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
; DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
; ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;*****************************************************************************
;§ £®«®¢®ª ¯à¨«®¦¥­¨ï
use32 ; âà ­á«ïâ®à, ¨á¯®«ì§ãî騩 32 à §à來ëå ª®¬ ­¤ë
org 0x0 ; ¡ §®¢ë©  ¤à¥á ª®¤ , ¢á¥£¤  0x0
db 'MENUET01' ; ¨¤¥­â¨ä¨ª â®à ¨á¯®«­ï¥¬®£® ä ©«  (8 ¡ ©â)
dd 0x1 ; ¢¥àá¨ï ä®à¬ â  § £®«®¢ª  ¨á¯®«­ï¥¬®£® ä ©« 
dd start ;  ¤à¥á, ­  ª®â®àë© á¨á⥬  ¯¥à¥¤ ñâ ã¯à ¢«¥­¨¥
; ¯®á«¥ § £à㧪¨ ¯à¨«®¦¥­¨ï ¢ ¯ ¬ïâì
dd mem ; à §¬¥à ¯à¨«®¦¥­¨ï
dd mem ; Ž¡ê¥¬ ¨á¯®«ì§ã¥¬®© ¯ ¬ïâ¨, ¤«ï á⥪  ®â¢¥¤¥¬ 0å100 ¡ ©â ¨ ¢ë஢­¨¬ ­  £à­¨æã 4 ¡ ©â 
dd mem ; à á¯®«®¦¨¬ ¯®§¨æ¨î á⥪  ¢ ®¡« á⨠¯ ¬ïâ¨, áࠧ㠧  ⥫®¬ ¯à®£à ¬¬ë. ‚¥à設  á⥪  ¢ ¤¨ ¯ §®­¥ ¯ ¬ïâ¨, 㪠§ ­­®¬ ¢ëè¥
dd 0x0 ; 㪠§ â¥«ì ­  áâபã á ¯ à ¬¥âà ¬¨.
dd way_of_ini
include '../../../../macros.inc'
include '../../box_lib/trunk/box_lib.mac'
include '../../box_lib/load_lib.mac'
@use_library ;use load lib macros
start:
;universal load library/librarys
sys_load_libraries l_libs_start,end_l_libs
;if return code =-1 then exit, else nornary work
cmp eax,-1
jz exit
mcall 40,0x27 ;ãáâ ­®¢¨âì ¬ áªã ¤«ï ®¦¨¤ ¥¬ëå ᮡë⨩
mov eax,48
mov ebx,3
mov ecx,sc
mov edx,sizeof.system_colors
mcall
mov eax,dword [sc.work]
mov dword [con_colors+4],eax
; mcall 66,1,0
call [initialization_font] ; ¨­¨æ¨ «¨§ æ¨ï ᯨ᪠ èà¨ä⮢
push dword (8 shl 16 +16) ; ¯®¨áª ­ã¦­®£® èà¨äâ  ¢ ­ ¡®à¥ èà¨ä⮢ (¯®ª  ¤®áâ㯥­ ⮫쪮 8å16)
call [get_font]
test eax,eax ;­ è«¨ ?
jnz exit
;;;;;;;;;;;;;;;;;;;;
mcall 40,0x27 ;ãáâ ­®¢¨âì ¬ áªã ¤«ï ®¦¨¤ ¥¬ëå ᮡë⨩
red_win:
call draw_window ;¯¥à¢®­ ç «ì­® ­¥®¡å®¤¨¬® ­ à¨á®¢ âì ®ª­®
align 4
still: ;®á­®¢­®© ®¡à ¡®â稪
mcall 10 ;Ž¦¨¤ âì ᮡëâ¨ï
dec eax
jz red_win
dec eax
jz key
dec eax
jz button
push dword edit1
call [edit_box_mouse]
jmp still ;¥á«¨ ­¨ç¥£® ¨§ ¯¥à¥ç¨á«¥­­®£® â® á­®¢  ¢ 横«
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
button:
mcall 17 ;¯®«ãç¨âì ¨¤¥­â¨ä¨ª â®à ­ ¦ â®© ª« ¢¨è¨
test ah,ah ;¥á«¨ ¢ ah 0, â® ¯¥à¥©â¨ ­  ®¡à ¡®â稪 ᮡë⨩ still
jz still
exit:
call [free_fulder_info]
call [free_font]
mcall -1
key:
mcall 2 ;§ £à㧨¬ §­ ç¥­¨¥ 2 ¢ ॣ¨áâ®à eax ¨ ¯®«ã稬 ª®¤ ­ ¦ â®© ª« ¢¨è¨
push dword edit1
call [edit_box_key]
mcall 13,<20,650>,<40,16>, dword[con_colors+4]
push dword 20 shl 16 + 40 ; esp+12= dd x shl 16 + y x- ª®®à¤¨­ â  ¯® •, y - ª®®à¤¨­ â  ¯® Y
push dword con_colors ; esp+8 = dd point to color of background and font
push dword text ; esp+4 = dd point to ASCIIZ
; esp+0 = dd back
call [font_draw_on_string] ; ¢ë¢¥á⨠¯® £«¨ä ¬ áâà®çªã
jmp still
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
align 4
draw_window: ;à¨á®¢ ­¨¥ ®ª­  ¯à¨«®¦¥­¨ï
mcall 12,1
xor eax,eax ;®¡­ã«¨âì eax
mov ebx,50*65536+680 ;[ª®®à¤¨­ â  ¯® ®á¨ x]*65536 + [à §¬¥à ¯® ®á¨ x]
mov ecx,30*65536+200 ;[ª®®à¤¨­ â  ¯® ®á¨ y]*65536 + [à §¬¥à ¯® ®á¨ y]
mov edx,[sc.work] ; color of work area RRGGBB,8->color gl
or edx,0x34000000
mov edi,hed
mcall ;­ à¨á®¢ âì ®ª­® ¯à¨«®¦¥­¨ï
push dword edit1
call [edit_box_draw]
;
push dword 20 shl 16 + 40 ; esp+12= dd x shl 16 + y x- ª®®à¤¨­ â  ¯® •, y - ª®®à¤¨­ â  ¯® Y
push dword con_colors ; esp+8 = dd point to color of background and font
push dword text; esp+4 = dd point to ASCIIZ
; esp+0 = dd back
call [font_draw_on_string] ; ¢ë¢¥á⨠¯® £«¨ä ¬ áâà®çªã
mov eax,12 ;”ã­ªæ¨ï 12 - ­ ç âì/§ ª®­ç¨âì ¯¥à¥à¨á®¢ªã ®ª­ .
mov ebx,2 ;<3B>®¤äã­ªæ¨ï 2 - § ª®­ç¨âì ¯¥à¥à¨á®¢ªã ®ª­ .
mcall
ret
;;;;;;;;;;;;
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
;DATA ¤ ­­ë¥
l_libs_start:
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
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
end_l_libs:
;
system_path db '/sys/lib/'
library_name db 'fonts_lib.obj',0
system_path1 db '/sys/lib/'
library_name1 db 'box_lib.obj',0
err_message_found_lib db 'Sorry I cannot load library fonts_lib.obj',0
err_message_found_lib1 db 'Sorry I cannot load library box_lib.obj',0
head_f_i:
head_f_l db 'System error',0
err_message_import db 'Error on load import library fonts_lib.obj',0
err_message_import1 db 'Error on load import library box_lib.obj',0
align 4
import_box_lib:
edit_box_draw dd aEdit_box_draw
edit_box_key dd aEdit_box_key
edit_box_mouse dd aEdit_box_mouse
version_ed dd aVersion_ed
dd 0
dd 0
aEdit_box_draw db 'edit_box',0
aEdit_box_key db 'edit_box_key',0
aEdit_box_mouse db 'edit_box_mouse',0
aVersion_ed db 'version_ed',0
font_import:
initialization_font dd a_initialization_font
get_font dd a_get_font
free_fulder_info dd a_free_fulder_info
free_font dd a_free_font
font_draw_on_string dd a_font_draw_on_string
show_all_glif dd a_show_all_glif
Version_fn dd a_Version_fn
dd 0,0
a_initialization_font db 'initialization_font',0
a_get_font db 'get_font',0
a_free_fulder_info db 'free_fulder_info',0
a_free_font db 'free_font',0
a_font_draw_on_string db 'font_draw_on_string',0
a_show_all_glif db 'show_all_glif',0
a_Version_fn db 'version_fn',0
edit1 edit_box 350,175,5,0xffffff,0x6f9480,0,0xAABBCC,0,test_leght,text,ed_focus,text_end-text-1,text_end-text-1
text db '<27>ਬ¥à ¨á¯®«ì§®¢ ­¨ï ¡¨¡«¨®â¥ª¨ èà¨ä⮢ fonts_lib.obj',0
text_end:
rb 256
test_leght = ($-text)-1
hed db "Font's demo <Lrz>",0
align 4
con_colors dd 0x1E1EFF, 0x96FFCF
align 4
sc system_colors
way_of_ini rb 4096
library_path rb 4096
align 4
i_end:
rb 1024
mem:
;ª®­¥æ ª®¤