Jump to content
Xtreme .Net Talk

EK1

Avatar/Signature
  • Posts

    30
  • Joined

  • Last visited

Everything posted by EK1

  1. EK1

    ScaleTransform

    I'm using the CFont class to draw text and D3DXVECTOR2 to draw lines.
  2. EK1

    ScaleTransform

    I basically have a map hud in a viewport, I would like to zoom in and out.
  3. EK1

    ScaleTransform

    I'm actually using a Viewport, have any suggestions on how I could scale using a viewport?
  4. Is there an equivalent DirectX function to the GDI+ function ScaleTransform?
  5. Is there a simple way to zoom or scale in DirectX using a viewport? I'm drawing 2d objects using lines and text.
  6. Has anyone created a device using Direct3D.Device(lp as IntPtr)? Is this a new IntPtr or from an existing device?
  7. I saw this code posted on another forum but I can't get it to work. Can someone test this and see if it works for them? Imports System.Runtime.InteropServices Public Class Form1 Inherits System.Windows.Forms.Form <StructLayout(LayoutKind.Sequential)> _ Public Structure rect Dim left As Int64 Dim top As Int64 Dim right As Int64 Dim bottom As Int64 End Structure Public Declare Function DrawFrameControl Lib "user32" (ByVal hDC As Int32, ByRef lpRect As IntPtr, ByVal un1 As Int32, ByVal un2 As Int32) As Int32 Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs) Dim rectTest As rect With rectTest .left = 20 .top = 10 .right = 900 .bottom = 900 End With Dim rectPointer As IntPtr = Marshal.AllocCoTaskMem(Marshal.SizeOf(rectTest)) Marshal.StructureToPtr(rectTest, rectPointer, True) Dim myDC As System.Drawing.Graphics = Graphics.FromHwnd(Me.Handle) Dim ptrHDC As IntPtr = myDC.GetHdc Dim i As Int32 = DrawFrameControl(ptrHDC.ToInt32, rectPointer, 1, 2) myDC.ReleaseHdc(ptrHDC) myDC = Nothing End Sub End Class
  8. Yes that's the problem, I just figured it out. It especially comes up if you have a hyperthreaded cpu.
  9. In form load testthread = New Thread(AddressOf test) testthread.Name = "test" testthread.Start() Private Sub test() Dim a As String = "wrew" Me.Text = "Test" 'crashes here TextBox1.Text = "test" Debug.WriteLine("test") End Sub This code works fine on my other PC and timers work fine.
  10. Anyone figure out what this issue is? I have the same problem.
  11. Managed DirectDraw I meant. Do you know how to mix DirectDraw with Direct3D?
  12. Is it possible to draw on a Direct3DDevice8 using DirectDraw 9?
  13. This is pretty good but eats up cpu, I also tried Private BackSurface As Direct3D.Surface dev.BeginScene() Dim window As Bitmap = New Bitmap(rect.Width, rect.Height) 'bitmap to hold graphics Dim surface As Graphics = Drawing.Graphics.FromImage(window) 'holds graphics till ready to blit surface.DrawLine( _ New System.Drawing.Pen(System.Drawing.Color.Black), _ 0, _ 0, _ 1, _ 1 _ ) BackSurface = BackSurface.FromBitmap(dev, window, Pool.Default) dev.StretchRectangle(BackSurface, New Rectangle(0, 0, AForm.ClientRectangle.Width, AForm.ClientRectangle.Height), BackBuffer, New Rectangle(0, 0, AForm.ClientRectangle.Width, AForm.ClientRectangle.Height), TextureFilter.None) 'this is where the surface is copied to the backbuffer dev.EndScene() dev.Present() This is also cpu intensive. What I would like to do is use DirectDraw to draw all the circles and squares then some how present that on the direct3d device. Anyone have any idea how to do that?
  14. Sorry not DXSpy, I meant D3DSpy.
  15. I'm trying to get DXSpy to work with the samples in the SDK. I thought I need to register the window but that still doesn't work. Any ideas on why DXSpy doesn't work?
  16. markbiddlecom do you have any sample code on how to do this?
  17. I created a window using API's instead of Windows.Forms. I like your idea though. Is something like that possible?
  18. Is there a way to use SetCooperativeLevel with a window handle instead of using System.Windows.Forms.Control in .NET?
  19. Are you saying this makes the surface transparent? If so could you post the whole class or program?
  20. Is there a way to draw on top of another process's surface?
  21. EK1

    Help with my code

    I figured it out.
  22. I'm trying to draw a simple square, Public Sub OnCreateVertexBuffer(ByVal sender As Object, ByVal e As EventArgs) Dim vb As VertexBuffer = CType(sender, VertexBuffer) Dim vertices As CustomVertex.TransformedColored() = DirectCast(vb.Lock(0, 0), CustomVertex.TransformedColored()) vertices(0).X = 10 vertices(0).Y = 10 vertices(0).Z = 0.5F vertices(0).Rhw = 1 vertices(0).Color = System.Drawing.Color.Black.ToArgb vertices(1).X = 210 vertices(1).Y = 10 vertices(1).Z = 0.5F vertices(1).Rhw = 1 vertices(1).Color = System.Drawing.Color.Blue.ToArgb vertices(2).X = 10 vertices(2).Y = 210 vertices(2).Z = 0.5F vertices(2).Rhw = 10 vertices(2).Color = System.Drawing.Color.White.ToArgb vertices(3).X = 210 vertices(3).Y = 210 vertices(3).Z = 0.5F vertices(3).Rhw = 10 vertices(3).Color = System.Drawing.Color.Red.ToArgb vb.Unlock() End Sub 'OnCreateVertexBuffer Public Sub Render() If dev Is Nothing Then Return End If Try dev.Clear(ClearFlags.Target, Color.Blue, 0, 0) dev.BeginScene() dev.StretchRectangle(BackSurface, New Rectangle(0, 0, 350, 263), BackBuffer, New Rectangle(0, 0, 350, 263), TextureFilter.None) 'this is where the surface is copied to the backbuffer dev.SetStreamSource(0, vbuff, 0) 'set the source for drawing the vertices dev.VertexFormat = CustomVertex.TransformedColored.Format 'the format of the vertex dev.DrawPrimitives(PrimitiveType.TriangleStrip, 0, 1) 'draw dev.EndScene() dev.Present() Catch ex As Exception Debug.WriteLine(ex.Message) End Try End Sub What am I doing wrong? It won't show the forth vertex.
  23. Would you mind sharing the code? I'm trying to do something similar.
  24. How do I do manual double buffering?
  25. FillColor works the same as FillRectangle and FillEllipse. So I'm ok with that. I just need a way to scale now.
×
×
  • Create New...