; ; e3dhsp.dll test script #include "e3dhsp3.as" #module #deffunc waitbyfps int p1, var fps E3DWaitbyFPS@ p1, fps await 0 return #global dim keybuf, 256 screenw = 640 : screenh = 480 screen 0, screenw, screenh, 1 title "Easy3D for HSP3 sample" ;開発中は下の行のコメントアウトを外すことを推奨します。 ;E3DEnableDbgFile ;初期化 E3DInit 0, -1, 0, 16, 0, scid1 ;カメラ変数の初期化 cameradist = 6000.0 cameraheight = 2000.0 camdegxz = 180.0 camposx = 0.0 camposy = cameraheight camposz = 0.0 ;file のpath 用のバッファーの作成 pathlen = 2048 sdim mediadir, pathlen mediadir = dir_cur + "\\Media" sdim pathbuf, pathlen, 2 ;projectionの変更をしたいときは、以下の2行を有効にしてください。 ;proj_near = 100 : proj_far = 20000 : proj_fov = 45 E3DSetProjection proj_near, proj_far, proj_fov ;以下、ライトの設定 lightdirx1 = 0.0 lightdiry1 = 0.0 lightdirz1 = 1.0 lightr1 = 128 lightg1 = 128 lightb1 = 128 ;平行光源 E3DCreateLight lid1 E3DSetDirectionalLight lid1, lightdirx1, lightdiry1, lightdirz1, lightr1, lightg1, lightb1 pathbuf.0 = mediadir + "\\lake.bmp" pathbuf.1 = "dummy" E3DCreateBG scid1, pathbuf.0, pathbuf.1, 0.0, 0.0, 0 chkfps1 = 0 startu = 0.25 endu = 0.75 startv = 0.25 endv = 0.75 *main ; keybuf変数は、メインループの外で、dim keybuf, 256 として、確保しておいてください。 E3DGetKeyboardState keybuf if keybuf.VK_ESCAPE = 1 : goto *bye ; [ESC]で終了 gosub *MoveCamera gosub *ScrollBG E3DBeginScene scid1 gosub *DrawText E3DEndScene E3DPresent scid1 waitbyfps 60, chkfps1 goto *main *bye E3DBye end *ScrollBG newstartu = startu newendu = endu newstartv = startv newendv = endv if( keybuf.VK_LEFT == 1 ){ newstartu -= 0.01 newendu -= 0.01 } if( keybuf.VK_RIGHT == 1 ){ newstartu += 0.01 newendu += 0.01 } if( (newstartu >= 0.0) & (newendu <= 1.0) ){ startu = newstartu endu = newendu E3DSetBGU scid1, startu, endu } if( keybuf.VK_UP == 1 ){ newstartv -= 0.01 newendv -= 0.01 } if( keybuf.VK_DOWN == 1 ){ newstartv += 0.01 newendv += 0.01 } if( (newstartv >= 0.0) && (newendv <= 1.0) ){ startv = newstartv endv = newendv E3DSetBGV scid1, startv, endv } return *MoveCamera E3DSin camdegxz, camposx E3DCos camdegxz, camposz camposx *= cameradist camspoz *= cameradist E3DSetCameraPos camposx, camposy, camposz E3DSetCameraTarget 0.0, camposy, 0.0, 0.0, 1.0, 0.0 return *DrawText textposx = 10 : textposy = 10 textr = 255 : textg = 255 : textb = 255 textscale = 1 str5 = "chkfps1 " + chkfps1 E3DDrawText textposx, textposy, textscale, textr, textg, textb, str5 textposy += 20 str5 = "startu " + startu + " endu " + endu E3DDrawText textposx, textposy, textscale, textr, textg, textb, str5 textposy += 20 str5 = "startv " + startv + " endv " + endv E3DDrawText textposx, textposy, textscale, textr, textg, textb, str5 return