Some info about tutorial:
-All other engines based on CS:DE
-It can work with other dx8 engines like EO3.0 and all others but the modules and some names of classes are different that’s all but the logic behind it is the same.
Special Thanks to: Thomas And Robin (for making these awesome engines)
Chapter 1: Rendering a guiwindow
So here i will explain how to render a guiwindow
The first thing you do is go to modrendering and scroll all the way down.
Then make a sub (in this example we will use DrawTest)
Public Sub DrawTest() Dim X As Long, Y As Long, Width As Long, Height As Long X = GUIWindow(GUI_TEST).X Y = GUIWindow(GUI_TEST).Y Width = GUIWindow(GUI_TEST).Width Height = GUIWindow(GUI_TEST).Height Directx8.RenderTexture Tex_GUI(2), X, Y, 0, 0, Width, Height, Width, Height RenderText Font_Default, "Test Window", (GUIWindow(GUI_TEST).Width / 2) - EngineGetTextWidth(Font_Default, "Test Window"), Y + 5, White End Sub
(GUIWindow(GUI_TEST).Width / 2) - EngineGetTextWidth(Font_Default, “Test Window”) This line of code does the following:
Guiwindow(GUI_TEST).width gets the width of the window ofcourse and he devides that by 2 so half the window.
Then he does Enginetextgetwidth whit fontdefault and for test("Test window) and he also devides that by 2 so this text will be on top of the window and centered
And Directx8.rendertexture TEX_GUI(2),x,y,0,0,width,height,width,height simply renders the image whit the name 2.png from the gui folder.
Warning: make sure you all numbers in gui folder are consecutive.
Now in initialisegui in modgeneral:
' 21 - Test With GUIWindow(GUI_TEST) .X = 300 .Y = 100 .Width = 257 .Height = 152 .visible = False End With
So this just defines the posision and the height and width of the window(picture).
At the end of Public Enum GUIType
Warning: put it above GUI_COUNT
In Public Sub DrawGUI() Add:
If GUIWindow(GUI_TEST).visible Then DrawTest
Chapter 2: Clicking
Here i will talk about how to make windows clickable
Ok so what you wanna do first is test if the window you’ve rendered is actually rendering correctly then go on and follow this
Now in Public Sub HandleMouseUp(ByVal Button As Long)
add this at the end before end select:
Case GUI_TEST Test_mouseup
So this just sends the client to another sub when it sees that GUI_TEST is clicked (mouseup)
(no need to explain it i think)
Public Sub Test_mouseup() Dim X As Long, Y As Long X = GUIWindow(GUI_TEST).X Y = GUIWindow(GUI_TEST).Y If GlobalX > X+35 And GlobalY > Y+54 Then 'Point 1 If GlobalX < X+3 And GlobalY < Y+23 Then 'Point 2 Call Something End If End If End Sub
So this actually does what it needs to do if you click it
Normally you just put all those coordinates in one if but i devided into 2points and i’ll explain in the picture under this text:
I can add extra Chapters if you want
I hope you all enjoyed this tutorial and i hope it’s usefull it’s pretty basic but i didn’t wanna make it too hard for a first tutorial on this forum about rendering in dx8.
Please like tutorial if it helped you or if you just like it :)
You can also use Paint.net for coordinates i also use it its very handy you can see pixel coordinates at right bottom. :)