Windows Forms and ToolBox in A8

Posted By: Giti

Windows Forms and ToolBox in A8 - 07/22/11 14:54

Hi.
i want use WindowsForms whit Tools(Button,ListBox,ComboBox,PictureBox and...) inside my game like this:

but i dont want use AcknexWrapper or any.Because i want run my game with A8 no other compiler.
how?
thanks.
Posted By: Lukas

Re: Windows Forms and ToolBox in A8 - 07/22/11 16:52

This may help:
http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=317762

The second code I posted there creates an other window and the third creates an other window with a button on it. You can create all those controls using the WINAPI on those windows.
This may have some issues though. I think the main window will be updated less frequently, so it seems like frames are skipped.

This method only uses the naked WINAPI. You can't use .net classes or MFC or something like that without a wrapper.


For a GUI for Gamestudio that is better than normal panel buttons, etc. click the "LBGUI" link in my signature.
Posted By: Giti

Re: Windows Forms and ToolBox in A8 - 07/22/11 23:01

thanks man.
its really good.

Thank You.
Posted By: Giti

Re: Windows Forms and ToolBox in A8 - 07/23/11 07:22

can i use Engine , by Child in inside form?
like this:

or this:

How?
Posted By: DJBMASTER

Re: Windows Forms and ToolBox in A8 - 07/23/11 07:34

Option 1) Use the 'hWndTarget' variable to re-direct the renderer to another window. All you need is the HWND (handle) of the window (or control) that you want to render into. More in the manual about this.

Option 2) Use the WinAPI functions SetWindowLong, SetParent, etc to physically embed the child window into another. Might have some problems with threading and input between the two, so you can find functions such as AttachThreadInput, overriding the wndProc, etc to help fix these problems.

If you don't know what a HWND is or whatever, then I suggest you look at a few basic WIN32 tutorials to get an idea just how nasty this stuff is laugh

You'd be far better off with the C# wrapper though laugh
Posted By: Giti

Re: Windows Forms and ToolBox in A8 - 07/23/11 07:58

thanks man.
please show me , option1,2 in code?
"You'd be far better off with the C# wrapper though".its true. but i have a problem.when i save a level in C#wrapper , i can not load the level in A8.Because ENTITYs and FUNCTIONs and Everything is Definition in C#wrapper , not definition in "A8 C" code. so i have create a compiler for convert wrapper code to "A8 C" code for run my game in A8.
please help me.
Posted By: Giti

Re: Windows Forms and ToolBox in A8 - 07/25/11 10:29

help me please.
Posted By: Lukas

Re: Windows Forms and ToolBox in A8 - 07/25/11 11:16

1) is easy. Just put the line
hWndTarget = hwnd1;
right before the message loop in the codes I've shown you. Then the engine will render in the second window we create in that code. Note that it won't adjust the resolution though. So you have to set the resolution to the window size or vice versa.
Posted By: DJBMASTER

Re: Windows Forms and ToolBox in A8 - 07/25/11 11:47

Also you'll need to re-direct the wndProc to the new window and destroy the original window using DestroyWindow.
Posted By: Giti

Re: Windows Forms and ToolBox in A8 - 07/25/11 20:28

thanks guys.
its work!
© 2024 lite-C Forums