|
Post by held12345 on Feb 25, 2023 14:10:25 GMT -5
thanks for info greeting
|
|
|
Post by held12345 on Feb 25, 2023 16:30:14 GMT -5
Hi good afternoon. I would now like to turn a sprite with your program, please. this rotation should be 5x 72 degrees, i.e. 360 degrees. sprite1=72 degrees, sprite2=144 degrees, sprite3=216 degrees....
ist ok : for angle= 72 to 360 step 72 newx=newx+bmpwidth call rotate angle,newx,midx,midy,radi, hWindow, hDC next
how is it please Thanks.
|
|
|
Post by held12345 on Feb 26, 2023 3:16:20 GMT -5
Hi good afternoon. i want to create bmp without mask 64x64. what do you have to change?
but the bmp should not increase.
Thanks. greeting
|
|
|
Post by Rod on Feb 26, 2023 5:47:40 GMT -5
This will create rotated bmps without the mask. I have to say this is a simple and not very accurate way of rotating images. You would do better investigating paint packages.
nomainwin WindowWidth=800 WindowHeight=600 UpperLeftX=(DisplayWidth-WindowWidth)/2 UpperLeftY=(DisplayHeight-WindowHeight)/2 menu #1, "&File", "&Open Sprite",[openSprite],_ "&Save As...",[saveAs],|,"E&xit",[quit] open "Rotate and Mask Sprite" for graphics_nsb as #1 #1 "down ; trapclose [quit]"
hWindow=hwnd(#1) CallDll #user32, "GetDC",_ hWindow as ulong,_ hDC as ulong wait
[quit] CallDll #user32, "ReleaseDC",_ hWindow as ulong,_ hDC as ulong,_ r as long close #1 end
[openSprite] if hBitmap<>0 then unloadbmp ("bm") #1 "cls" end if
filedialog "Open Sprite","*.bmp",bitmap$ if bitmap$="" then wait loadbmp "bm" , bitmap$ hBitmap=hbmp("bm") bmpheight=HeightBitmap(bitmap$) bmpwidth=WidthBitmap(bitmap$) midx=int(bmpwidth/2) midy=int(bmpheight/2)+bmpheight radi=int(bmpwidth/2) #1 "fill black" #1 "drawbmp bm 0 ";bmpheight for angle= 72 to 360 step 72 newx=newx+bmpwidth call rotate angle,newx,midx,midy,radi, hWindow, hDC next
'dont do the mask so rem out next statement 'call MakeMask bmpwidth, bmpheight, hWindow, hDC wait
[saveAs] #1 "getbmp SpriteMask 0 0 ";bmpwidth;" ";2*bmpheight filedialog "Save As... ","*.bmp",savefile$ if savefile$="" then wait newx=0 for a=72 to 360 step 72 'dont save the mask so use this instead of next #1 "getbmp SpriteMask ";newx;" ";bmpheight;" ";bmpwidth;" ";bmpheight '#1 "getbmp SpriteMask ";newx;" 0 ";bmpwidth;" ";2*bmpheight bmpsave "SpriteMask",left$(savefile$,len(savefile$)-4)+str$(a)+".bmp" newx=newx+bmpwidth next wait
'************FUNCTIONS****************** function WidthBitmap(name$) open name$ for input as #pic pic$=input$(#pic,29) close #pic WidthBitmap = asc(mid$(pic$,19,1)) + _ (asc(mid$(pic$,20,1)) * 256) end function
function HeightBitmap(name$)
open name$ for input as #pic pic$=input$(#pic,29) close #pic HeightBitmap = asc(mid$(pic$,23,1)) + _ (asc(mid$(pic$,24,1)) * 256) end function
sub rotate angle, newx, midx, midy, radi, hWindow, hDC for d = 0 to radi for n= 1 to 360 step .5 scan x=int(midx-(d*sin(n/57.29577951))) y=int(midy-(d*cos(n/57.29577951))) CallDll #gdi32, "GetPixel",_ hDC as ulong,_ x as long,_ y as long,_ pColor as long a=n+angle mod 360 x=int(midx-(d*sin(a/57.29577951))) y=int(midy-(d*cos(a/57.29577951))) x=x+newx CallDll #gdi32, "SetPixel",_ hDC as ulong,_ x as long,_ y as long,_ pColor as long,_ r as long next n next d end sub
sub MakeMask wide, high, hWnd,hDC white=(255*256*256)+(255*256)+255 black=0 for x = 0 to 12*wide-1 for y = high to 2*high-1 CallDll #gdi32, "GetPixel",_ hDC as ulong,_ x as long,_ y as long,_ pColor as long if pColor=black then newColor=white else newColor=black end if j=y-high CallDll #gdi32, "SetPixel",_ hDC as ulong,_ x as long, _ j as long, _ newColor as long, _ r as long next y next x end sub
|
|
|
Post by Rod on Feb 26, 2023 5:53:00 GMT -5
I have a sprite creator program but it will take you a while to get to know it. It is a .zip you have to download and extract to your PC. Fairly easy to do. The help file is English. Here is the thread discussing it. Download version2
|
|
|
Post by held12345 on Feb 26, 2023 8:17:51 GMT -5
Hi, thanks for your help. the creator with liberty basic (lb booster) js is great.
Thanks. Greeting
|
|
|
Post by held12345 on Feb 26, 2023 8:46:06 GMT -5
I once tested this nemo. looks really great.
the keyboard doesn't respond to me. I use the bbc lb booster. the game works fine. unfortunately I can't buy the original lbb. Live in the EU.
greeting
|
|
|
Post by Rod on Feb 26, 2023 14:58:27 GMT -5
Sprite creator also works on Just BASIC. But there should be no barrier to purchasing Liberty BASIC in the EU.
|
|