Jup klasse.
Ich möchte jetzt Profan2Cpp einbinden.
Wo muss jetzt "invokeXpia" genau hingelenkt werden, damit Profan2Cpp damit funktioniert?
Habe es zur Zeit auf xpia_dir gelegt.
Bekomme von Profan2Cpp viele Fehlermeldungen. Auch wenn ich die "$MAKE" mit allen Buchstaben reinsetze.
Mit dem Profan2Cpp, Xpia 3.1 und Xpse läuft es einwandfrei.
$H Windows.ph
declare x1!,y1!,dx!,dy!,winkel!,y&,z&,groesse&
declare hWin&,hwin1&,hintergr&,hintergr1&,block&,hintergrauto&
declare width&,height&,ende&,bild_auto&
declare bmi# ,ogl_rgb#,b#,rechteck1#,rechteck2#,rechteck3#
declare xb1&,yb1&,xb2&,yb2&,xd&,yd&,colli&,xx1&,yy1&
groesse&=64*64*4
dim b#,groesse&
dim ogl_rgb#,groesse&
If 0
AsmStart rgb_farbe
Parameters b#,groesse&
LOCAL r :BYTE
LOCAL g :BYTE
LOCAL b :BYTE
LOCAL n :DWORD
mov eax,para2
mov n,eax
mov ecx,0
mov ebx,para1
.while ecx<=n
mov al,[ebx+ecx]
mov r,al
mov al,[ebx+ecx+1]
mov g,al
mov al,[ebx+ecx+2]
mov b,al
mov al,b
.if al>252
mov eax,255
.break
.endif
mov al,g
.if al>252
mov eax,255
.break
.endif
mov al,r
.if al>252
mov eax,255
.break
.endif
add ecx,4
.endw
AsmEnd(z&)
endif
ende&=1
Window 20,20-800,600
Cls @RGB(220,220,220)
hWin& = @Create("text", %hwnd, "Test1", 10, 10, 64,64)
hWin1& = @Create("text",%hwnd, "Test2", 200, 10,500,500)
hintergr&=create("hnewpic",500,500,$00ffff)
hintergr1&=create("hnewpic",500,500,$00ffff)
block&=create("hnewpic",64,64,$00f000)
bild_auto&=create("hnewpic",64,64,$00ff00)
oGL("Init", hwin&, 0,0, 0, 0)
oGL("PosMode", 1)
bild_auto& = Create("hnewPic",64,64,0 )
var tex.auto& = oGL("LoadTextureBMP","auto1.bmp",1)
STRUCT rect = x&,y&,w&,h&
DIM rechteck1#, rect
DIM rechteck2#, rect
DIM rechteck3#, rect
mcls 64,64
height&=64
width&=64
bitmap_header
drawglscene
drawglscene
oglzubmp
dx!=100
dy!=100
drawscene
WHILE ende&
sleep 1
if isKey(81)
winkel!=winkel!+1.0
drawglscene
oglzubmp
drawscene
endif
if isKey(69)
winkel!=winkel!-1.0
drawglscene
oglzubmp
drawscene
endif
if isKey(87)
y1!=Sin((-winkel!)/180.0*pi())*2
x1!=Cos((-winkel!)/180.0*pi())*2
dx!=dx!-x1!
dy!=dy!-y1!
drawglscene
oglzubmp
drawscene
endif
if isKey(83)
y1!=Sin((-winkel!)/180.0*pi())*2
x1!=Cos((-winkel!)/180.0*pi())*2
dx!=dx!+x1!
dy!=dy!+y1!
drawglscene
oglzubmp
drawscene
endif
collision
StartPaint %hwnd
DrawText 10,300,(Format$("######0' '",colli&))
DrawText 10,320,(Format$("######0' '",z&))
endpaint
ENDWHILE
end
proc collision
With rechteck1#
.x& = 0
.y& = 0
.w& = 0
.h& = 0
EndWith
With rechteck2#
.x& = dx!
.y& = dy!
.w& = dx!+64
.h& = dy!+64
EndWith
With rechteck3#
.x& = 300
.y& = 200
.w& = 364
.h& = 264
EndWith
colli&=~IntersectRect(rechteck1#,rechteck2#,rechteck3#)
if colli&=1
pixelausgabe
endif
endproc
proc pixelausgabe
~GetDIBits(%hdc,hintergrauto&,0,64,b#,bmi#,0)
z&=Call(xpia_getprocaddressm(xpia_hmodule&,"rgb_farbe"),b#,groesse&)
endproc
proc oglzubmp
ogl("glReadPixels",0,0,64,64,~GL_BGRA,~GL_UNSIGNED_BYTE,ogl_rgb#)
~setDIBits(%hdc,bild_auto&,0,64,ogl_rgb#,bmi#,0)
startpaint -1
drawpic bild_auto&,0,0;-1
endpaint
endproc
proc drawglscene
OGL("Clear")
OGL("origin",0,0,-1.11)
OGL("texture",tex.auto&,1)
OGL("rotate",0,0,winkel!)
OGL("quad",0.7,0.7)
OGL("show")
endproc
proc drawscene
startpaint hintergr&
drawpic hintergr1&,0,0;0
drawpic block&,300,200;0
mcopybmp 0,0 - 64,64 > dx!,dy!,-1
endpaint
startpaint hwin1&
drawpic hintergr&,0,0;0
endpaint
hintergrauto&=create("hpiccopy",hintergr&,300,200,64,64)
startpaint hwin&
drawpic hintergrauto&,0,100;0
endpaint
endproc
proc bitmap_header
def &BI_RGB 0
def &DIB_RGB_COLORS 0
struct BITMAPINFOHEADER = \
biSize&, biWidth&, biHeight&, biPlanes%, biBitCount%, biCompression&, \
biSizeImage&, biXPelsPerMeter&, biYPelsPerMeter&, biClrUsed&, biClrImportant&
dim bmi#,BITMAPINFOHEADER
clear bmi#
with bmi#
.biSize& = sizeof(bmi#)
.biWidth& = width&
.biHeight& = height&
.biPlanes% = 1
.biBitCount% = 32
.biCompression& = &BI_RGB
.biSizeImage& = ((.biWidth& * .biBitCount% \ 8 - 1) | 3 + 1) * abs(.biHeight&)
endwith
endproc
Alles anzeigen