expand GFC lib
This commit is contained in:
parent
b64f9a32f9
commit
09d988bfb8
4 changed files with 110 additions and 17 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -13,3 +13,4 @@ roms/qemu-vgabios.bin
|
||||||
roms/vgabios.bin
|
roms/vgabios.bin
|
||||||
run.bat
|
run.bat
|
||||||
ProjectX.code-workspace
|
ProjectX.code-workspace
|
||||||
|
gfx
|
||||||
|
|
|
||||||
|
|
@ -135,6 +135,7 @@ build_interface:
|
||||||
mov word [gs:si + widget.w], 80
|
mov word [gs:si + widget.w], 80
|
||||||
mov word [gs:si + widget.h], 20
|
mov word [gs:si + widget.h], 20
|
||||||
mov word [gs:si + widget.text_ofs], str_quit
|
mov word [gs:si + widget.text_ofs], str_quit
|
||||||
|
mov byte [gs:si + widget.user_id], 1 ; Style "Bouton par défaut" (OK)
|
||||||
mov word [gs:si + widget.text_seg], cs ; Texte est dans la ROM
|
mov word [gs:si + widget.text_seg], cs ; Texte est dans la ROM
|
||||||
mov word [gs:si + widget.event_click], on_click_quit ; Fonction à appeler
|
mov word [gs:si + widget.event_click], on_click_quit ; Fonction à appeler
|
||||||
mov byte [gs:si + widget.type], WIDGET_TYPE_BUTTON
|
mov byte [gs:si + widget.type], WIDGET_TYPE_BUTTON
|
||||||
|
|
@ -214,5 +215,5 @@ reset_vector:
|
||||||
jmp 0xF000:reset
|
jmp 0xF000:reset
|
||||||
|
|
||||||
builddate:
|
builddate:
|
||||||
db '06/01/2026'
|
db __DATE__
|
||||||
times 16-($-$$) db 0 ; le stub tient dans 16 octets (ou moins)
|
times 16-($-$$) db 0 ; le stub tient dans 16 octets (ou moins)
|
||||||
|
|
|
||||||
|
|
@ -75,9 +75,10 @@
|
||||||
%define LINE_HORIZ 8
|
%define LINE_HORIZ 8
|
||||||
%define RECTANGLE_DRAW 9
|
%define RECTANGLE_DRAW 9
|
||||||
%define RECTANGLE_FILL 10
|
%define RECTANGLE_FILL 10
|
||||||
%define MOUSE_HIDE 11
|
%define RECTANGLE_ROUND 11
|
||||||
%define MOUSE_SHOW 12
|
%define MOUSE_HIDE 12
|
||||||
%define MOUSE_MOVE 13
|
%define MOUSE_SHOW 13
|
||||||
|
%define MOUSE_MOVE 14
|
||||||
|
|
||||||
; ------------------------------------------------------------
|
; ------------------------------------------------------------
|
||||||
; COMMENTAIRE SUR LA MÉTHODE D'APPEL
|
; COMMENTAIRE SUR LA MÉTHODE D'APPEL
|
||||||
|
|
@ -102,6 +103,7 @@ graph_driver:
|
||||||
dw cga_line_horizontal ; dessin d'une ligne horizontale
|
dw cga_line_horizontal ; dessin d'une ligne horizontale
|
||||||
dw cga_draw_rect ; dessin d'un rectangle
|
dw cga_draw_rect ; dessin d'un rectangle
|
||||||
dw cga_fill_rect ; dessin d'un rectangle plein
|
dw cga_fill_rect ; dessin d'un rectangle plein
|
||||||
|
dw cga_draw_rounded_frame ; dessin d'un rectangle arrondi
|
||||||
dw cga_mouse_hide ; déplacement du curseur
|
dw cga_mouse_hide ; déplacement du curseur
|
||||||
dw cga_mouse_show ; déplacement du curseur
|
dw cga_mouse_show ; déplacement du curseur
|
||||||
dw cga_mouse_cursor_move ; déplacement du curseur
|
dw cga_mouse_cursor_move ; déplacement du curseur
|
||||||
|
|
@ -1006,7 +1008,69 @@ cga_fill_rect:
|
||||||
%undef .y2
|
%undef .y2
|
||||||
%undef .pat_idx
|
%undef .pat_idx
|
||||||
|
|
||||||
|
|
||||||
|
; ------------------------------------------------------------
|
||||||
|
; cga_draw_rounded_frame
|
||||||
|
; dessiner un cadre arrondi
|
||||||
|
; Entrée : AX=x1, BX=y1, CX=x2, DX=y2
|
||||||
|
; ------------------------------------------------------------
|
||||||
|
%define .x1 word [bp+4]
|
||||||
|
%define .y1 word [bp+6]
|
||||||
|
%define .x2 word [bp+8]
|
||||||
|
%define .y2 word [bp+10]
|
||||||
|
%define .color word [bp+12]
|
||||||
|
cga_draw_rounded_frame:
|
||||||
|
push bp
|
||||||
|
mov bp, sp
|
||||||
|
pusha
|
||||||
|
|
||||||
|
; call cga_mouse_hide
|
||||||
|
|
||||||
|
; Lignes horizontales (raccourcies de 2px de chaque côté)
|
||||||
|
mov ax, .x1
|
||||||
|
add ax, 2
|
||||||
|
mov bx, .x2
|
||||||
|
sub bx, 2
|
||||||
|
GFX LINE_HORIZ, ax, bx, .y1, .color
|
||||||
|
GFX LINE_HORIZ, ax, bx, .y2, .color
|
||||||
|
|
||||||
|
; Lignes verticales (raccourcies de 2px)
|
||||||
|
mov cx, .y1
|
||||||
|
add cx, 2
|
||||||
|
mov dx, .y2
|
||||||
|
sub dx, 2
|
||||||
|
GFX LINE_VERT, .x1, cx, dx, .color
|
||||||
|
GFX LINE_VERT, .x2, cx, dx, .color
|
||||||
|
|
||||||
|
; Pixels de coins pour l'arrondi
|
||||||
|
mov ax, .x1
|
||||||
|
inc ax
|
||||||
|
mov bx, .y1
|
||||||
|
inc bx
|
||||||
|
GFX PUTPIXEL, ax, bx, .color ; top left
|
||||||
|
mov ax, .x2
|
||||||
|
dec ax
|
||||||
|
GFX PUTPIXEL, ax, bx, .color ; Top-right
|
||||||
|
mov bx, .y2
|
||||||
|
dec bx
|
||||||
|
GFX PUTPIXEL, ax, bx, .color ; bottom-right
|
||||||
|
mov ax, .x1
|
||||||
|
inc ax
|
||||||
|
GFX PUTPIXEL, ax, bx, .color ; bottom-left
|
||||||
|
|
||||||
|
; call cga_mouse_show
|
||||||
|
|
||||||
|
popa
|
||||||
|
leave
|
||||||
|
ret
|
||||||
|
%undef .x1
|
||||||
|
%undef .y1
|
||||||
|
%undef .x2
|
||||||
|
%undef .y2
|
||||||
|
%undef .color
|
||||||
|
|
||||||
; -----------------------------------------------------------------------------
|
; -----------------------------------------------------------------------------
|
||||||
|
|
||||||
; ------------------------------------------------------------
|
; ------------------------------------------------------------
|
||||||
; GESTION DU CURSEUR
|
; GESTION DU CURSEUR
|
||||||
; ------------------------------------------------------------
|
; ------------------------------------------------------------
|
||||||
|
|
@ -1092,6 +1156,7 @@ cga_mouse_cursor_move:
|
||||||
|
|
||||||
cmp byte [BDA_MOUSE + mouse.cur_drawing],0
|
cmp byte [BDA_MOUSE + mouse.cur_drawing],0
|
||||||
jne .done
|
jne .done
|
||||||
|
|
||||||
mov byte [BDA_MOUSE + mouse.cur_drawing],1
|
mov byte [BDA_MOUSE + mouse.cur_drawing],1
|
||||||
|
|
||||||
mov ax, VIDEO_SEG
|
mov ax, VIDEO_SEG
|
||||||
|
|
@ -1339,4 +1404,5 @@ cga_cursor_draw:
|
||||||
pop es
|
pop es
|
||||||
pop ds
|
pop ds
|
||||||
popad
|
popad
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -430,6 +430,7 @@ gui_draw_single_widget:
|
||||||
; Chargement coords
|
; Chargement coords
|
||||||
mov ax, [gs:si + widget.x]
|
mov ax, [gs:si + widget.x]
|
||||||
mov bx, [gs:si + widget.y]
|
mov bx, [gs:si + widget.y]
|
||||||
|
|
||||||
mov cx, [gs:si + widget.w]
|
mov cx, [gs:si + widget.w]
|
||||||
mov dx, [gs:si + widget.h]
|
mov dx, [gs:si + widget.h]
|
||||||
|
|
||||||
|
|
@ -482,7 +483,7 @@ draw_slider:
|
||||||
xchg ax, cx ; AX = X1, CX = X2
|
xchg ax, cx ; AX = X1, CX = X2
|
||||||
jmp .draw_thumb
|
jmp .draw_thumb
|
||||||
|
|
||||||
.calc_v:
|
.calc_v:
|
||||||
; --- Vertical ---
|
; --- Vertical ---
|
||||||
mov ax, [gs:si + widget.h]
|
mov ax, [gs:si + widget.h]
|
||||||
xor bh, bh
|
xor bh, bh
|
||||||
|
|
@ -498,7 +499,7 @@ draw_slider:
|
||||||
mov cx, ax
|
mov cx, ax
|
||||||
add cx, [gs:si + widget.w] ; CX = X2
|
add cx, [gs:si + widget.w] ; CX = X2
|
||||||
|
|
||||||
.draw_thumb:
|
.draw_thumb:
|
||||||
; 3. Dessiner le curseur (Thumb)
|
; 3. Dessiner le curseur (Thumb)
|
||||||
GFX RECTANGLE_FILL, ax, bx, cx, dx, pattern_white
|
GFX RECTANGLE_FILL, ax, bx, cx, dx, pattern_white
|
||||||
GFX RECTANGLE_DRAW, ax, bx, cx, dx, 0
|
GFX RECTANGLE_DRAW, ax, bx, cx, dx, 0
|
||||||
|
|
@ -507,6 +508,8 @@ draw_slider:
|
||||||
call draw_text
|
call draw_text
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
draw_button:
|
draw_button:
|
||||||
; Dispatch selon état
|
; Dispatch selon état
|
||||||
cmp byte [gs:si + widget.state], GUI_STATE_PRESSED
|
cmp byte [gs:si + widget.state], GUI_STATE_PRESSED
|
||||||
|
|
@ -516,20 +519,42 @@ draw_button:
|
||||||
|
|
||||||
.paint_normal:
|
.paint_normal:
|
||||||
GFX RECTANGLE_FILL, ax, bx, cx, dx, pattern_white
|
GFX RECTANGLE_FILL, ax, bx, cx, dx, pattern_white
|
||||||
GFX RECTANGLE_DRAW, ax, bx, cx, dx, 0 ; Bord Noir
|
|
||||||
|
; Si user_id == 1, on dessine le style "OK" (Double bordure épaisse)
|
||||||
|
test byte [gs:si + widget.user_id], 1
|
||||||
|
jnz .draw_default_style
|
||||||
|
|
||||||
|
GFX RECTANGLE_ROUND, ax, bx, cx, dx, 0
|
||||||
|
jmp .draw_text_now
|
||||||
|
|
||||||
|
.draw_default_style:
|
||||||
|
; Bordure extérieure épaisse (2px)
|
||||||
|
GFX RECTANGLE_ROUND, ax, bx, cx, dx, 0
|
||||||
|
inc ax
|
||||||
|
inc bx
|
||||||
|
dec cx
|
||||||
|
dec dx
|
||||||
|
GFX RECTANGLE_ROUND, ax, bx, cx, dx, 0
|
||||||
|
|
||||||
|
; Bordure intérieure fine (après un gap de 1px blanc)
|
||||||
|
add ax, 2
|
||||||
|
add bx, 2
|
||||||
|
sub cx, 2
|
||||||
|
sub dx, 2
|
||||||
|
GFX RECTANGLE_ROUND, ax, bx, cx, dx, 0
|
||||||
|
|
||||||
|
.draw_text_now:
|
||||||
|
; Recharger les coordonnées de base pour le texte
|
||||||
|
mov ax, [gs:si + widget.x]
|
||||||
|
mov bx, [gs:si + widget.y]
|
||||||
|
|
||||||
GFX TXT_MODE, GFX_TXT_BLACK_TRANSPARENT
|
GFX TXT_MODE, GFX_TXT_BLACK_TRANSPARENT
|
||||||
call draw_text
|
call draw_text
|
||||||
jmp .done
|
jmp .done
|
||||||
|
|
||||||
.paint_hover:
|
.paint_hover:
|
||||||
GFX RECTANGLE_FILL, ax, bx, cx, dx, pattern_gray_mid ; pattern_white
|
GFX RECTANGLE_FILL, ax, bx, cx, dx, pattern_gray_mid
|
||||||
GFX RECTANGLE_DRAW, ax, bx, cx, dx, 0 ; Bord Noir
|
GFX RECTANGLE_ROUND, ax, bx, cx, dx, 0
|
||||||
; Effet gras
|
|
||||||
inc ax
|
|
||||||
inc bx
|
|
||||||
dec cx
|
|
||||||
dec dx
|
|
||||||
GFX RECTANGLE_DRAW, ax, bx, cx, dx, 0
|
|
||||||
|
|
||||||
; Restauration coords pour le texte
|
; Restauration coords pour le texte
|
||||||
mov ax, [gs:si + widget.x]
|
mov ax, [gs:si + widget.x]
|
||||||
|
|
@ -545,7 +570,7 @@ draw_button:
|
||||||
mov bx, [gs:si + widget.y]
|
mov bx, [gs:si + widget.y]
|
||||||
call draw_text
|
call draw_text
|
||||||
|
|
||||||
.done
|
.done:
|
||||||
ret
|
ret
|
||||||
|
|
||||||
draw_text:
|
draw_text:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue