-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Contributing to Tiled
If you already know a bit of C++, contributing to the Qt version of Tiled is not hard! All you need to do is learn how to use the Git version control system and the Qt application framework. But you can do either as you go along.
Installing Git is going to be a bit different depending on your operating system. If you go to the Git download page, you should be able to find the appropriate link.
While you can use the Git gui to check out the repository, I'm only going to show you the way of the command line here. The Git repository is located here on github.com. You'll find Tiled at http://github.com/bjorn/tiled.
To make a local copy of this repository, use the command advertised there:
git clone git://github.com/bjorn/tiled.git
cd tiled
git logAs the last command shows, this not only gives you a local copy of the source code, but also includes all the development history, allowing you to browse the history quickly and find out what happened until now.
- On Linux, make sure
g++is installed. - On Windows, I'd recommend getting the Qt package that includes MinGW (available since Qt 5.0.1).
- On MacOS X, I believe you need to install Xcode.
Get Qt from http://qt-project.org/downloads. The default package ships with Qt Creator, which provides an easy way to compile & run Tiled, as well as being a powerful IDE for making changes to Tiled.
Tiled also depends directly on zlib for supporting compression. On Debian and Ubuntu, zlib can be installed as follows:
sudo apt-get install zlib1g-devOn Windows there is no need to install zlib because Tiled can rely on the functions exported from the Qt Core library.
Once you have everything installed, you should be able to just open tiled.pro in Qt Creator. If Qt Creator did not auto-detect your Qt libraries, set those up in the preferences (under Build & Run -> Qt Versions, and then set up a Kit for it and add this kit in the 'Projects' mode). Then, make sure the run target is set to 'tiled' and not one of the other applications shipping with Tiled. Finally you can press the Run button to have it compile and run the application.
If you prefer to stick with the command line, you'll find that you can compile and run Tiled using the following commands:
qmake # Generate the Makefiles
make # Compile Tiled
bin/tiled # Run TiledNote that on some systems the qmake command is not available (or may default to Qt 3, which Tiled does not compile against). In that case, use qmake-qt4, qmake-qt5 or whatever else is appropriate for your system.
Since the libraries and the structure of Qt have changed with the new release there are some more dependencies to be resolved. Once Tiled is being run out of Qt Creator it will work out of the box, but if you try to run it by directly invoking the executable errors will pop up. You have to copy and paste the following dll files from the QT_DIR\5.0.1\mingw47_32\bin directory into the root directory where the executable can be found:
icudt49.dllicuin49.dllicuuc49.dlllibEGL.dlllibgcc_s_sjlj-1.dlllibGLESv2.dlllibstdc++-6.dlllibwinpthread-1.dllQt5Core.dllQt5Gui.dllQt5OpenGL.dllQt5Widgets.dll
To use the delay-loaded dlls you have to copy the files from QT_DIR\5.0.1\mingw47_32\plugins\imageformats to plugins\imageformats. It is recommended to include all files without the d suffix that is using qjpeg.dll and not qjpegd.dll.
Since Qt 5 you have to copy qminimal.dll and qwindows.dll from QT_DIR\5.0.1\mingw47_32\plugins\platforms to plugins\platforms. The last file to be created is qt.conf in the root directory with the following contents
[Paths]
Plugins = plugins
Translations = translations
- Get the latest Tiled source code from github
- Install "Microsoft Visual Studio Express 2013 with Update 3 for Windows Desktop" - http://www.visualstudio.com/en-us/downloads/download-visual-studio-vs
- Use the Qt Online Installer for Windows from http://qt-project.org/downloads, unselect everything but "Qt 5.3 - msvc2013 64-bit OpenGL"
- Open tiled.pro in Qt Creator, it should suggest setting it up with the default kit with Qt 5.3 and VS 2013. - Select 'tiled' in the target selector (above the Run button), optionally select 'Release' for a faster version, then press Run.
Edit the code using your favourite editor. While you're at it, always feel free to ask questions on the mailing list or on the IRC channel, see the relevant links on the website.
Once you think your change is ready, you need to create a commit. Before you create your first commit, you should tell Git who you are. You can do so as follows:
git config --global user.name "Real Name Surname"
git config --global user.email "your.email@domain"This information is stored with each commit you make, and makes sure we all know who the author of the change was later on. Note that Git does not have a concept of user accounts, as is common in centralized version control systems like Subversion.
Now, before you commit, it is generally a good idea to look at the output of git status. This might look something like this:
[bjorn@thor tiled-qt]$ git status
# On branch master
# Changed but not updated:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: src/mapscene.cpp
# modified: src/src.pro
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# src/smartbrush.cpp
# src/smartbrush.h
Here, Git says that you have modified the files mapscene.cpp and src.pro, and introduced two new files unknown to git (smartbrush.cpp and smartbrush.h). To commit these changes, you would do:
git add src/mapscene.cpp
git add src/src.pro
git add src/smartbrush.cpp
git add src/smartbrush.h
git commit
[write commit message in editor that was started]Note that in this case, you could also have done this instead of adding all files individually:
git add -AHowever, this is a bit dangerous, since it adds all files unknown to git, which may include files you don't want to add to version control. Read the output of git status carefully before doing something like that. A safer way would have been:
git add src/smartbrush.{cpp,h}
git commit -aHere, the second line tells Git to add all changes to already tracked files to the commit. I find the easiest way to create a commit, however, to be git gui. This allows you to interactively select the parts you want to be part of your commit, review those changes before you commit, and to write your commit message.
Generally this guide should have all you need to know for the github workflow:
https://help.github.com/articles/using-pull-requests/
Alternatively, feel free to e-mail me raw patch files produced with git format-patch if this has your preference.
Happy coding!
Quick Links: Download on itch.io • Tiled Manual • Support Tiled Development