Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

http://img716.imageshack.us/img716/8881/blurrytext.jpg

 

Thanks to ThePentiumGuy I have this base rendering class down here but I cant seem to get the text or other sprites to come out clear in windowed mode.

 

Is there some simple viewport style that I can use?

 

Windows 7 Ultimate 64-bit

Visual Studio 2008

DirectX 10 SDK

 

       Public D3Ddev As Device = Nothing
       Public D3Dpp As PresentParameters = Nothing
       Public DP As DisplayMode = Nothing
       Public GameOver As Boolean
       Public Sub Start(ByVal TargetForm As Form, ByVal FullScreen As Boolean)
           Game.MainForm = TargetForm
           Game.Fullscreen = FullScreen
           If FullScreen = True Then
               DP.Width = 800
               DP.Height = 600
               DP.Format = Format.R5G6B5
           Else
               DP = Manager.Adapters.Default.CurrentDisplayMode
           End If
           D3Dpp = New PresentParameters
           D3Dpp.BackBufferFormat = DP.Format
           D3Dpp.BackBufferWidth = DP.Width
           D3Dpp.BackBufferHeight = DP.Height
           D3Dpp.SwapEffect = SwapEffect.Discard
           D3Dpp.PresentationInterval = PresentInterval.Immediate
           If FullScreen = True Then
               D3Dpp.Windowed = False
           Else
               D3Dpp.Windowed = True
           End If
           D3Ddev = New Device(Manager.Adapters.Default.Adapter, DeviceType.Hardware, TargetForm.Handle, CreateFlags.SoftwareVertexProcessing, D3Dpp)
           D3Ddev.Transform.View = Matrix.OrthoOffCenterLH(0, DP.Width, DP.Height, 0, 1, 10)
           D3Ddev.RenderState.Lighting = False
           Game.DisText = New clsText(D3Ddev)
       End Sub

       Public Sub RenderScene()
           Do While Not GameOver
               D3Ddev.BeginScene()
               D3Ddev.Clear(ClearFlags.Target, Color.FromArgb(33, 33, 33), 0, 0)

               '/////// Draw Space
               'D3Ddev.Transform.World = Matrix.Translation(0, 0, 0)
               'Alex.Render()

               Game.DisText.Drawtext("Apple", Color.White, 0, 0)

               'D3Ddev.Transform.World = Matrix.Translation(0, 0, 0)

               D3Ddev.EndScene()
               D3Ddev.Present()
               Game.CheckKeys()
               Application.DoEvents()
               Call FPS()
           Loop
           Terminate()
       End Sub

 

    Public Class clsText
       Public pDevice As Device
       Public TheFont As Font = Nothing
       Public Rect As New Rectangle(0, 0, 0, 0)
       Public S As Direct3D.Sprite
       Public Y, X As Integer

       Public Sub New(ByVal pDevice As Device, Optional ByVal FontName As String = "Courier New", Optional ByVal Size As Integer = 18)
           TheFont = New Font(pDevice, New System.Drawing.Font(FontName, Size))
           S = New Sprite(pDevice)
           Y = 0
       End Sub

       Protected Overrides Sub Finalize()
           S = Nothing
           TheFont = Nothing
           Rect = Nothing
       End Sub

       Public Sub Drawtext(ByVal text As String, ByVal cColor As System.Drawing.Color, ByVal X As Integer, ByVal Y As Integer)
           S.Begin(SpriteFlags.AlphaBlend Or SpriteFlags.SortTexture)
           TheFont.DrawText(S, text, X, Y, cColor)
           S.End()
       End Sub
   End Class

  • Leaders
Posted

Hmmm... I know a lot more about XNA than MDX. Sorry if it seems like a silly question, but does the size of your back buffer match the client size of the output window?

 

It looks like it is scaling the output down with a nearest neighbor interpolation.

[sIGPIC]e[/sIGPIC]

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...