buddhabrot: code refactoring, add "set as wallpaper" feature, fix rection on keys, add to IMG

eolite: small fix 


git-svn-id: svn://kolibrios.org@9525 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2021-12-30 01:57:38 +00:00
parent 3813663899
commit df6ac3618c
5 changed files with 76 additions and 92 deletions

View File

@ -443,6 +443,7 @@ tup.append_table(img_files, {
{"3D/RAY", PROGS .. "/demos/ray/ray"}, {"3D/RAY", PROGS .. "/demos/ray/ray"},
{"3D/VIEW3DS", PROGS .. "/demos/view3ds/view3ds"}, {"3D/VIEW3DS", PROGS .. "/demos/view3ds/view3ds"},
{"DEMOS/BCDCLK", PROGS .. "/demos/bcdclk/trunk/bcdclk"}, {"DEMOS/BCDCLK", PROGS .. "/demos/bcdclk/trunk/bcdclk"},
{"DEMOS/BUGHBROT", PROGS .. "/demos/buddhabrot/trunk/buddhabrot"},
{"DEMOS/EYES", PROGS .. "/demos/eyes/trunk/eyes"}, {"DEMOS/EYES", PROGS .. "/demos/eyes/trunk/eyes"},
{"DEMOS/FIREWORK", PROGS .. "/demos/firework/trunk/firework"}, {"DEMOS/FIREWORK", PROGS .. "/demos/firework/trunk/firework"},
{"DEMOS/MOVBACK", PROGS .. "/demos/movback/trunk/movback"}, {"DEMOS/MOVBACK", PROGS .. "/demos/movback/trunk/movback"},
@ -585,7 +586,6 @@ tup.append_table(extra_files, {
{"kolibrios/3D/voxel_utilites/VOX_CREATOR" , PROGS .. "/media/voxel_editor/utilites/vox_creator"}, {"kolibrios/3D/voxel_utilites/VOX_CREATOR" , PROGS .. "/media/voxel_editor/utilites/vox_creator"},
{"kolibrios/3D/voxel_utilites/VOX_MOVER" , PROGS .. "/media/voxel_editor/utilites/vox_mover"}, {"kolibrios/3D/voxel_utilites/VOX_MOVER" , PROGS .. "/media/voxel_editor/utilites/vox_mover"},
{"kolibrios/3D/voxel_utilites/VOX_TGL" , PROGS .. "/media/voxel_editor/utilites/vox_tgl"}, {"kolibrios/3D/voxel_utilites/VOX_TGL" , PROGS .. "/media/voxel_editor/utilites/vox_tgl"},
{"kolibrios/demos/buddhabrot", PROGS .. "/demos/buddhabrot/trunk/buddhabrot"},
{"kolibrios/demos/life3", PROGS .. "/games/life3/trunk/life3"}, {"kolibrios/demos/life3", PROGS .. "/games/life3/trunk/life3"},
{"kolibrios/demos/qjulia", PROGS .. "/demos/qjulia/trunk/qjulia"}, {"kolibrios/demos/qjulia", PROGS .. "/demos/qjulia/trunk/qjulia"},
{"kolibrios/develop/utils/koldbg", PROGS .. "/develop/koldbg/koldbg"}, {"kolibrios/develop/utils/koldbg", PROGS .. "/develop/koldbg/koldbg"},

View File

@ -25,6 +25,7 @@
16 Web |demos/web 16 Web |demos/web
16 FireWork |demos/firework 16 FireWork |demos/firework
16 UnvWater |demos/unvwater 16 UnvWater |demos/unvwater
16 Buddhabrot |demos/budhbrot
#2 **** 3D #2 **** 3D
15 Crown Screensaver |3d/crownscr 15 Crown Screensaver |3d/crownscr
15 Labyrinth |3d/free3d04 15 Labyrinth |3d/free3d04

View File

@ -25,6 +25,7 @@
16 <20> ã⨭ª  |demos/web 16 <20> ã⨭ª  |demos/web
16 ”¥©¥à¢¥àª |demos/firework 16 ”¥©¥à¢¥àª |demos/firework
16 UnvWater |demos/unvwater 16 UnvWater |demos/unvwater
16 Buddhabrot |demos/budhbrot
#2 **** 3D #2 **** 3D
15 ‘ªà¨­á¥©¢¥à |3d/crownscr 15 ‘ªà¨­á¥©¢¥à |3d/crownscr
15 3D-‹ ¡¨à¨­â |3d/free3d04 15 3D-‹ ¡¨à¨­â |3d/free3d04

View File

@ -59,7 +59,8 @@ void GetDiskIconAndName(dword dev_name, icon, disc_name)
if (ESBYTE[icon]==4) if (ESBYTE[icon]==4)
{ {
//show label only for hard disk drives //show label only for hard disk drives
if (volume_label = GetVolumeLabel(dev_name)) { volume_label = GetVolumeLabel(dev_name);
if (ESBYTE[volume_label]) {
strncpy(disc_name, volume_label, 15); strncpy(disc_name, volume_label, 15);
chrcat(disc_name, ' '); chrcat(disc_name, ' ');
return; return;

View File

@ -2,9 +2,9 @@
; Now it use static memory, it is mixed 32bit code and SSE instructions. ; Now it use static memory, it is mixed 32bit code and SSE instructions.
include '../../../macros.inc' include '../../../macros.inc'
include '../../../KOSfuncs.inc'
use32 use32
org 0x0 org 0x0
db 'MENUET01' ; 8 byte id db 'MENUET01' ; 8 byte id
@ -15,76 +15,62 @@ use32
dd I_END ;0xbffff ; esp dd I_END ;0xbffff ; esp
dd 0x0 , 0x0 ; I_Param , I_Icon dd 0x0 , 0x0 ; I_Param , I_Icon
START: ; start of execution ; start of execution
START:
call draw_window call draw_window
call draw_from_buffer
call Main call Main
call draw_from_buffer call draw_from_buffer
mcall SF_SET_CAPTION,1,wintitle2
still: still:
mcall SF_WAIT_EVENT
; call Main cmp eax,EV_REDRAW
je .redraw
cmp eax,EV_KEY
je .key
cmp eax,EV_BUTTON
je .button
jmp still
.redraw:
; mov eax,7
; mov ebx,screen
; mov ecx,IMG_SIZE*65536+IMG_SIZE
; mov edx,0*65536+0
; int 0x40
; mov eax,23 ; wait here for event
; mov ebx,timeout
; int 0x40
; mov eax,11 ; check for event no wait
mov eax,10 ; wait for event
int 0x40
cmp eax,1 ; redraw request ?
je red
cmp eax,2 ; key in buffer ?
je key
cmp eax,3 ; button in buffer ?
je button
jmp noclose
red: ; redraw
call draw_window call draw_window
call draw_from_buffer call draw_from_buffer
jmp still jmp still
key: ; key .key:
mov eax,2 ; just read it and ignore mcall SF_GET_KEY
int 0x40 shr eax,16 ; get scancode in 'al'
shr eax,8 cmp al,1
cmp eax, 27 je .exit
jne still cmp al,66
mov eax, -1 je set_as_wallpaper
int 0x40
button: ; button
mov eax,17 ; get id
int 0x40
cmp ah,1 ; button id=1 ?
jne noclose
mov eax,-1 ; close this program
int 0x40
noclose:
jmp still jmp still
.button:
mcall SF_GET_BUTTON
cmp ah,1 ; button id=1 ?
jne still
.exit:
mcall SF_TERMINATE_PROCESS
set_as_wallpaper:
mcall SF_BACKGROUND_SET,SSF_MODE_BG,2
mcall SF_BACKGROUND_SET,SSF_SIZE_BG,IMG_SIZE,IMG_SIZE
mcall SF_BACKGROUND_SET,SSF_IMAGE_BG,screen,0,3*IMG_SIZE*IMG_SIZE
mcall SF_BACKGROUND_SET,SSF_REDRAW_BG
jmp still
draw_from_buffer: draw_from_buffer:
pusha
mov eax,7 mcall SF_PUT_IMAGE,screen,IMG_SIZE*65536+IMG_SIZE,0
mov ebx,screen popa
mov ecx,IMG_SIZE*65536+IMG_SIZE
mov edx,0*65536+0
int 0x40
ret ret
;------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------
@ -323,23 +309,20 @@ r15dd equ ebp-72
; ********************************************* ; *********************************************
draw_window: draw_window:
mcall 12, 1 ; function 12:tell os about windowdraw mcall SF_REDRAW, SSF_BEGIN_DRAW
mcall 48, 4 ;get skin width mcall SF_STYLE_SETTINGS, SSF_GET_SKIN_HEIGHT
lea ecx, [50*65536+IMG_SIZE+4+eax] ; [y start] *65536 + [y size] + [skin_height] lea ecx, [50*65536+IMG_SIZE+4+eax] ; [y start] *65536 + [y size] + [skin_height]
mcall 0,<50,IMG_SIZE+9>,,0x74000000,,labelt ;draw window mcall SF_CREATE_WINDOW,<50,IMG_SIZE+9>,,0x74000000,,wintitle1
mcall 12, 2 ; function 12:tell os about windowdraw
mcall SF_REDRAW, SSF_END_DRAW
ret ret
;------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------
align 1 align 1
labelt: wintitle1 db 'Buddhabrot - Calculating, please wait...',0
db 'buddhabrot',0 wintitle2 db 'Buddhabrot - Press F8 to set image as wallpaper',0
labelen:
align 4 align 4
g_xorwow_x dd 123456789 g_xorwow_x dd 123456789
@ -350,9 +333,10 @@ g_xorwow_v dd 5783321
g_xorwow_d dd 6615241 g_xorwow_d dd 6615241
g_rand_scale dd 2.3283064e-10 ; 1.0 / 2^32 g_rand_scale dd 2.3283064e-10 ; 1.0 / 2^32
IMG_SIZE=600 IMG_SIZE = 600
SEQ_SIZE=50 SEQ_SIZE = 50
ITERATIONS=100 ITERATIONS = 100
g_img_size dd 600.0 g_img_size dd 600.0
g_offsetx dd 0.5 g_offsetx dd 0.5
g_offsety dd 0.0 g_offsety dd 0.0
@ -367,10 +351,7 @@ g_255_0 dd 255.0
IMG_END: IMG_END:
;-------------------- ;--------------------
sequence: sequence: rb SEQ_SIZE*8
rb SEQ_SIZE*8 screen: rb IMG_SIZE*IMG_SIZE*4
screen: memStack: rd 1024
rb IMG_SIZE*IMG_SIZE*4
memStack:
rd 1024
I_END: I_END: