Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (AndrewAMD, Aku_Aku, ozgur), 1,095 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Re: C-Lite and wxWidgets [Re: Shadow969] #216424
07/16/08 23:55
07/16/08 23:55
Joined: Dec 2007
Posts: 69
Kasey_Dee Offline
Junior Member
Kasey_Dee  Offline
Junior Member

Joined: Dec 2007
Posts: 69
Add another interested person to your list.

Re: C-Lite and wxWidgets [Re: Kasey_Dee] #216471
07/17/08 08:36
07/17/08 08:36
Joined: Dec 2003
Posts: 1,225
germany
gri Offline
Serious User
gri  Offline
Serious User

Joined: Dec 2003
Posts: 1,225
germany
hi,

me too.

,
gri


"Make a great game or kill it early" (Bruce Shelley, Ensemble Studios)
Re: C-Lite and wxWidgets [Re: gri] #216526
07/17/08 12:23
07/17/08 12:23

F
Fear411
Unregistered
Fear411
Unregistered
F



i am also interested

Re: C-Lite and wxWidgets [Re: ] #216558
07/17/08 15:45
07/17/08 15:45
Joined: Jul 2008
Posts: 894
T
TechMuc Offline OP
User
TechMuc  Offline OP
User
T

Joined: Jul 2008
Posts: 894
Okay, I'm very busy with my own project, therefore just a small introduction, the real tutorial will be released in ~1 week.
Sorry for the delay (if you want to be able to create a windows application with 3DGS the code below will allow it for you. Download the Documentation from http://docs.wxwidgets.org/stable/ - this is a very good reference - use it - and use your own brain. If you really want to develop with Windows-User Interface the hints given in the tutorial will be enough :P wink

If you have a question, just ask, I'll help.


Windows Interfaces and 3D-Gamestudio



PRENOTES: This Tutorial is NOT for absolute beginners. You must have knowledge in C++, you should have already a little bit experience with Visual Studio, or maybe even created a DLL. I'm German, therefore my English is not the best (Honestly this is my first english tutorial ever - honestly this is one of my first tutorials ever..-^^ i hope you understand everything). I use German software therefore also the screenshots are in German.


1) Programs / API

There are many available Windows-User-Interface API's outside. Many are used in famous Tools like for example wxWidgets which is used in Audacity or GDK+ which is used in GIMP. After searching through the web I decided to use wxWidgets because of very easy implementation, wonderful help tools and good documentation. Addionally it is platform independent and can therefore run on Mac and Linux (of course not very important for 3D-Gamestudio users).

1)For implementing wxWidget into your project you first have to download the wxWidgets API from http://www.wxwidgets.org . Install the WxWidgets API in a folder of your choice (in the following C:\wx2).
2)Even with wxWidgets the Design of Menus isn't that easy. Therefore there are many Programs in the web to design nice Graphical User-Interfaces with wxWidgets. I decided to use wxFormbuilder. It is free and easy to use. Additionally it supports many Addons and plugins for wxWidgets. You can download the Program from http://wxformbuilder.org.
3)There are many additions for wxWidgets. The most useful ones are collected on the site of wxformbuilder. If you want to develop profesional programs they might help you lots. Download them from http://wxformbuilder.org/?page_id=30
4)Of course you also need a c++ compiler. I work with Microsoft Visual Studio 2005 and will describe everything in this Tutorial for this compiler. You can get the express Version of Microsoft Visual Studio for free. Download it from http://www.microsoft.com/germany/Express . Or search Google for Microsoft Visual Studio 2008 Express Edition.


2) Setup Visual Studio

At first you have to create a new Project with Microsoft Visual Studio (File->New->Project). As type you have to choose Win32-Project. As we want to develop a DLL for you Engine Application you must choose "DLL" as application use (normally found in the tab application settings ("Anwendungseinstellungen"). Check the option "Create empty project" ("Zusätzliche Optionen"->"Leeres Projekt"). Click Finish and add a CPP file to your project (right click on "source files" in the right tab, add -> New element -> Cpp file).

Now you have to configure Microsoft Visual Studio C++ Project Settings. Open the Project Settings (Project->%Project name% Settings).
Click “configure settings”.
Important settings:
  • configuration type = DLL
  • font/character set = Not known / not defined


Next go to C/C++ --> General and setup the include paths:

  • C:\wx2\include
  • C:\wx2\lib\vc_lib\mswd
  • C:\wx2\additions\lib\vc_lib
  • C:\wx2\additions\include
  • C:\GStudio7\sdk_plugin


(of course you have to use your own paths).

No you have to setup the Library Paths. Goto “linker” (sorry don't know the english word. The tab below C/C++) --> general
These are the additional include folders:

  • C:\Programme\GStudio7\sdk_plugin
  • C:\wx2\additions\lib\vc_lib
  • C:\wx2\lib\vc_lib


At last you have to add the needed librarys. Go to “Linker” --> Commandline and add the following libraries in the text field:

user32.lib gdi32.lib comdlg32.lib comctl32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib rpcrt4.lib adll.lib wsock32.lib wxbase28d.lib wxmsw28d_core.lib wxmsw28d_propgrid.lib wmpio.lib


3) Write the Main.cpp


This is the “main” cpp file.

Code:
// Include the usual Windows headers
#define WIN32_LEAN_AND_MEAN		
#include <windows.h>
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
#include <process.h>

#define DLL_USE

#include "adll.h"

// for compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"

#ifdef __BORLANDC__
    #pragma hdrstop
#endif

// for all others, include the necessary headers
#ifndef WX_PRECOMP
    #include "wx/app.h"
    #include "wx/log.h"
    #include "wx/frame.h"
    #include "wx/menu.h"

    #include "wx/button.h"
    #include "wx/checkbox.h"
    #include "wx/listbox.h"
    #include "wx/statbox.h"
    #include "wx/stattext.h"
    #include "wx/textctrl.h"
    #include "wx/msgdlg.h"
#endif

#include "wx/sysopt.h"
#include "wx/bookctrl.h"
#include "wx/sizer.h"
#include "wx/colordlg.h"
#include "wx/fontdlg.h"
#include "wx/textdlg.h"

BOOL APIENTRY DllMain( 
  HANDLE hModule,
  DWORD ul_reason_for_call,
  LPVOID lpReserved)
{
  engine_bind();
  return TRUE;
}


This code includes all needed files for a 3D-Gamestudio DLL and wxWidgets.


4) Design a Menu with wxFormBuilder
(sorry still in German)


Bevor wir das Menü inkludieren können müssen wir es natürlich noch designen wink Also einfach wxFormbuilder mal öffnen.
Jedes Element eines Menüs muss natürlich einem Fenster untergeordnet werden. Das Haupt-Fenster kann entweder ein Frame / ein Dialog oder ein Panel sein. Alle haben ihre eigenen Eigenschaften, so hat zum Beispiel ein Panel per Default keine Titelleiste.
Normalerweise wählt man als Hauptfenster einen Frame! Dieser ist unter dem “Forms” Tab zu finden. Nach dem anklicken findet ihr Rechts immer alle Eigenschaften. Sollte alles selbsterklärend sein.
Wichtig ist nun wie man weitermacht. In wxwidgets wird ein Fenster über so genannte Sizers designt (diese findet ihr alle unter dem Tab “Layout”).

Diese Sizer solltet ihr unter dem Tab Layout finden. Jedes Element unterhalb des Hauptframes muss in einem Sizer gesetzt werden.
Ein Sizer ist eine Art Tabelle für alle Elemente (so wie so bei wxForumbuilder auch aufgezeichnet ist).

Beispiel Sizer 1: Das erste Objekt wird über dem zweiten gesetzt. Das zweite über den dritten usw.
Beispiel Sizer 3: Das erste Objekt ist links von den zweiten. Das Dritte Objekt ist unter dem ersten.



As it will last one week here are the most important parts of the code so that you can learn design with wxWidgets on your own.. wink As already said I'll release the tutorial in the next week

You will NOT be able to copy&paste the code but it'll help you.

Code:

//overwrite the default Application Class
class MyApp: public wxApp
{
	virtual bool OnInit(); //will be executed when wxWidgets is inited
	virtual int OnExit(); //will be executed when wxWidgets ends
};

int MyApp::OnExit()
{
	ShowWindow(ev->hWnd,SW_SHOWNORMAL);
	return 0;
}

bool MyApp::OnInit()
{
	frame = new wxFrame( (wxWindow*)0 ); //Main Frame, designed with wxFormBuilder
        ev->hWndTarget = (HWND)EnginePanel->GetHWND(); //The Panel where the Engine should be included
	frame->Show(TRUE);
	SetTopWindow(frame);
	ShowWindow((HWND)frame->GetHWND(),SW_SHOWNORMAL);
	ShowWindow(ev->hWnd,SW_MINIMIZE); //minimize old window

	return TRUE;
}

//inform wxWidget that the MyApp Class has to be created after wxEntry
IMPLEMENT_APP_NO_MAIN(MyApp) 

void wx_start_thread(void* i)
{
       //wxEntry starts wxWidgets
	wxEntry((HINSTANCE) ev->hInstance, (HINSTANCE)0, (wxCmdLineArgType)0, (int)0);
}


//call this function in Lite-C
DLLFUNC int Start()
{
        //wxwidgets has to be created in another thread...
	_beginthread(wx_start_thread,0,(void*)0);
	return 1;
}



So again sorry for the delay, I'll answer every upcoming question.

PS: surreptitious advertising wink



Last edited by TechMuc; 07/17/08 16:13.
Re: C-Lite and wxWidgets [Re: TechMuc] #217266
07/22/08 11:50
07/22/08 11:50
Joined: Aug 2002
Posts: 3,258
Mainz
oliver2s Offline
Expert
oliver2s  Offline
Expert

Joined: Aug 2002
Posts: 3,258
Mainz
Thank you smile I think this will help many users including me. Very nice contribution.

Re: C-Lite and wxWidgets [Re: oliver2s] #217278
07/22/08 13:07
07/22/08 13:07
Joined: Oct 2007
Posts: 5,210
Ä°stanbul, Turkey
Quad Offline
Senior Expert
Quad  Offline
Senior Expert

Joined: Oct 2007
Posts: 5,210
Ä°stanbul, Turkey
Thank you, wasn't aware you posted it. waiting for the full tut wink

i guess i need to build wxwidget libraries now.


3333333333
Re: C-Lite and wxWidgets [Re: Quad] #225962
09/06/08 22:15
09/06/08 22:15

F
Fear411
Unregistered
Fear411
Unregistered
F



did you already finished the second part of the tutorial?

Page 2 of 2 1 2

Moderated by  adoado, checkbutton, mk_1, Perro 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1