Tutorial: Dark GDK.NET in VC# 2012

This is a tutorial based off of one made for Visual Studio 2010, which can be found here.

Step 1: Moving the Dark GDK.NET Template

Once you’ve installed Dark GDK.NET head over to the template found in:

My Documents/Visual Studio 2008/Templates/ProjectTemplates/Visual C#/

Copy and paste the .zip file into the Visual Studio 2012 equivalent.

image

Step 2: Create a New Project in Visual Studio 2012

Start up Visual Studio 2012 and create a new project and you should find the Dark GDK template.

image

Step 3: Reloading Dark GDK References

When you start up, Dark GDK’s references haven’t loaded properly, as you’ll see below:

image

Right click on each of them and select ‘Remove’ to get rid of them. We’re going to manually add them.

Right click on ‘References’ and click ‘Add Reference’. We’ll first add DGDKLib. You’ll find it here:

image

Now we just need Dark GDK and Dark GDK Plugins. The problem with these two is that they don’t show in the reference manager, meaning we’ll have to add them manually. So go to ‘Add Reference’ again, but this time hit ‘browser’ and we can add both of them, which can be found at these 2 directories:

C: Windows/assembly/GAC_32/DarkGDK/[version number]/DarkGDK.dll/

C: Windows/assembly/GAC_32/DGDKPlugins/[version number]/DGDKPlugins.dll/

Once you’ve got them both, just make sure they’re selected and hit OK.

image

Step 4: Setting Up .NET Framework

The project will be created in VS 2012 for .NET 4.0 but we need it to run from 3.5. This is actually pretty simple. Right click on your project and hit Properties.

image

Then just change ‘Target Framework’ from 4.0 to 3.5

image

Then it’ll take a couple of seconds to switch. Now you can hit compile.

image

Open up the project file and code to your heart’s content.

Optional Step: Don’t like Windows Forms?

This is an extra step for people who want to run the project outside of Windows Forms.

Open up fMain.cs[design] by double clicking it in the solution explorer.

image

Click on the DarkGDK object inside of the form, look at the Properties pane and scroll down until you get to Dark GDK. Turn ‘Embedded’ off. You’ll notice other useful settings you might be familiar with from using Dark Basic Pro.

image

That’ll get Dark GDK running outside of the Windows Form window, but the Window will still be there. Double click on the Windows Form itself (not the Dark GDK object) and it’ll open up a bit of code and that code determines the behaviour of the Windows Form. What you’ve just done is created a behaviour for when the Windows Form loads, hence fMain_load.

image

Inside of that method between the two curly braces add this line:

image
And what that does is minimalizes the Windows form on start up so that it is out of your way.
Advertisements

10 comments

  1. Windows Forms are essentially the UI components of C#/VB, the template for Dark GDK uses Windows Forms, there are examples that do away with it completely in the Dark GDK.NET directory, but I’ve not looked to see how to start the Dark GDK engine without using Windows Forms, but there are some examples in the DarkGDK.NET directory without it – you could potentially use one of them to start your own project. Dark GDK is actually a Windows Form ‘object’, like having a rich text box, a label or even a browser, the little bit at the end of the tutorial shows you how to make Dark GDK.NET run outside of the default window and to minimise that window.

    The advantage to using Windows Forms here would be if you wished to develop a tool, for example if you wanted to make a level editor and use the Windows UI, kind of like using a GUI plugin in Dark Basic Pro (like MapScape used). For a game, you could use the Windows form as the game Window if you wished, if you told it to go fullscreen using the fullscreen command it will, it’s just you won’t be able to control the resolution when the game is windowed.

    Also, this sadly does not work with Visual Studio 2012 for Windows 8 – it might be possible to get Dark GDK.NET to work, but it might take a lot of tweaking as Windows 8 Apps work differently to desktop applications. I am not sure how it would be done, but then I’ve barely touched anything.

    • “””but it might take a lot of tweaking as Windows 8 Apps work differently to desktop applications. I am not sure how it would be done, but then I’ve barely touched anything.”””

      Oh no not planning to make an app more for desktop app… I will have to conform to WIN8 standards for an app lol this is confuzzling

      Thanks… I will hopefully find time to follow the tutorial and see what I can setup…

      • it is only £22.79 including VAT… so is it better than using DBP and why? I may consider getting it tomorrow depending on how informed I become 🙂 thanks buddy! hopefully I can get this working by tomorrow… should I buy it, just got a dinner I really want to go to but eugh… I am all for .NET and C# so do not worry about trying to convince me 🙂

      • oh another question, because I will be using .NET C# etc. does that not mean I can add my own elements on top of GDK/DBP functions or am I totally confuzzled?

    • In regards to your question about adding your own elements, what do you mean? Creating your own classes?

      Or do you mean things added into C#, for example using the XML framework with Dark GDK.NET. The answer is yes for both. I have my own Animation class, which just stores the frames of an object’s animation but makes life a lot easier, I also have a ‘Player’ class, which stores all sorts of data from inventory items to even the player model, because unlike DBP/Dark GDK, Dark GDK.NET doesn’t actually use model IDs but actually has model classes, same applies for all other media. For example, I could have myObject.Position.X instead of Object Position X(num).

      And I am also using XML for storing data in my project and it’s working just fine, so I am having no trouble using any external libraries. If you’re thinking something like PhysX on the other hand, I would not know – I suspect there would be issues as far as data types go – I guess it might be possible to find a way around it. With something like XML, it’s just strings, floats and integers anyway.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s