2006/01/03(火)あけおめ2
なんかまた中学生みたいなことをしてみました。
今年の賀状は、これでお願いしますorz
/* kingashinnen2006.hsp */ #include "ames.hsp" #define PI 3.1415926535897932 #define ctype deg2rad(%1) (double(%1)*PI/180) #define ctype swaphl(%1) (%1>>8&0xFF)|(%1<<8&0xFF00) buffer 1:font MSGothic,16:mes "謹賀\\n新年" for y,0,32:a=0:for x,31,-1,-1:a=a<<1:pget x,y:if ginfo_r{a=a|1}:next:b.y=a^-1:next gsel 0:title "あけおめことよろ" repeat 720:hsvcolor int(double(cnt)*1.6)\\192,128,255 deg=double(cnt)/2+90:p=320.0,240.0:vector=sin(deg2rad(deg)),cos(deg2rad(deg)) repeat 480:p+vector:p.1+vector.1:pset p,p.1:loop:await 10:loop wait 100:font MSGothic,15:color 255,255,255:text 20:pos 80,0 for y,0,32:m="":a=b.y:for x,0,32:if a&1{m+"■"}else{m+"×"}:a=a>>1:next:ames m:next wait 100:font "MS 明朝",64:color:t="本年もよろしく","お願い致します" for i,0,2:repeat 7:pos 568-i*560,cnt*64:drawglyph swaphl(wpeek(t.i,2*cnt)):wait 50:loop:next wait 100:title "あけおめことよろ - 新年早々ウザくてすみませんorz by tu-sa" repeat:font MSGothic,15:hsvcolor 32*cnt\\192,255,255:pos 80,1 for y,0,32:m="":a=b.y:for x,0,32:if a&1{m+"■"}else{m+" "}:a=a>>1:next:mes m:next:await 1:loop
/* ames.hsp */ #ifndef xdim #uselib "kernel32.dll" #func global VirtualProtect@_xdim "VirtualProtect" var,int,int,var #define global xdim(%1,%2) dim %1,%2: VirtualProtect@_xdim %1,%2*4,$40,x@_xdim #endif #module "mod_ames" ;// アンチエイリアス文字描画モジュール / 月影とも 2005. 9.11 ;// 命令 ; ames str "string" ;//メッセージを表示 ; text int dely ;// hsp3util で指定した text が生きます。 ; ames_cancel ;// text + ames 中に、残りの文字を一括表示。onclick gosub などで使用可。 #define ctype IsZenkaku(%1) ((((%1)^$20)-$a1&$ff)<=$3b) ;// Shift-Jis用 (日本語Windows) ;#define ctype IsZenkaku(%1) ((%1)<128) ;// 他言語(無保証)…… #uselib "gdi32.dll" #func GetGlyphOutline "GetGlyphOutlineA" int,int,int,var,int,int,var #deffunc _init_ames_ ;void WINAPI DrawGlyph(BMSCR *pBmscr, LPGLYPHMETRICS lpGlyphMetrics, LPBYTE pbGryph, DWORD cbGryph) xdim f,64 f. 0 = 0x24448b51,0x244c8b14,0x57555308,0x18247c8b,0xc3831f8b,0xfce38303,0xc085ed33,0x0c245c89 f. 8 = 0x00c2860f,0x33560000,0xf7c58bd2,0x6c718bf3,0x03087703,0x0c578bf2,0x2b70798b,0x808103c2 f.16 = 0x03000000,0x8bf88bc7,0xf03b0441,0x00848d0f,0x518b0000,0x7dfa3b08,0x7cf6857d,0x7cff8579 f.24 = 0x14598b75,0x448dd72b,0xe0830340,0xc2af0ffc,0x0376148d,0x24548bc2,0x34b60f20,0x91b60f2a f.32 = 0x000000a0,0xb60fc303,0xe6c10258,0xd6af0f02,0x000100bf,0x0ffe2b00,0xd303dfaf,0x0158b60f f.40 = 0x0f08fac1,0x5088dfaf,0x91b60f02,0x000000a1,0x03d6af0f,0x245c8bd3,0x08fac110,0x0f015088 f.48 = 0x00a291b6,0xaf0f0000,0x30b60fd6,0x03f7af0f,0x08fac1d6,0x448b1088,0x7c8b2424,0x3b451c24 f.56 = 0x40820fe8,0x5effffff,0x1047bf0f,0x5f6c518b,0x895dd003,0x595b6c51,0x000010c2 pfnDrawGlyph = varptr(f) : return #deffunc ames str _string _str = _string + "\\n" mref bmscr, 67 pos_startx = ginfo_cx redrawSw = wpeek(bmscr, 78) redraw 0 dim vGlyphmetrics,5 : vMat2=$10000,0,0,$10000 delay = stwait@hsp3util repeat strlen(_str) code = peek(_str, cnt) if IsZenkaku(code) { code = code<<8 | peek(_str, cnt+1) } if code=$0D { bmscr.68 = ginfo_cx - pos_startx, bmscr.32 pos pos_startx, ginfo_cy+bmscr.32 continue cnt+2 } GetGlyphOutline hdc, code, 6, vGlyphmetrics, 0, 0, vMat2 : _sz = stat sdim bmpbuffer, _sz GetGlyphOutline hdc, code, 6, vGlyphmetrics, _sz, varptr(bmpbuffer) , vMat2 prm = varptr(bmscr), varptr(vGlyphmetrics), varptr(bmpbuffer), _sz ret = callfunc(prm,pfnDrawGlyph,4) if delay : redraw redrawSw : await delay : redraw 0 if code>256 : continue cnt+2 loop redraw redrawSw return #deffunc drawglyph int char mref bmscr, 67 dim vGlyphmetrics,5 : vMat2=$10000,0,0,$10000 GetGlyphOutline hdc, char, 6, vGlyphmetrics, 0, 0, vMat2 : _sz = stat sdim bmpbuffer, _sz GetGlyphOutline hdc, char, 6, vGlyphmetrics, _sz, varptr(bmpbuffer) , vMat2 prm = varptr(bmscr), varptr(vGlyphmetrics), varptr(bmpbuffer), _sz ret = callfunc(prm,pfnDrawGlyph,4) redraw wpeek(bmscr, 78) return #ifndef text@ #define global text(%1) stwait@hsp3util=%1 #endif #define global ames_cancel delay@mod_ames = 0 #global _init_ames_ #if 0 ;// さんぷる font "MS P明朝",40 ;// 必ずフォントを設定すること color 255,0,0 pos 20,20 ;// アンチエイリアス文字描画 (ほぼmes互換:数px下にズレるようですが。) #uselib "winmm" #cfunc timeGetTime "timeGetTime" st = timegettime() repeat 100 pos 0,0 ames "abcdefg\\nh愛jklmn\\nハンカクカナ" loop title ""+(timegettime()-st) ;// text命令でウェイトを指定。 text 100 onclick gosub *c ;// クリックするとディレイキャンセルするとか。 ames "amesはウェイト付き。" stop *c : ames_cancel : return #endif
環境ないひと向けDL: ZIP(69.3KB)