KOX: window with skin, system colors for button and text

git-svn-id: svn://kolibrios.org@2734 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Albom 2012-06-04 08:11:24 +00:00
parent 185caf04b2
commit c876fb5ca5
4 changed files with 42 additions and 30 deletions

View File

@ -7,7 +7,7 @@ macro DATA_SECTION
; „€<EFBFBD><EFBFBD> <EFBFBD><EFBFBD>Žƒ<EFBFBD>€ŒŒ ; „€<EFBFBD><EFBFBD> <EFBFBD><EFBFBD>Žƒ<EFBFBD>€ŒŒ
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
lootxt: db 'oops! - Looser...' ; los lootxt: db 'oops! - Looser...' ; los
text: db 'KOX v0.003 [ESC] - quit' ; winheader string text:
texts: db 'Congratulations! You are winner.' ; in window win texts: db 'Congratulations! You are winner.' ; in window win
textend: db 'New' ;button id=200 textend: db 'New' ;button id=200
px: dw 50 ;x,y - px: dw 50 ;x,y -
@ -63,4 +63,8 @@ idx: dd 0 ;N cell
dw 001010000b,2 dw 001010000b,2
dw 001000100b,4 ;diag dw 001000100b,4 ;diag
caption db 'KOX v0.1', 0
colors rd 10
} }

View File

@ -1,6 +1,8 @@
;************************************************ ;************************************************
;* X-0-X / Kolibri OS / ;* X-0-X / Kolibri OS /
;************************** 17/10/2007 ********** ;************************** 17/10/2007 **********
;************************** 04/06/2012 **********
include 'main.inc' include 'main.inc'
include 'data.inc' include 'data.inc'
include 'macs.inc' include 'macs.inc'

View File

@ -1,3 +1,14 @@
Kox v0.1
----------------
’¥―¥ΰμ ®<>­® α® α<>¨­®¬   ¤«ο <20>­®―<C2AE>¨ ¨ β¥<CEB2>αβ  ¨α―®«μ§γξβαο α¨α⥬­λ¥ ζΆ¥β .
== 04/06/2012 ==
Kox v0.003 Kox v0.003
---------------- ----------------
Šà¥á⨪¨-­®«¨ª¨ ¢ ª®¬¬¥­â à¨ïå ­¥ ­ã¦¤ îâáï. Šà¥á⨪¨-­®«¨ª¨ ¢ ª®¬¬¥­â à¨ïå ­¥ ­ã¦¤ îâáï.

View File

@ -7,6 +7,16 @@ cW equ cWHITE
macro main_loop macro main_loop
{ {
; <EFBFBD>®«ãç¨âì áâ ­¤ àâ­ë¥ æ¢¥â  ®ª®­
;========================================
mov eax, 48
mov ebx, 3
mov ecx, colors
mov edx, 40
int 0x40
; äã­ªæ¨ï ®âà¨á®¢ª¨ ®ª­  ; äã­ªæ¨ï ®âà¨á®¢ª¨ ®ª­ 
;======================================== ;========================================
draw_window: draw_window:
@ -17,18 +27,12 @@ draw_window:
mov eax,0 ; äã­ªæ¨ï 0: ®¯à¥¤¥«¨âì ¨ ¢ë¢¥á⨠®ª­® mov eax,0 ; äã­ªæ¨ï 0: ®¯à¥¤¥«¨âì ¨ ¢ë¢¥á⨠®ª­®
mov ebx,100*65536+250 ; [x ­ ç «ì­ë©] *65536 + [x à §¬¥à] mov ebx,100*65536+250 ; [x ­ ç «ì­ë©] *65536 + [x à §¬¥à]
mov ecx,ebx ;,100*65536+250 ; [y ­ ç «ì­ë©] *65536 + [y à §¬¥à] mov ecx,ebx ;,100*65536+250 ; [y ­ ç «ì­ë©] *65536 + [y à §¬¥à]
mov edx,0x02FFFFFF mov edx, 0x34FFFFFF
mov esi, 0x808899AA ; 梥⠧ £®«®¢ª  RRGGBB mov esi, 0x808899AA ; 梥⠧ £®«®¢ª  RRGGBB
mov edi,0xFFAAcc ; 梥â à ¬ª¨ RRGGBB mov edi, caption ; § £®«®¢®ª
int 0x40
; <EFBFBD>€„<EFBFBD>ˆœ ¢ § £®«®¢ª¥ KOX v0.001
mov eax,4 ; äã­ªæ¨ï 4: ­ ¯¨á âì ⥪áâ ¢ ®ª­¥
mov ebx,8*65536+8 ; [x ­ ç «ì­ë©] *65536 + [y ­ ç «ì­ë©]
mov ecx,0x00224422 ; 梥â ⥪áâ  RRGGBB
mov edx,text ; 㪠§ â¥«ì ­  ­ ç «® ⥪áâ 
mov esi,texts-text ; ¤«¨­  ⥪áâ  ¢ ¡ ©â å
int 0x40 int 0x40
;-----------------------------------#----------------------------------------- ;-----------------------------------#-----------------------------------------
; SCENE OF GAME - PLAY YARD - BOARD - DESK - PLAYING FIELD ; SCENE OF GAME - PLAY YARD - BOARD - DESK - PLAYING FIELD
;--------------- ;---------------
@ -37,23 +41,16 @@ draw_window:
; ----Š<EFBFBD>Ž<EFBFBD>Šˆ---- ; ----Š<EFBFBD>Ž<EFBFBD>Šˆ----
;------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------
;buttons: ;buttons:
mov eax,8 ; äã­ªæ¨ï 8: ®¯à¥¤¥«¨âì ¨ ¢ë¢¥á⨠ª­®¯ªã
mov ebx,230*65536+12 ; [x ­ ç «ì­ë©] *65536 + [x à §¬¥à]
mov ecx,5*65536+12 ; [y ­ ç «ì­ë©] *65536 + [y à §¬¥à]
mov edx,100 ; ¨¤¥­â¨ä¨ª â®à ª­®¯ª¨ =100
mov esi,0xFF6611 ; 梥⠪­®¯ª¨ RRGGBB
int 0x40 ; ===Š<EFBFBD>Ž<EFBFBD>Š€ ‡€Š<EFBFBD>ˆŸ ŽŠ<EFBFBD>===
;--------------------------------------------
mov eax,8 ; mov eax,8 ;
mov ebx,200*65536+35 ; ; mov ebx,200*65536+35 ;
mov ecx,25*65536+20 ; mov ecx,15*65536+20 ;
mov edx,200 ;== NEW GAME == mov edx,200 ;== NEW GAME ==
mov esi,0xCC66CC mov esi, [colors+0x18]
int 0x40 int 0x40
;-------------------------------------------- ;--------------------------------------------
mov eax,4 ; ­ ¯¨á âì ⥪áâ ­  ª­®¯ª¥ NEW mov eax,4 ; ­ ¯¨á âì ⥪áâ ­  ª­®¯ª¥ NEW
mov ebx,210*65536+30 mov ebx,210*65536+20
mov ecx,cB mov ecx,[colors+0x1C]
mov edx,textend mov edx,textend
mov esi,3 mov esi,3
int 0x40 int 0x40
@ -88,8 +85,6 @@ redraw:
key: key:
mov eax,2 ; áç¨â뢠¥¬ ª®¤ ­ ¦ â®© ª« ¢¨è¨. ‚®§¢à é¥­ ¢ ah. mov eax,2 ; áç¨â뢠¥¬ ª®¤ ­ ¦ â®© ª« ¢¨è¨. ‚®§¢à é¥­ ¢ ah.
int 0x40 ; Š« ¢¨è  ¤®«¦­  ¡ëâì ¯à®ç¨â ­  ¤«ï ®ç¨á⪨ int 0x40 ; Š« ¢¨è  ¤®«¦­  ¡ëâì ¯à®ç¨â ­  ¤«ï ®ç¨á⪨
cmp ah,27
je clos0 ; exit on ESC
jmp event_wait ; ¢®§¢à â ª event_wait jmp event_wait ; ¢®§¢à â ª event_wait
button: button:
mov eax,17 ; áç¨â뢠¥¬ ¨¤¥­â¨ä¨ª â®à ­ ¦ â®© ª­®¯ª¨ mov eax,17 ; áç¨â뢠¥¬ ¨¤¥­â¨ä¨ª â®à ­ ¦ â®© ª­®¯ª¨
@ -97,7 +92,7 @@ button:
;------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------
; ᬮâਬ, ª ª ï ª­®¯ª  ¡ë«  ­ ¦ â  ¨ ᮮ⢥âáâ¢ãî騬 ®¡à §®¬ ॠ£¨à㥬. ; ᬮâਬ, ª ª ï ª­®¯ª  ¡ë«  ­ ¦ â  ¨ ᮮ⢥âáâ¢ãî騬 ®¡à §®¬ ॠ£¨à㥬.
;------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------
cmp ah,100 ; ª­®¯ª  á id=100("§ ªàëâì")? cmp ah, 1 ; ª­®¯ª  á id=1 ("§ ªàëâì")?
jne noclose ; jne noclose ;
clos0: ; clos0: ;
mov eax,-1 ; äã­ªæ¨ï -1: § ¢¥àè¨âì ¯à®£à ¬¬ã mov eax,-1 ; äã­ªæ¨ï -1: § ¢¥àè¨âì ¯à®£à ¬¬ã
@ -220,7 +215,7 @@ button:
mov eax,4 ; äã­ª 4: ­ ¯¨á âì ⥪áâ 'WINNER!' mov eax,4 ; äã­ª 4: ­ ¯¨á âì ⥪áâ 'WINNER!'
mov ebx,18*65536+215 ; [x ­ ç] *65536 + [y ­ ç] mov ebx,18*65536+215 ; [x ­ ç] *65536 + [y ­ ç]
mov ecx,0x10FF22FF ; 梥â ⥪áâ  RRGGBB mov ecx, [colors+0x20] ; 梥â ⥪áâ  RRGGBB
mov edx,texts ; 㪠§ â¥«ì ­  ­ ç «® ⥪áâ  mov edx,texts ; 㪠§ â¥«ì ­  ­ ç «® ⥪áâ 
mov esi,textend-texts ; ¤«¨­  ⥪áâ  ¢ ¡ ©â å mov esi,textend-texts ; ¤«¨­  ⥪áâ  ¢ ¡ ©â å
int 0x40 ; int 0x40 ;
@ -251,8 +246,8 @@ button:
@@: @@:
mov dword[idx],esi ;á®åà ­¨¬ ¢ idx mov dword[idx],esi ;á®åà ­¨¬ ¢ idx
;esi=0..8 - index ;esi=0..8 - index
call o_com ;¯à®¢¥àª  24åê ª®¬¡¨­ æ¨© XX0 call o_com ;¯à®¢¥àª  24å ª®¬¡¨­ æ¨© XX0
call x_com ;¯à®¢¥àª  24åê ª®¬¡¨­ æ¨© 00* call x_com ;¯à®¢¥àª  24å ª®¬¡¨­ æ¨© 00*
mov esi,dword[idx] ;idx-¨­¤¥ªá ª«¥âª¨(0..8) ªã¤  室 mov esi,dword[idx] ;idx-¨­¤¥ªá ª«¥âª¨(0..8) ªã¤  室
shl esi,2 ; esi*4 - ¯®«¥ á®á⮨⠨§ § ¯¨á¥© ¯® dword shl esi,2 ; esi*4 - ¯®«¥ á®á⮨⠨§ § ¯¨á¥© ¯® dword
@ -278,7 +273,7 @@ button:
mov eax,4 ; äã­ª 4: ­ ¯¨á âì ⥪áâ 'LOOSER!' mov eax,4 ; äã­ª 4: ­ ¯¨á âì ⥪áâ 'LOOSER!'
mov ebx,48*65536+215 ; [x ­ ç] *65536 + [y ­ ç] mov ebx,48*65536+215 ; [x ­ ç] *65536 + [y ­ ç]
mov ecx,0x10FF22FF ; 梥â ⥪áâ  RRGGBB mov ecx, [colors+0x20] ; 梥â ⥪áâ  RRGGBB
mov edx,lootxt ; 㪠§ â¥«ì ­  ­ ç «® ⥪áâ  mov edx,lootxt ; 㪠§ â¥«ì ­  ­ ç «® ⥪áâ 
mov esi,text-lootxt ; ¤«¨­  ⥪áâ  ¢ ¡ ©â å mov esi,text-lootxt ; ¤«¨­  ⥪áâ  ¢ ¡ ©â å
int 0x40 ; int 0x40 ;