hi leute ich habe folgendes problemm nemlich ich hbe mir eine redner rutine erstell aber ich schaffe es nicht das bild ordenlich darzu stellen
hier der code (vervielfältigung untersagt)
mfg blacknetworkbit
hier der code (vervielfältigung untersagt)
VB.NET-Quellcode
- Imports Microsoft.DirectX.Direct3D.D3DX
- Imports Microsoft.DirectX.Direct3D
- Imports Microsoft.DirectX
- Public Class Form1
- Dim dir As Directx_help
- Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
- dir = New Directx_help
- dir.Load_DirectX()
- dir.bild_laden(My.Resources.raum1, 100, 1, False)
- dir.bild_laden(My.Resources.Logo, 1, 1, False)
- End Sub
- End Class
- Public Class Directx_help
- Dim tm As New System.Windows.Forms.Timer
- Dim present As New Direct3D.PresentParameters
- Dim Dev3D As Direct3D.Device
- Dim b(30) As Bild
- Dim bild_zahler As Integer
- Dim t(30) As Text
- Dim text_zahler As Integer
- Public text_bool, bmp_bool As Boolean
- Private Sub Init_DirectX()
- present = New PresentParameters
- present.Windowed = True
- present.BackBufferWidth = 602
- present.BackBufferHeight = 582
- present.SwapEffect = SwapEffect.Discard
- present.BackBufferFormat = Direct3D.Format.A8R8G8B8
- present.PresentationInterval = Direct3D.PresentInterval.One
- present.SwapEffect = Direct3D.SwapEffect.Discard
- Dev3D = New Device(0, DeviceType.Hardware, Form1.Handle, CreateFlags.SoftwareVertexProcessing, present)
- Dev3D.RenderState.Lighting = False
- Dev3D.RenderState.CullMode = Cull.Clockwise & Cull.CounterClockwise
- End Sub
- Public Sub Load_DirectX()
- Init_DirectX()
- For i = 1 To 30
- b(i) = New Bild
- t(i) = New Text
- Next
- AddHandler tm.Tick, AddressOf DirectX_RenderTimer_Tick
- tm.Interval = 100
- tm.Start()
- End Sub
- Private Sub Directx_Render()
- Dev3D.Clear(ClearFlags.Target, Color.Black.ToArgb, 0, 1)
- Dev3D.BeginScene()
- If text_bool = True Then
- For i = 1 To text_zahler
- text_laden(t(i).text_t, t(i).text_c, t(i).text_x, t(i).text_y, t(i).text_f, t(i).text_g)
- Next
- End If
- If bmp_bool = True Then
- For i = 1 To bild_zahler
- bild_laden(b(i).bmp_b, b(i).bmp_x, b(i).bmp_y, True)
- Next
- End If
- Dev3D.EndScene()
- Dev3D.Present()
- End Sub
- Public Sub bild_laden(ByVal bmp As Bitmap, ByVal x As Integer, ByVal y As Integer, ByVal a As Boolean)
- If a = False Then
- bild_zahler += 1
- b(bild_zahler).bmp_b = bmp
- bmp_bool = True
- End If
- Dim tSprite As New Sprite(Dev3D)
- tSprite.Begin(SpriteFlags.AlphaBlend)
- Dim tTexture As New Texture(Dev3D, bmp, Usage.SoftwareProcessing, Pool.Managed)
- tSprite.Draw2D(tTexture, New Point(0, 0), 0, New Point(x, y), Color.White)
- tSprite.End()
- tSprite.Dispose()
- tTexture.Dispose()
- End Sub
- Public Sub text_laden(ByVal text As String, ByVal farbe As Color, ByVal x As Integer, ByVal y As Integer, ByVal Font As String, ByVal grosse As Integer)
- text_zahler += 1
- t(text_zahler).text_t = text
- text_bool = True
- Dim Spr As New Direct3D.Sprite(Dev3D)
- Dim TestSystemFont As New Drawing.Font(Font, grosse, FontStyle.Regular, GraphicsUnit.Pixel)
- Dim TestFont As New Direct3D.Font(Dev3D, TestSystemFont)
- TestSystemFont.Dispose()
- Spr.Begin(SpriteFlags.AlphaBlend)
- Dim TextRect As New Rectangle(x, y, 602, 582)
- TestFont.DrawText(Spr, text, TextRect, DrawTextFormat.Left, farbe)
- TestFont.Dispose()
- Spr.End()
- Spr.Dispose()
- End Sub
- Private Sub DirectX_RenderTimer_Tick()
- Dim result As Integer
- If Dev3D.CheckCooperativeLevel(result) Then
- Try
- Directx_Render()
- Catch ex As Exception
- Dev3D.CheckCooperativeLevel(result)
- End Try
- End If
- Select Case CType(result, ResultCode)
- Case ResultCode.DeviceLost
- Threading.Thread.Sleep(500)
- Case ResultCode.DeviceNotReset
- Dev3D.Reset(present)
- End Select
- End Sub
- Public Class Bild
- Public bmp_b As Bitmap
- Public bmp_x, bmp_y As Integer
- End Class
- Public Class Text
- Public text_t, text_f As String
- Public text_x, text_y, text_g As Integer
- Public text_c As Color
- End Class
- End Class
mfg blacknetworkbit
MFG 0x426c61636b4e6574776f726b426974
InOffical VB-Paradise IRC-Server
webchat.freenode.net/
Channel : ##vbparadise
InOffical VB-Paradise IRC-Server
webchat.freenode.net/
Channel : ##vbparadise