View3DS: better key and scroll support

icons16.png: better icons 'run' and 'monitor/screensaver'
some fixes

git-svn-id: svn://kolibrios.org@9454 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2021-12-21 21:38:18 +00:00
parent bcdd96a753
commit 532075fe18
6 changed files with 166 additions and 179 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -17,7 +17,7 @@ PCI=on
[screensaver]
timeout=10 ;in minutes
program=/sys/demos/spiral
available=3d/crownscr;demos/web;demos/zeroline;demos/spiral
available=3d/crownscr|demos/web|demos/zeroline|demos/spiral
[style]
buttons_gradient=1

View File

@ -22,17 +22,17 @@
16 Spiral |demos/spiral
16 Moveback |demos/movback
16 TranTest |demos/trantest
16 WEB |demos/web
16 Web |demos/web
16 FireWork |demos/firework
16 UnvWater |demos/unvwater
#2 **** 3D
15 ScreenSaver |3d/crownscr
15 3D-labyrinth |3d/free3d04
15 3D-cube |3d/3dcube2
15 Crown Screensaver |3d/crownscr
15 Labyrinth |3d/free3d04
15 Cube |3d/3dcube2
15 Ray tracing |3d/ray
15 View3DS |3d/view3ds
15 Gears |3d/gears
15 3D-waved area |3d/3dwav
15 Waved area |3d/3dwav
#3 **** GRAPHICS
06 Kolibri Image Viewer |media/kiv
06 zSea Image Viewer * |/kolibrios/media/zsea/zsea

View File

@ -173,12 +173,12 @@ struct libimg_image
:void libimg_image::convert_into(dword _to)
{
img_convert stdcall(image, 0, _to, 0, 0);
$push eax
img_destroy stdcall(image);
$pop eax
if (!EAX) {
notify("'LibImg convertation error!'E");
} else {
$push eax
img_destroy stdcall(image);
$pop eax
image = EAX;
set_vars();
}
@ -230,52 +230,4 @@ struct libimg_image
}
}
/////////////////////////////
/*
// DRAW ICON PATTERN / TEMP
*/
/////////////////////////////
:void DrawIcon32(dword x,y, _bg, icon_n) {
static dword bg;
static dword pure_img32;
if (!pure_img32) || (bg!=_bg) {
bg = _bg;
if (pure_img32) img_destroy stdcall(pure_img32);
img_from_file stdcall("/sys/icons32.png");
pure_img32 = EAX;
//now fill transparent with another color
EDX = ESDWORD[EAX+4] * ESDWORD[EAX+8] * 4 + ESDWORD[EAX+24];
for (ESI = ESDWORD[EAX+24]; ESI < EDX; ESI += 4) {
if (DSDWORD[ESI]==0x00000000) DSDWORD[ESI] = bg;
}
}
img_draw stdcall(pure_img32, x, y, 32, 32, 0, icon_n*32);
}
:int DrawIcon16(dword x,y, _bg, icon_n) {
static dword bg;
static dword pure_img16;
dword bgshadow;
int size;
if (!pure_img16) || (bg!=_bg) {
bg = _bg;
bgshadow = MixColors(bg, 0, 220);
if (pure_img16) img_destroy stdcall(pure_img16);
img_from_file stdcall("/sys/icons16.png");
pure_img16 = EAX;
//now fill transparent with another color
EDX = ESDWORD[EAX+4] * ESDWORD[EAX+8] * 4 + ESDWORD[EAX+24];
for (ESI = ESDWORD[EAX+24]; ESI < EDX; ESI += 4) {
if (DSDWORD[ESI]==0xffFFFfff) DSDWORD[ESI] = bg;
if (DSDWORD[ESI]==0xffCACBD6) DSDWORD[ESI] = bgshadow;
}
}
size = ESDWORD[pure_img16+4]; //get image width
img_draw stdcall(pure_img16, x, y, size, size, 0, icon_n*size);
return size;
}
#endif

View File

@ -80,7 +80,7 @@
menu:
db 2 ; button number = index
db 'rotary ' ; label
db 3 ; max flag + 1 , if = 255, no flag
db 4 ; max flag + 1 , if = 255, no flag
r_flag db 1 ; flag
dd axl_f ; offset to flags description
@ -289,6 +289,7 @@ flags: ; flags description
db ' y '
db 'x+y '
db ' x '
db 'keys'
onoff_f:
db 'off '
db 'on '
@ -353,7 +354,7 @@ base_vector:
if Ext=SSE3
db ' (SSE3)'
end if
db ' 0.074',0
db ' 0.075',0
labellen:
STRdata db '-1 '
lab_vert:

View File

@ -1,5 +1,5 @@
; application : View3ds ver. 0.074 - tiny .3ds and .asc files viewer
; application : View3ds ver. 0.075 - tiny .3ds and .asc files viewer
; with a few graphics effects demonstration.
; compiler : FASM
; system : KolibriOS
@ -18,6 +18,7 @@
; 1) Read from a file (*.3DS standard)
; 2) Written in manually (at the end of the code) ; now not exist
format binary as ""
SIZE_X equ 512
SIZE_Y equ 512 ; ///// I want definitely
@ -163,11 +164,8 @@ still:
je key
cmp eax,3 ; button event ?
je button
cmp eax,6 ; mouse event ?
jne @f
cmp [edit_flag],1 ; handle mouse only when edit is active
jne @f
mov esi,eax
mov eax,37
mov ebx,7 ; get mouse scroll
int 0x40
@ -176,7 +174,12 @@ still:
je button.zoom_in
cmp eax, 1
je button.zoom_out
mov eax,esi
cmp eax,6 ; mouse event ?
jne @f
cmp [edit_flag],1 ; handle mouse only when edit is active
jne @f
mov eax,37
mov ebx,3 ;read mouse state
int 0x40
@ -214,24 +217,54 @@ still:
key: ; key
mov eax,2 ; just read it and ignore
int 0x40
shr eax,16 ; use scancodes (al)
cmp ah, '+'
cmp al, 013 ;+
je button.zoom_in
cmp ah, '='
je button.zoom_in
cmp ah, '-'
cmp al, 012 ;-
je button.zoom_out
cmp ah, 176 ;left
cmp al, 075 ;left
je add_vec_buttons.x_minus
cmp ah, 179 ;right
cmp al, 077 ;right
je add_vec_buttons.x_plus
cmp ah, 178 ;up
cmp al, 072 ;up
je add_vec_buttons.y_minus
cmp ah, 177 ;down
cmp al, 080 ;down
je add_vec_buttons.y_plus
cmp al, 073 ;page up
je .rot_inc_y
cmp al, 081 ;page down
je .rot_dec_y
cmp al, 051 ;<
je .rot_dec_x
cmp al, 052 ;>
je .rot_inc_x
cmp al, 057 ;space
je .rot_z
jmp noclose
.rot_inc_x:
inc [angle_x]
and [angle_x],0xff
jmp noclose.end_rot
.rot_dec_x:
dec [angle_x]
and [angle_x],0xff
jmp noclose.end_rot
.rot_inc_y:
inc [angle_y]
and [angle_y],0xff
jmp noclose.end_rot
.rot_dec_y:
dec [angle_y]
and [angle_y],0xff
jmp noclose.end_rot
.rot_z:
inc [angle_z]
and [angle_z],0xff
jmp noclose.end_rot
button: ; button
mov eax,17 ; get id
int 0x40
@ -303,6 +336,7 @@ still:
.next_m4:
cmp ah,14
jne @f
.xchg:
call exchange
@@:
cmp ah,15
@ -486,7 +520,7 @@ still:
jne .no_x
inc [angle_x]
and [angle_x],0xff
mov [angle_z],0
;mov [angle_z],0
jmp .end_rot
.no_x:
@ -494,7 +528,7 @@ still:
jne .no_y
inc [angle_y]
and [angle_y],0xff
mov [angle_z],0
;mov [angle_z],0
jmp .end_rot
.no_y:
@ -503,7 +537,7 @@ still:
mov cx,[angle_x]
inc cx
and cx,0xff
mov [angle_z],0
;mov [angle_z],0
mov [angle_y],cx
mov [angle_x],cx
.end_rot: