It looks like you're new here. If you want to get involved, click one of these buttons!
#include </touhou/orx/include/orx.h>
orxSTATUS Init()
{
orxViewport_CreateFromConfig("Viewport");
orxObject_CreateFromConfig("Object");
return orxSTATUS_SUCCESS;
}
orxPLUGIN_DECLARE_ENTRY_POINT(Init);
Comments
ghost333 wrote:
That's perfectly fine for creating a plugin. (.so as you're using linux)
But, in this case, you'll need to use the orx executable to run it.
Also, as you're compiling a plugin, you need to specify these switches: -shared -fPIC
If you want to build a standalone executable (tutorial #10), you won't need these switches.
That's for the linking part.
Now, you also need to provide all the preprocessor flags. On the 0.9.1 version you have to provide them all:
-D__orxDLL__ -D__orxLINUX__ -D__orxGCC__
If you want to have a better version of orx (easier to use + a lot of new features/bug fixes/optimizations), I'd suggest trying the current svn version. It's what will soon be released as orx v.1.0. If you do so, you will only need the -D__orxDLL__ if you link against the dynamic version, and no flag at all to link against the static version.
Once you use all the flags, you'll also need to provide the library to link against it. You can do that by adding -lorx on the command line.
In the end you should have something like this to create your plugin:
Compile => gcc -c test.c -o test.o -I/touhou/orx/include
(this way you only need to write #include "orx.h", instead of writing the full path.
Link => gcc -shared -fPIC -o test.so test.o -L/touhou/orx/lib -lorx
If you don't feel comfortable with all these flags, you should try getting codelite (http://www.codelite.org) and start by modifying one of the tutorials.
When you have your test.so, edit orx.ini, and find the section [Main]. Assuming you have orx executable and test.so in the same folder, make sure you have this entry:
GameFile = test
If you then run orx (./orx), it should execute your plugin.
Making a plugin gets a fast way to prototype something, but I suggest you make a standalone based on orx for other purposes, this way you won't need orx executable and you'll have more flexibility.
Hope this helps!
Tell me if you have any other trouble!
- iarwain
But now i ran into another problem....
I decided to use the config files and see what i can do.
So..
[markos@localhost bin]$ ls -l
total 1392
-rw-rw-rw- 1 1000 users 10119 2008-10-17 08:19 CreationTemplate.ini
-rw-rw-rw- 1 1000 users 1115480 2008-10-21 07:36 liborxd.so
-rw-rw-rw- 1 1000 users 221188 2008-10-21 07:36 liborx.so
-rwxrwxrwx 1 1000 users 6632 2008-10-21 07:36 orx*
-rwxrwxrwx 1 1000 users 22175 2008-10-21 07:36 orxd*
-rw-rw-rw- 1 1000 users 923 2009-03-23 01:42 orxd.ini
-rw-rw-rw- 1 1000 users 885 2009-03-23 02:03 orx.ini
-rw-rw-rw- 1 markos markos 885 2009-03-23 02:03 orx.ini~
drwxrwxrwx 2 1000 users 4096 2009-03-23 01:38 plugins/
-rw-rw-rw- 1 1000 users 4017 2008-09-27 21:00 SettingsTemplate.ini
-rwxr-xr-x 1 markos markos 5485 2009-03-23 02:02 test.so*
[markos@localhost bin]$ ./orx
./orx: error while loading shared libraries: liborx.so: cannot open shared object file: No such file or directory
[markos@localhost bin]$
i cant use the executable....????
So, basically, you need to change your library path so that orx can find liborx. Even if they're in the same folder.
Before launching orx, go to its folder and type:
export LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH
That should do it. Again, you don't have to bother with this when using the latest orx version from the svn.