[Tutorial] Plugin on the Qt5
#1

Warning! I am Russian and my English very bad, therefore i use translate.******.com.
Warning 2! You should read the topic: Plugin development guide


Why Qt?
+ crossplatform development
+ convenient tools
But!
- this requires adjustment SDK
- i don't testing this on Linux
- i testing this only with mingw32 compiler

Step 0. Install Qt 5 (i use 5.2.1)
Qt Project Home
Download Qt library and Qt Creator (I use mingw32)

Step 1. Create new project
File -> New File or Project -> Libraries -> C++ Library


Step 2. Add SDK to project
- Copy SDK folder to Project folder
- Right click to project and choose Add Existing Files

- Add all SDK files

- Right click to project and choose Add New... -> General -> Text File
Add DEF file (sampplugin.def)


Step 3. Edit SDK and include in project
- Open SDK/amx/amx.h
After 66 line write this:
Code:
#include <windows.h>
Result:
Code:
      
#if defined __WIN32__ || defined _WIN32 || defined WIN32
        #include <windows.h>
        typedef __int64	          int64_t;
        typedef unsigned __int64  uint64_t;
- Open pro file (sampplugin.pro)
Add anywhere
Code:
DEF_FILE = sampplugin.def
- Open def file (sampplugin.def)
Put this:
Code:
EXPORTS
	Supports
	Load
	Unload
	AmxLoad
	AmxUnload
- Open header file (sampplugin.h)
Delete class Sampplugin
- Open cpp file (sampplugin.cpp)
Delete constructor (Sampplugin::Sampplugin())

Step 4. Write a plugin using Plugin development guide

Step 5. Plugin file will require additional dll: libgcc_s_dw2-1.dll, libstdc++-6.dll, libwinpthread-1.dll and all library modules that you used (eg Qt5Core.dll).
Put them in the server root folder
They are in bin folder compiler (eg E:\Qt\5.2.1\mingw48_32\bin)

Warning 3! All this needs to be tested!

P.S. Sorry for the use ****** Translate. Correct me if you see errors.
Reply
#2

Nice tutorial
Reply
#3

Good Tut.
Reply
#4

Example of use:



P.S. This is useless example
Reply
#5

Quote from Qt homepage:
"Qt is a cross-platform application and UI framework for developers using C++"

Why would you need an UI framework when building plugins for SA-MP? Quite pointless if you ask me...
Reply
#6

@ikkentim: It is not only a UI framework. You can do many more with it.
Reply
#7

It's using it to create a graphical interface in the game in the MTA?

PS: If I'm not mistaken topic
Reply
#8

95% of sa-mp server owners host their servers on headless Linux systems. What in the world would be the use of this?
Reply
#9

KingHual : Qt is cross-compatible. And it handles some useful modules such as threading or networking. But the main advantage of Qt is all its modules to design an UI, which is, as you stated, pointless on a LINUX system. What can be done using Qt5 for SA-MP can also be done using RakNet and Visual Studio (2011 and newer).
Reply
#10

Quote:
Originally Posted by S4t3K
View Post
KingHual : Qt is cross-compatible. And it handles some useful modules such as threading or networking. But the main advantage of Qt is all its modules to design an UI, which is, as you stated, pointless on a LINUX system. What can be done using Qt5 for SA-MP can also be done using RakNet and Visual Studio (2011 and newer).
Literally nobody would use Qt for anything other than GUI. That would simply make the plugin bloated.
Reply
#11

Qt is disgusting bloat.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)