; HSPDX es_excopy sample ; 2023/11/28, use HSP 3.7 beta 7, Windows10 x64 22H2 #include "hspdx.as" #packopt name "01_hspdx_es_excopy" ; file name #packopt type 0 ; generate ".exe" ; 初期ウインドウサイズを大きくしておかないと ; ウインドウモード時のウインドウサイズが反映されない ; しかもデバッグモード時は反映されない #packopt xsize 1600 #packopt ysize 900 #define TEXFILE "tex.bmp" #pack TEXFILE #define KB_ESC $00080 ; 以下の行をコメントアウトするとウインドウモードになる ; #define FULLSCR ; check existence hspdx.dll exist "hspdx.dll" if strsize < 0 { dialog "Not found hspdx.dll" end } #ifdef FULLSCR ; get desktop size wdw_w = ginfo_dispx wdw_h = ginfo_dispy scmode = 0 ; set fullscreen use_d3d = 1 #else wdw_w = 512 wdw_h = 288 ; wdw_w = 1600 ; wdw_h = 900 scmode = 1 ; set window mode use_d3d = 1 #endif es_ini ; initialize hspdx onexit *job_end es_screen wdw_w, wdw_h, 32, 0, scmode, use_d3d if stat == 1 { dialog "Error : DirectX initialization failed." end } if stat == 2 { dialog "Error : Screen initialization failed." end } *start ; load texture image file buffer 5, 256, 256 picload TEXFILE bufid = 0 es_buffer bufid, 0 ; copy buffer to VRAM if stat { es_bye wait 100 dialog "Error : Not enough VRAM." end } ; gsel 0, 1 ; Window ID=0 active gsel 0 es_cls ; screen clear es_sync wait 100 tt = 0 k = 0 x = wdw_w / 2 dx = (wdw_w / 60) now_fps = 0 *mainloop ; get fps es_getfps now_fps ; title strf("%d/50 FPS", now_fps) stick k, 0 ; chekc keyboard if k & KB_ESC : goto *job_end ; ESC key to exit x += dx if x <= 0 or (x + 16) >= wdw_w : dx *= -1 ; draw start gsel 0 es_cls $40, $80, $c0 ; screen clear ; draw image gmode gmode_rgb0, 16, 16 pos x, 10 es_copy 0, 0, 0, 16, 16 repeat 8 ; draw image px = 0 py = 40 + (16 + 2) * cnt sx = 0 ; source x, y sy = 0 sw = 16 ; source width, height sh = 16 dw = 14 + cnt ; dest width, height dh = 16 gmode gmode_rgb0, sw, sh objsize dw, dh pos px, py ; es_zoom bufid, sx, sy, sw, sh, dw, dh es_excopy bufid, sx, sy, sw, sh, dw, dh ; box fill px = px + dw + 2 gmode 0, sw, sh pos px, py es_boxf px, py, px + dw - 1, py + dh - 1 loop es_sync (1000/60), 1 ; draw and wait tt = stat await 1 goto *mainloop *job_end es_bye end