Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK .NET / Attach DarkGDK to Windows Form

Author
Message
tehuti2999
11
Years of Service
User Offline
Joined: 9th Nov 2012
Location: United States
Posted: 2nd Dec 2012 00:28
Hello all, I'm new here, I purchaced the DarkGDK.Net and I managed to build a form that opens up the DarkGDK in a boarderless window, from a button on the form. What I want to do is attache the DarkGDK window to the form so that if the form moves the DarkGDK window moves with it on the screen. Now if you look at the code you will see is that I can bring the DarkGDK to the front if I click on the form itself with just a button, but I don't want to have to do this, it should be done automatically so that needs to be corrected as well. I was also playing around with it and I also managed to get the DarkGDK window to display in a Picturebox but for some reason the object did not show up. Also you;ll see that I was playin around with the graphics and stuff so just ignore that part of the code. So can someone help me out that would be great and Thank you in advance.[Imports DarkGDK
Imports DarkGDK.Camera
Imports System.Drawing
Imports System.Drawing.Graphics
Imports System.Windows.Forms

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
DarkGDK.Engine.InitializeGDK() 'this opens the DarkGDK form, the below code is what the DarkGDK does

'Setup Display, Camera
DarkGDK.Display.SetDisplayMode(1920, 1200, 32)
'to take away window take out the WindowStyle.Default and set to 0
DarkGDK.Display.SetWindowLayout(0, 0, 0)

DarkGDK.Display.SetWindowSize(600, 400)
DarkGDK.Display.WindowToFront()
DarkGDK.Core.SyncOn()
DarkGDK.Core.SyncRate(0)
DarkGDK.Camera.DefaultCamera.AutoCamOn()
DarkGDK.Camera.DefaultCamera.BackdropOff()
DarkGDK.Core.DrawToBack()
DarkGDK.IO.File.SetCurrentDirectory("..\..\Form1")

'Build Pyramid
Dim pyramid As DarkGDK.Basic3D.Pyramid
Dim Graphicsstuff As Graphics
Dim PenColor As New Pen(Color.Blue)
Graphicsstuff = Me.CreateGraphics

Graphicsstuff.DrawLine(PenColor, 200, 55, 4, 10)
pyramid = New DarkGDK.Basic3D.Pyramid(1)

'Main Loop
While DarkGDK.Engine.LoopGDK()
DarkGDK.Core.ClearScreen()
Checkkeys(pyramid)
DarkGDK.Text.ShowText(0, 0, DarkGDK.Display.ScreenFPS())
DarkGDK.Core.Sync()
End While
End Sub
Public Sub Checkkeys(ByRef Obj As DarkGDK.Basic3D.Object3D)

If DarkGDK.IO.Keyboard.State(IO.Keys.W) Then
Obj.Move(1)
End If

If DarkGDK.IO.Keyboard.State(IO.Keys.S) Then
Obj.Move(-1)
End If

If DarkGDK.IO.Keyboard.State(IO.Keys.A) Then
Obj.MoveLeft(1)
End If

If DarkGDK.IO.Keyboard.State(IO.Keys.D) Then
Obj.MoveRight(1)
End If
If DarkGDK.IO.Keyboard.State(IO.Keys.Q) Then
Obj.MoveDown(1)
End If
If DarkGDK.IO.Keyboard.State(IO.Keys.E) Then
Obj.MoveUp(1)
End If

End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

DarkGDK.Display.WindowToFront()

End Sub
End Class ]
tehuti2999
11
Years of Service
User Offline
Joined: 9th Nov 2012
Location: United States
Posted: 6th Dec 2012 16:56
Never mind, I figured it out, didn't see the "The Game Creators" folder before which had all the documentation, cause I was gonna complain about that too, but I guess I'll just shut up. Problem fixed.
Qqite
14
Years of Service
User Offline
Joined: 28th Feb 2010
Location: Florida, U.S.
Posted: 5th Jan 2013 05:31
Also, theres a nice little "code" button you can press to make the code you post easier to read

Ventures of the worlds around us are limited only by our imagination.

Login to post a reply

Server time is: 2024-04-24 14:56:45
Your offset time is: 2024-04-24 14:56:45