SFML community forums

Bindings - other languages => DotNet => Topic started by: Shadow on June 17, 2014, 07:20:40 pm

Title: VS2103 VB
Post by: Shadow on June 17, 2014, 07:20:40 pm
I am trying to program a RL game and looking for a fast drawing face. I found SFML that can support .net calling so I download and tried it. The progress is slow, but would like to use SFML for it.

Currently, I am running into a font creation problem, I would like to see if anyone had a similar setting like me and able to load the font properly in VB.

Thanks,
Shadow
Title: Re: VS2103 VB
Post by: Nexus on June 17, 2014, 07:54:07 pm
What exactly is the problem?

I think the number of SFML VB programmers is very low, but there are certainly many experienced with SFML.NET and the .NET framework in general.
Title: Re: VS2103 VB
Post by: zsbzsb on June 18, 2014, 05:26:18 am
Well I know VB6 and VB.NET (its where I started before C#)... But as Nexus said, what exactly is the problem? Can you please describe it in full detail and if it is a code issue then please post a complete and minimal example that shows the problem.
Title: Re: VS2103 VB
Post by: Shadow on June 18, 2014, 01:56:00 pm
Thanks Zsbzsb and Nexus.

I just return to home and recompile the code, this time it did not give out any error, but I fond the example use a method to draw text on screen cannot be found. Moreover, the event handler looks like not fired for close.

Here is my code, I just try to make it as simple as possible.

Module TestWithSFML

    Dim WithEvents NewWindow As RenderWindow

    Sub Main()

        Dim NewWindow As RenderWindow = New RenderWindow(New SFML.Window.VideoMode(1024, 768), "My New Window")
        Dim windowsFont As Font
        windowsFont = New Font("tahoma.ttf")
        Dim text = New Text("Hello", windowsFont)
        While (NewWindow.IsOpen())

            NewWindow.DispatchEvents()
            text.Position = New SFML.System.Vector2f(250.0F, 450.0F)
            text.Color = New Color(255, 255, 255, 170)

        End While


    End Sub

    ''' <summary>
    ''' Function called when the window is closed
    ''' </summary>
    Sub App_Closed(ByVal sender As Object, ByVal e As EventArgs) Handles NewWindow.Closed
        Dim window = CType(sender, RenderWindow)
        window.Close()
    End Sub

    ''' <summary>
    ''' Function called when a key is pressed
    ''' </summary>
    Sub App_KeyPressed(ByVal sender As Object, ByVal e As KeyEventArgs) Handles NewWindow.KeyPressed
        Dim window = CType(sender, RenderWindow)
        If e.Code = Keyboard.Key.Escape Then
            window.Close()
        End If
    End Sub

End Module
 

Thanks.
Shadow
Title: Re: VS2103 VB
Post by: zsbzsb on June 18, 2014, 02:18:08 pm
You should take another look at the official tutorials and examples. You need to call clear / draw (on your text object) / display every frame or nothing will be displayed on the screen.
Title: Re: VS2103 VB
Post by: Laurent on June 18, 2014, 02:35:45 pm
... except the VB example, which is massively outdated.

http://en.sfml-dev.org/forums/index.php?topic=15003.msg110775#msg110775
Title: Re: VS2103 VB
Post by: zsbzsb on June 18, 2014, 03:37:12 pm
Well it isn't anymore  :D
Title: Re: VS2103 VB
Post by: Laurent on June 18, 2014, 04:11:26 pm
Quote
Well it isn't anymore  :D
... in the latest development revision.
Title: Re: VS2103 VB
Post by: Shadow on June 18, 2014, 04:51:15 pm
I will try to look into some video to see how I can proceed.

Thanks for comment.

Shadow