Mal eine komplizierte Frage zu decl+funktionen

Übersicht Sonstiges Smalltalk

Neue Antwort erstellen

 

hamztata

Betreff: Mal eine komplizierte Frage zu decl+funktionen

BeitragFr, März 13, 2009 21:18
Antworten mit Zitat
Benutzer-Profile anzeigen
Also ich versuchs einfach zu erklären.
Nehmen wir an ich hab eine dll und dafür die zugehörige decl, sowie eine .bb mit funktionen etc..
Ich möchte diese dll auch in einer anderen sprache einbinden.
An und für sich kein problem.
Wären da nicht die funktionen, die ich einfach nicht übersetzt bekomme.
Ist es möglich diese irgendwie anders umzusetzen?
Sei es in Blitzmax und eine dll draus zumachen?
Also kann man eine .bb mit den funktionen nehmen und diese über nen umweg, meinetwegen blitzmax zu einer dll machen?

Alternativ habe ich auch noch die c++ header, die diese funktionen ja auch enthalten.
Das ganze hat mehrere Gründe, da die sprache für die ich es nutze, nicht so einfach ermöglicht, types in funktionen zu übergeben(das geht noch) und diese an eine dll weiterzuleiten.

Ist sowas irgendwie denkbar?
 

Gast

BeitragFr, März 13, 2009 21:31
Antworten mit Zitat
Mein verständnis: Du willst aus einer .BB datei eine .DLL datei machen.

Das klappt mit Blitz nicht.
 

hamztata

BeitragFr, März 13, 2009 21:58
Antworten mit Zitat
Benutzer-Profile anzeigen
genau oder vielleicht kann das ja jemand hier umschreiben, sodass es möglich wäre.
muss ja nicht mit bb sein, mit bm z.b. kann man ja dll´s erstellen.

oder wenn jemand aus einem c++ header das hinbekommt, genauso gut.

Abrexxes

BeitragFr, März 13, 2009 22:40
Antworten mit Zitat
Benutzer-Profile anzeigen
Such Zeit ...3 Sekunden* : https://www.blitzforum.de/foru...hp?t=24485

cu

*naja...könnten auch 2 sein

Geeecko

BeitragFr, März 13, 2009 22:44
Antworten mit Zitat
Benutzer-Profile anzeigen
Kann sein das ich es falsch verstehe,
aber ich glaube er will mit Blitz eine DLL erstellen, und dann zum Beispiel in C++ benutzen.
Dann wäre Abrexxes -"zeug" ja sinnlos.

Oder?
 

hamztata

BeitragFr, März 13, 2009 23:45
Antworten mit Zitat
Benutzer-Profile anzeigen
nein ist schon relativ sinnvoll.

und ich versuchs nochmal zu erklären.


ich habe eine dll incl einer .bb und einer .decl

die dll will ich mit einer anderen programmiersprache nutzen, einfaches wrappen geht, aber bei den in der .bb enthaltenen funktionen hab ich so meine probleme, diese auf die sprache, die ich nutze umzusetzen.


also im klartext, brauch ich eine dll, die die funktionen aus der .bb enthält, und auch die eigentliche .dll lädt und nutzt.

und im notfall hab ich auch noch die headerdatei für die dll.und dort sind auch diese funktionen drin.(also eine .h und eine .cpp, alles da)

aber mittels c++ eine dll zu erstellen, die diese funktionen enthält, und auch die ursprüngliche dll lädt, dazu hab ich absolut keine ahnung.

stellt euch mal so vor....
um für bb eine dll zu wrappen, gäbe es nur decl, und die funktionen müssten wieder in eine dll.

so in der art

Silver_Knee

BeitragSa, März 14, 2009 0:47
Antworten mit Zitat
Benutzer-Profile anzeigen
vielleicht sochst du sowas wie das Blitz3D SDK. Das kostet nochmal zusätzlich und beinhaltet ein paar befehle aus BB. kuk mal auf BB.com danach

Noobody

BeitragSa, März 14, 2009 10:26
Antworten mit Zitat
Benutzer-Profile anzeigen
Poste einfach mal den BB - Code, dann kann man mehr dazu sagen. Eventuell findet sich dann sogar jemand, der dir das übersetzen würde, ansonsten stell mal eine Anfrage in den Stellenmarkt.
Aber mit den jetzigen Informationen kann man höchstens sagen, dass es eventuell möglich wäre und dass das vielleicht jemand kann - wir wissen nämlich nicht, in welche Sprache du übersetzen willst, um welche DLL es sich handelt und wie diese BB - Datei aussieht.
Man is the best computer we can put aboard a spacecraft ... and the only one that can be mass produced with unskilled labor. -- Wernher von Braun
 

hamztata

BeitragSa, März 14, 2009 11:37
Antworten mit Zitat
Benutzer-Profile anzeigen
nundenn......
der idealfall wären vereinfachte funktionen oder besser noch, dass einiges wegfällt.

Code: [AUSKLAPPEN]
.lib "FastImageXors.dll"

xInitDraw_% (Direct3DDevice9%, reserved%) : "InitDraw_"
xDeinitDraw%() : "DeinitDraw_"
xStartDraw% () : "StartDraw_"
xEndDraw% () : "EndDraw_"
xSetCustomState% (operation%, value%) : "SetCustomState_"
xSetCustomTextureState% (operation%, value%) : "SetCustomTextureState_"
xSetMipLevel% (level%) : "SetMipLevel_"
xSetBlend% (blend%) : "SetBlend_"
xSetAlpha% (alpha#) : "SetAlpha_"
xSetColor% (r%, g%, b%) : "SetColor_"
xSetCustomColor% (colorVertex0%, colorVertex1%, colorVertex2%, colorVertex3%) : "SetCustomColor_"
xSetRotation% (rotation#) : "SetRotation_"
xSetScale% (scaleX#, scaleY#) : "SetScale_"
xSetTransform% (rotation#, scaleX#, scaleY#) : "SetTransform_"
xSetMatrix% (xx#, xy#, yx#, yy#) : "SetMatrix_"
xSetHandle% (x%, y%) : "SetHandle_"
xSetOrigin% (x%, y%) : "SetOrigin_"
xMidHandleImage% (image%) : "MidHandleImage_"
xSetImageHandle% (image%, x%, y%) : "SetImageHandle_"
xAutoMidHandleEx% (state%) : "AutoMidHandleEx_"
xAutoImageFlags% (flags%) : "AutoImageFlags_"
xSetLineWidth% (width#) : "SetLineWidth_"
xSetViewport% (x%, y%, width%, height%) : "SetViewport_"
xCreateImageEx_% (texures*, width%, height%, flags%) : "CreateImageEx_"
xFreeImageEx_% (image%) : "FreeImageEx_"
xDrawImageEx_% (image%, x%, y%, frame%) : "DrawImageEx_"
xDrawImageRectEx_% (image%, x%, y%, width%, height%, frame%) : "DrawImageRectEx_"
xDrawImagePart_% (image%, x%, y%, width%, height%, partX%, partY%, partWidth%, partHeight%, frame%, wrap%) : "DrawImagePart_"
xDrawPoly_% (x%, y%, bank%, image%, frame%, color%) : "DrawPoly_"
xDrawRect_% (x%, y%, width%, height%, fill%) : "DrawRect_"
xDrawRectSimple_% (x%, y%, width%, height%, fill%) : "DrawRectSimple_"
xDrawLine% (x%, y%, x2%, y2%) : "DrawLine_"
xDrawLineSimple% (x%, y%, x2%, y2%) : "DrawLineSimple_"
xDrawPlot% (x%, y%) : "DrawPlot_"
xDrawOval% (x%, y%, width%, height%) : "DrawOval_"
xGetProperty_%(type*) : "GetProperty_"
xGetImageProperty_%(image%, type*) : "GetImageProperty_"
xSetProjScale% (scaleX#, scaleY#) : "SetProjScale_"
xSetProjRotation% (rotation#) : "SetProjRotation_"
xSetProjTransform% (rotation#, scaleX#, scaleY#) : "SetProjTransform_"
xSetProjOrigin% (x%, y%) : "SetProjOrigin_"
xSetProjHandle% (x%, y%) : "SetProjHandle_"
xMidHandleProj% () : "MidHandleProj_"

xCreateImageFont% (type*) : "CreateImageFont_"
xSetImageFont% (font%) : "SetImageFont_"
xFreeImageFont_% (font%) : "FreeImageFont_"
xDrawText_% (text$, x%, y%, centerX%, centerY%, maxWidth%) : "DrawTextEx_"
xDrawTextRect_% (text$, x%, y%, w%, h%, centerX%, centerY%, lineSpacing%) : "DrawTextRect_"
xTextRectCount%() : "TextRectCount_"
xTextRectMaxWidth%() : "TextRectMaxWidth_"
xTextRectWidth%(StringNumber%) : "TextRectWidth_"
xStringWidthEx_%(text$, maxWidth%) : "StringWidthEx_"
xStringHeightEx%(text$) : "StringHeightEx_"
xGetFontProperty_%(font%, type*) : "GetFontProperty_"

xTestRect_% (xPoint%, yPoint%, xRect%, yRect%, WidthRect%, HeightRect%, Local%, Result*, ResultFlag%) : "TestRect_"
xTestOval_% (xPoint%, yPoint%, xOval%, yOval%, WidthOval%, HeightOval%, Local%, Result*, ResultFlag%) : "TestOval_"
xTestImage_% (xPoint%, yPoint%, xImage%, yImage%, Image%, Local%, Result*, ResultFlag%) : "TestImage_"
xTestRendered_% (xPoint%, yPoint%, Local%, Result*, ResultFlag%) : "TestRendered_"

xGetCustomTransform_% (type%, martix*) : "GetCustomTransform_"
xSetCustomTransform_% (type%, matrix*) : "SetCustomTransform_"

.lib " "

xCreateImageEx% (texure%, width%, height%, flags%)
xLoadImageEx% (fileName$, textureFlags%, imageFlags%)
xLoadAnimImageEx% (fileName$, textureFlags%, frameWidth%, frameHeight%, firstFrame%, frameCount%, imageFlags%)
xDrawImageEx% (image%, x%, y%, frame%)
xDrawImageRectEx% (image%, x%, y%, width%, height%, frame%)
xDrawImagePart% (image%, x%, y%, width%, height%, tx%, ty%, twidth%, theight%, frame%)
xDrawRect% (x%, y%, width%, height%, fill%)
xDrawRectSimple% (x%, y%, width%, height%, fill%)
xSetCustomBlend% (src%, dest%)

xInitDraw% ()
xGetProperty% ()
xGetImageProperty% (image%)
xGetFontProperty% (font%)

xLoadImageFont% (filename$, flags%)
xDrawText% (txt$, x%, y%, centerX%, centerY%)
xDrawTextRect% (txt$, x%, y%, w%, h%, centerX%, centerY%, lineSpacing%)

xTestRect% (xPoint%, yPoint%, xRect%, yRect%, WidthRect%, HeightRect%, Local%)
xTestOval% (xPoint%, yPoint%, xOval%, yOval%, WidthOval%, HeightOval%, Local%)
xTestImage% (xPoint%, yPoint%, xImage%, yImage%, Image%, alphaLevel%, Frame%, Local%)
xTestRendered% (xPoint%, yPoint%, alphaLevel%, Local%)



Code: [AUSKLAPPEN]
;Image type constants
Const imgtype_Unknown = 0
Const imgtype_BMP = 1
Const imgtype_PNG = 2
Const imgtype_JPEG = 3
Const imgtype_TGA = 4
Const imgtype_DDS = 5

;Globals

Global ImageInfo_Type = imgtype_Unknown
Global ImageInfo_Width
Global ImageInfo_Height
Global ImageInfo_Depth

;User functions

Function ImageInfo_ReadFile(FileName$) 
   If FileType(FileName)<>1 Return   
   
   ;Init 
   ImageInfo_Type = imgtype_Unknown
   ImageInfo_Width = 0
   ImageInfo_Height = 0
   ImageInfo_Depth = 0
 
   Buffer = CreateBank(4) 
   ImageFileSize = FileSize(FileName)
   
   If ImageFileSize<3 Then
      FreeBank(Buffer)
      Return
   EndIf
   
   ImageFile = ReadFile(FileName) 
 
   ;Start comparsion
   ReadBytes(Buffer, ImageFile, 0, 4)
 
   ;Check PNG
   If (PeekByte(Buffer,0) = 137) And (PeekByte(Buffer,1) = 80) And (PeekByte(Buffer,2) = 78) Then
      ImageOk = ImageInfo_ReadPNG(ImageFile, ImageFileSize)      
   EndIf
 
   ;Check BMP
   If (ImageOk = False) And (PeekByte(Buffer,0) = 66) And (PeekByte(Buffer,1) = 77) Then
      ImageOk = ImageInfo_ReadBMP(ImageFile, ImageFileSize)            
   EndIf

   ;Check DDS
   If (ImageOk = False) And (PeekByte(Buffer,0) = 68) And (PeekByte(Buffer,1) = 68) And (PeekByte(Buffer,2) = 83)  And (PeekByte(Buffer,3) = 32) Then
      ImageOk = ImageInfo_ReadDDS(ImageFile, ImageFileSize)            
   EndIf
   
   ;Check TGA
   If ImageOk = False Then ImageOk = ImageInfo_ReadTGA(ImageFile, ImageFileSize)
           
   ;Check JPEG
   If ImageOk = False Then ImageOk = ImageInfo_ReadJPG(Buffer, ImageFile, ImageFileSize)
      

   CloseFile(ImageFile)
   FreeBank(Buffer)
   
   Return ImageOk
End Function

;Internal functions

Function ImageInfo_ReadBMP(ImageFile, ImageFileSize)
   If ImageFileSize<29 Return
   
   ImageInfo_Type = imgtype_BMP
   
   SeekFile(ImageFile, 18)
   ImageInfo_Width = ReadShort(ImageFile)
   
   SeekFile(ImageFile, 22)
   ImageInfo_Height = ReadShort(ImageFile)

   SeekFile(ImageFile, 28)
   ImageInfo_Depth = ReadByte(ImageFile)
   
   Return True
End Function

Function ImageInfo_ReadDDS(ImageFile, ImageFileSize)
   If ImageFileSize<129 Return
   
   ImageInfo_Type = imgtype_DDS
   
   SeekFile(ImageFile, 12)
   ImageInfo_Height = ReadInt(ImageFile)

   ;SeekFile(ImageFile, 16)
   ImageInfo_Width = ReadInt(ImageFile)

   ReadInt(ImageFile)   ;20 Pitch

   ;SeekFile(ImageFile, 24)
   ImageInfo_Depth = ReadInt(ImageFile)
   
   Return True
End Function

Function ImageInfo_ReadPNG(ImageFile, ImageFileSize)
   If ImageFileSize<25 Return
   
   Local b
   Local c   
   
   ImageInfo_Type = imgtype_PNG
   SeekFile(ImageFile, 24) 

   b = ReadByte(ImageFile)
   c = ReadByte(ImageFile)

   ;Color depth
   Select c
      Case 0
         ImageInfo_Depth = b; greyscale
      Case 2
         ImageInfo_Depth = b * 3; RGB
      Case 3
         ImageInfo_Depth = 8; Palette based
      Case 4
         ImageInfo_Depth = b * 2; greyscale with alpha
      Case 6
         ImageInfo_Depth = b * 4; RGB with alpha
      Default
         ImageInfo_Type = imgtype_Unknown
   End Select
   
   If ImageInfo_Type = imgtype_PNG Then
      seeked = SeekFile(ImageFile, 16)      
      ImageInfo_Width = Swap32(ReadInt(ImageFile))
      ImageInfo_Height = Swap32(ReadInt(ImageFile))            
      Return True
   EndIf   
End Function

Function ImageInfo_ReadJPG(Buffer, ImageFile, ImageFileSize)
   Local i
   Local Pos = 0
   Local BType
   
   ;find beginning of JPEG stream
   IsError = True
   While Pos<=ImageFileSize-4
      SeekFile(ImageFile, Pos)
      For i=0 To 3: PokeByte Buffer, i, ReadByte(ImageFile): Next
      If (PeekByte(Buffer,0) = $FF) And (PeekByte(Buffer,1) = $D8) And (PeekByte(Buffer,2) = $FF) And (PeekByte(Buffer,3) = $E0) Then
         IsError = False
         Exit
      EndIf   
      Pos = Pos + 1
   Wend
   If IsError Return
   Pos = FilePos(ImageFile) + Swap16(ReadShort(ImageFile))

   ;loop through Each marker Until we find the C0 marker (Or C1 Or C2) which
   ;has the image information
   IsError = True
   SeekFile(ImageFile, Pos)
   While Not Eof(ImageFile)
      If ReadByte(ImageFile) = $FF
         BType = ReadByte(ImageFile)
         Pos = FilePos(ImageFile) + Swap16(ReadShort(ImageFile))

         ; if the type is from SOF0 to SOF3
         If (BType >= $C0) And (BType <= $C3)
            i = ReadByte(ImageFile)
            ImageInfo_Height = Swap16(ReadShort(ImageFile))
            ImageInfo_Width = Swap16(ReadShort(ImageFile))
            ImageInfo_Depth = ReadByte(ImageFile) * 8
            ImageInfo_Type = imgtype_JPEG
             IsError = False
            Exit
         EndIf
         
         ; Goto next marker
         SeekFile(ImageFile, Pos)
      EndIf      
   Wend
      
   Return 1-IsError
End Function

Function ImageInfo_ReadTGA(ImageFile, ImageFileSize)
   If ImageFileSize<24+12 Return

   SeekFile(ImageFile, 0)
   If ReadByte(ImageFile)=0 And ReadByte(ImageFile)=0 And ReadByte(ImageFile)=2
      ImageInfo_Type = imgtype_TGA
   Else
      Return
   EndIf
   
   SeekFile(ImageFile, 12)
   ImageInfo_Width = ReadShort(ImageFile)
   ImageInfo_Height = ReadShort(ImageFile)
   ImageInfo_Depth = ReadShort(ImageFile)
   
   Return True   
End Function

Function Swap16%(Value%)
   Local b1 = Value And 255
   Local b2 = (Value Shr 8) And 255
   Return b1 Shl 8 Or b2
End Function

Function Swap32%(Value%) 
   Local b1 = Value And 255;
   Local b2 = (Value Shr 8) And 255;
   Local b3 = (Value Shr 16) And 255;
   Local b4 = (Value Shr 24) And 255;

   b1 = b1 Shl 24
   b2 = b2 Shl 16
   b3 = b3 Shl 8

   Return b1 Or b2 Or b3 Or b4
End Function




Code: [AUSKLAPPEN]
Include "include\GetImageInfo.bb"



;äàííûå ôëàãè - êîíñòàíòû îáÿçàòåëüíî ïðèãîäÿòñÿ
;ïîäðîáíåå ïðî íèõ ÷èòàéòå â õåëïå

;CreateImageEx Flags (ïðè ñîçäàíèè êàðòèíêè)
Const FI_AUTOFLAGS = -1
Const FI_NONE = 0
Const FI_MIDHANDLE = 1
Const FI_FILTEREDIMAGE = 2
Const FI_FILTERED = 2

;SetBlend Flags (ïðè èñïîëüçîâàíèè áëåíäà (ñìåøèâàíèÿ)
Const FI_SOLIDBLEND = 0
Const FI_ALPHABLEND = 1
Const FI_LIGHTBLEND = 2
Const FI_SHADEBLEND = 3
Const FI_MASKBLEND = 4
Const FI_MASKBLEND2 = 5
Const FI_INVALPHABLEND = 6

;ImageFonts Flags
Const FI_SMOOTHFONT=1

;DrawImagePart Wrap Flags
Const FI_NOWRAP = 0
Const FI_WRAPU = 1
Const FI_MIRRORU = 2
Const FI_WRAPV = 4
Const FI_MORRORV = 8
Const FI_WRAPUV = 5
Const FI_MIRRORUV = 10

;DrawPoly consts
Const FI_POINTLIST     = 1
Const FI_LINELIST      = 2
Const FI_LINESTRIP     = 3
Const FI_TRIANGLELIST  = 4
Const FI_TRIANGLESTRIP = 5
Const FI_TRIANGLEFAN   = 6

;   FI_POINTLIST
;      Renders the vertices as a collection of isolated points.
;   FI_LINELIST
;      Renders the vertices as a list of isolated straight line segments. Calls using this primitive type fail If the count is less than 2 or is odd.
;   FI_LINESTRIP
;      Renders the vertices as a single polyline. Calls using this primitive type fail If the count is less than 2.
;   FI_TRIANGLELIST
;      Renders the specified vertices as a sequence of isolated triangles. Each group of three vertices defines a separate triangle.
;      Calls using this primitive type fail If the count is less than 3 or not evenly divisible by 3.
;   FI_TRIANGLESTRIP
;      Renders the vertices as a triangle strip. Calls using this primitive type fail If the count is less than 3.
;   FI_TRIANGLEFAN
;      Renders the vertices as a triangle fan. Calls using this primitive type fail If the count is less than 3.

Const FI_COLOROVERLAY = 1



;íàáîð âñåõ ñâîéñòâ áèáëèîòåêè
Type FI_PropertyType
   Field Blend%
   Field Alpha#, Red%, Green%, Blue%
   Field ColorVertex0%, ColorVertex1%, ColorVertex2%, ColorVertex3%                                    
   Field Rotation#, ScaleX#, ScaleY#
   Field MatrixXX#, MatrixXY#, MatrixYX#, MatrixYY#
   Field HandleX%, HandleY%
   Field OriginX%, OriginY%
   Field AutoHandle%, AutoFlags%
   Field LineWidth#
   Field ViewportX%, ViewportY%, ViewportWidth%, ViewportHeight%
   Field MipLevel%
   Field ProjScaleX#, ProjScaleY#, ProjRotation#
   Field ProjOriginX%, ProjOriginY%
   Field ProjHandleX%, ProjHandleY%
   Field Reserved0%
   Field Reserved1%
End Type

;èñïîëüçóåì ãëîáàëüíóþ ïåðåìåííóþ FI_Property äëÿ ïîëó÷åíèÿ êîíêðåòíîãî ñâîéñòâà èç íàáîðà
;â ïðîãðàììå ïîëó÷àòü âåñü íàáîð ñâîéñòâ  íóæíî òàê:  GetProperty FI_Property
Global FI_Property.FI_PropertyType = New FI_PropertyType



;íàáîð ñâîéñòâ ëþáîé êàðòèíêè, ñîçäàííîé áèáëèîòåêîé (êîìàíäîé CreateImageEx)
Type FI_ImagePropertyType
   Field HandleX%
   Field HandleY%
   Field Width%
   Field Height%
   Field Frames%
   Field Flags%
   Field Texture%
   Field Reserved0%
   Field Reserved1%
End Type

;èñïîëüçóåì ãëîáàëüíóþ ïåðåìåííóþ FI_ImageProperty äëÿ ïîëó÷åíèÿ êîíêðåòíîãî ñâîéñòâà
;èç íàáîðà ñâîéñòâ ëþáîé êàðòèíêè, ñîçäàííîé áèáëèîòåêîé (êîìàíäîé CreateImageEx)
;â ïðîãðàììå ïîëó÷àòü âåñü íàáîð ñâîéñòâ  íóæíî òàê:  GetImageProperty your_image, FI_ImageProperty
Global FI_ImageProperty.FI_ImagePropertyType = New FI_ImagePropertyType



Type FI_FontPropertyType
   Field Width%
   Field Height%
   Field FirstChar%
   Field Kerning%
   Field Image%
   Field FrameWidth%
   Field FrameHeight%
   Field FrameCount%
   Field Chars[256]
End Type
Global FI_FontProperty.FI_FontPropertyType = New FI_FontPropertyType




;òèï äëÿ ïîëó÷åíèÿ âñåé èíôîðìàöèè î ïîëîæåíèè òî÷êè íà ïðèìèòèâå (êîìàíäà TestPoint)
Type FI_TestType
   Field Result%
   Field ProjectedX%, ProjectedY%
   Field RectX%, RectY%
   Field RectU#, RectV#
   Field TextureX%, TextureY%
   Field Texture%
   Field Frame%
   Field Reserved1%
End Type
Global FI_Test.FI_TestType = New FI_TestType




;ôóíêöèÿ óíèâåðñàëüíîãî "ðó÷íîãî" áëåíäà (ñìåøèâàíèÿ öâåòîâ)
;ñîçäàíà äëÿ íà÷èíàþùèõ, åùå íå îñâîèâøèõ DirectX7
;çíà÷åíèÿ src è dest äîëæíû áûòü â ïðåäåëàõ îò 1 äî 10
Function xSetCustomBlend(src%, dest%)
   xSetCustomState 15,0            ;DX7  SetRenderState ( D3DRENDERSTATE_AlphaTestEnable, False )
   xSetCustomState 27,1            ;DX7  SetRenderState ( D3DRENDERSTATE_AlphaBlendEnable, True )
   xSetCustomState 19,src         ;DX7  SetRenderState ( D3DRENDERSTATE_SrcBlend, src )
   xSetCustomState 20,dest         ;DX7  SetRenderState ( D3DRENDERSTATE_DestBlend, dest )
End Function





Type FI_SurfacesType
   Field Count%
   Field Array%[256]
   Field Texture%
End Type
Global FI_Surfaces.FI_SurfacesType = New FI_SurfacesType





;âñïîìîãàòåëüíûå ôóíêöèè, ïîçâîëÿþùèå íå çàäàâàòü êàæäûé ðàç ïàðàìåòðû ñ äåôîëòíûìè çíà÷åíèÿìè
Function xCreateImageEx% (texture%, width%, height%, imageFlags%=FI_AUTOFLAGS)
   If texture<>0 Then
      FI_Surfaces\Texture = texture
      FI_Surfaces\Count = xGetTextureFrames(texture)
      If FI_Surfaces\Count>0 Then
         If FI_Surfaces\Count>256 Then FI_Surfaces\Count=256
         For i=0 To FI_Surfaces\Count-1
            FI_Surfaces\Array[i] = xGetTextureSurface(texture, i)
         Next
         Return xCreateImageEx_(FI_Surfaces, width, height, imageFlags)
      EndIf
   EndIf
   Return 0
End Function

Function xLoadImageEx% (fileName$, textureFlags%=0, imageFlags%=FI_AUTOFLAGS)
   If ImageInfo_ReadFile (fileName) Then
      Return xCreateImageEx ( xLoadTexture (fileName, textureFlags), ImageInfo_Width, ImageInfo_Height, imageFlags)
   EndIf
   Return 0
End Function

Function xLoadAnimImageEx% ( fileName$, textureFlags%, frameWidth%, frameHeight%, firstFrame%, frameCount%, imageFlags%=FI_AUTOFLAGS )
   textureFlags = (textureFlags And $3F) Or $9
   Return xCreateImageEx ( xLoadAnimTexture (fileName, textureFlags, frameWidth, frameHeight, firstFrame, frameCount), frameWidth, frameHeight, imageFlags)
End Function

Function xDrawImageEx% (image%, x%, y%, frame%=0)
   Return xDrawImageEx_(image, x, y, frame)
End Function

Function xDrawImageRectEx% (image%, x%, y%, width%, height%, frame%=0)
   Return xDrawImageRectEx_(image, x, y, width, height, frame)
End Function

Function xDrawImagePart% (image%, x%, y%, width%, height%, partX%=0, partY%=0, partWidth%=0, partHeight%=0, frame%=0, wrap%=FI_NOWRAP)
   Return xDrawImagePart_(image, x, y, width, height, partX, partY, partWidth, partHeight, frame, wrap)
End Function

Function xDrawPoly% (x%, y%, bank%, image%=0, frame%=0, color%=FI_NONE)
   Return xDrawPoly_(x, y, bank, image, frame, color)
End Function

Function xDrawRect% (x%, y%, width%, height%, fill%=1)
   xDrawRect_ x, y, width, height, fill
End Function

Function xDrawRectSimple% (x%, y%, width%, height%, fill%=1)
   xDrawRectSimple_ x, y, width, height, fill
End Function

Function xLoadImageFont% (filename$, flags%=FI_SMOOTHFONT)
   Local f, i, l$, r$, AnimTexture$, AnimTextureFlags, Texture

   filename=Replace (filename,"/", "\")
   f = ReadFile(filename)
   If f=0 Then Return 0

   FI_FontProperty\Width=0
   FI_FontProperty\Height=0
   FI_FontProperty\FirstChar=0
   FI_FontProperty\Kerning=0
   FI_FontProperty\Image=0
   FI_FontProperty\FrameWidth=0
   FI_FontProperty\FrameHeight=0
   FI_FontProperty\FrameCount=0
   For i=0 To 255
      FI_FontProperty\Chars[i]=0
   Next
   AnimTextureFlags=4

   While Not Eof(f)
      l=Trim(ReadLine(f))
      i=Instr(l,"=",1)
      If Len(l)>0 And Left(l,1)<>";" And i>0 Then
         r=Trim(Right(l,Len(l)-i))
         l=Upper(Trim(Left(l,i-1)))
         Select l
            Case "ANIMTEXTURE"
               AnimTexture=r
            Case "ANIMTEXTUREFLAGS"
               AnimTextureFlags=Int(r)
            Case "FRAMEWIDTH"
               FI_FontProperty\FrameWidth=Int(r)
            Case "FRAMEHEIGHT"
               FI_FontProperty\FrameHeight=Int(r)
            Case "FRAMECOUNT"
               FI_FontProperty\FrameCount=Int(r)
            Case "WIDTH"
               FI_FontProperty\Width=Int(r)
            Case "HEIGHT"
               FI_FontProperty\Height=Int(r)
            Case "FIRSTCHAR"
               FI_FontProperty\FirstChar=Int(r)
            Case "KERNING"
               FI_FontProperty\Kerning=Int(r)            
            Default
               If Int(l)>=0 And Int(l)<=255 Then
                  FI_FontProperty\Chars[Int(l)]=Int(r)
               EndIf
         End Select
      EndIf
   Wend
   CloseFile f

   If Len(AnimTexture)>0 And FI_FontProperty\FrameWidth>0 And FI_FontProperty\FrameHeight>0 And FI_FontProperty\FrameCount>0 Then
      f=1
      Repeat
         i=Instr(filename,"\",f)
         If i<>0 Then f=i+1
      Until i=0
      If flags=FI_SMOOTHFONT Then   :   flags=FI_FILTEREDIMAGE   :   Else   :   flags=FI_NONE   :   EndIf
      FI_FontProperty\Image = xLoadImageEx ( Left(filename,f-1)+AnimTexture, (AnimTextureFlags And $6) Or $39, flags)
      Return xCreateImageFont( FI_FontProperty )
   EndIf
   Return 0
End Function

Function xStringWidthEx% (txt$, maxWidth%=10000)
   Return xStringWidthEx_(txt, maxWidth)
End Function

Function xDrawText% (txt$, x%, y%, centerX%=0, centerY%=0, maxWidth%=10000)
   Return xDrawText_(txt, x, y, centerX, centerY, maxWidth)
End Function

Function xDrawTextRect% (txt$, x%, y%, w%, h%, centerX%=0, centerY%=0, lineSpacing%=0)
   Return xDrawTextRect_(txt, x, y, w, h, centerX, centerY, lineSpacing)
End Function



Function xInitDraw% (def=0)
   Return xInitDraw_ ( xGetDevice(), 0 )
End Function

Function xGetProperty% ()
   Return xGetProperty_ (FI_Property)
End Function

Function xGetImageProperty% (image%)
   Return xGetImageProperty_ (image, FI_ImageProperty)
End Function

Function xGetFontProperty% (font%)
   Return xGetFontProperty_ (font, FI_FontProperty)
End Function



Function xTestRect% (xPoint%, yPoint%, xRect%, yRect%, WidthRect%, HeightRect%, Loc%=0)
   Return xTestRect_ (xPoint, yPoint, xRect, yRect, WidthRect, HeightRect, Loc, FI_Test, 1)
End Function

Function xTestOval% (xPoint%, yPoint%, xOval%, yOval%, WidthOval%, HeightOval%, Loc%=0)
   Return xTestOval_ (xPoint, yPoint, xOval, yOval, WidthOval, HeightOval, Loc, FI_Test, 1)
End Function

Function xTestImage% (xPoint%, yPoint%, xImage%, yImage%, Image%, alphaLevel%=0, Frame%=0, Loc%=0)
   If xTestImage_ (xPoint, yPoint, xImage, yImage, Image, Loc, FI_Test, 1) And alphaLevel>0 And FI_Test\Texture<>0 Then
      If ( xReadPixel( FI_Test\TextureX, FI_Test\TextureY, xTextureBuffer(FI_Test\Texture,Frame) ) Shr 24 ) < alphaLevel Then FI_Test\Result = 0
   EndIf
   Return FI_Test\Result
End Function

Function xTestRendered% (xPoint%, yPoint%, alphaLevel%=0, Loc%=0)
   If xTestRendered_ (xPoint, yPoint, Loc, FI_Test, 1) And alphaLevel>0 And FI_Test\Texture<>0 Then
      If ( xReadPixel( FI_Test\TextureX, FI_Test\TextureY, xTextureBuffer(FI_Test\Texture,FI_Test\Frame) ) Shr 24 ) < alphaLevel Then FI_Test\Result = 0
   EndIf
   Return FI_Test\Result
End Function

Function xFreeImageEx% (image%, freeTexture%=0)
   If freeTexture<>0 And xGetImageProperty(image)<>0 And FI_ImageProperty\Texture<>0 Then xFreeTexture FI_ImageProperty\Texture
   xFreeImageEx_ image
End Function

Function xFreeImageFont% (font%)
   If xGetFontProperty(font)<>0 And FI_FontProperty\Image<>0 Then
      If xGetImageProperty(FI_FontProperty\Image)<>0 And FI_ImageProperty\Texture<>0 Then xFreeTexture FI_ImageProperty\Texture
   Endif
   xFreeImageFont_ font

tedy

BeitragSa, März 14, 2009 12:18
Antworten mit Zitat
Benutzer-Profile anzeigen
Ausserdem dürfen mit Bmax erstellte DLLS auch nicht ohne weiteres verteilt werden.Also wenn du das vor hattest müsstest du erstmal mit Mark reden oder mit dem Support dort.
01010100 01100101 01000100 01111001 00100000 00111010 01000100

Neue Antwort erstellen


Übersicht Sonstiges Smalltalk

Gehe zu:

Powered by phpBB © 2001 - 2006, phpBB Group