Oficina Framework  1.3
Games Framework
Installation and Usage

Usage

Controls

If there's a controller connected to the computer, Oficina will detect it as soon as it's initiated. The controls used inside the program are referenced from the Xbox 360 buttons bindings.
Warning: If your controller supports vibration, it'll be activated. The use of vibration and its support detection can be seen on the debugger, as well as a big number of other features.

Debugger

Oficina's internal debugger brings a series of information related to input, screen refresh rate, processor and memory usage (the memory usage is only monitored on Linux system), as well as many other things.
To bring up the debugger, press F1.
To alternate between complete and compact versions, press F2.

Arguments

There are some command line arguments which you can use to setup a few settings.
These arguments can be entered by executing one of the game's startup scripts (e.g. rungame.sh/bat) from the command line (Linux and Windows alike), via a shortcut (Windows), or via another startup script which calls one of the startup scripts with arguments (Linux and Windows alike, too).

Multiplayer

It is possible to play using multiplayer on the current Oficina test build.
It is necessary, though, to enable this resource using a command line or a terminal; The option for this resource on the pause menu is unavailable.
THIS ARGUMENT WILL ONLY RUN ON THE TEST PROGRAM.
On Linux, all you need to do is navigate to the game folder and start it with:

./rungame.sh -networktarget=XXX.XXX.XXX.XXX:PPPP

And on Windows, you can run:

rungame.bat -networktarget=XXX.XXX.XXX.XXX:PPPP

Where XXX.XXX.XXX.XXX is the IP address of the destination computer, followed by the port you wish to deliver your packages on the other player's computer.
You can also specify which port you want to listen to by using the following argument:

./rungame.sh -port=PPPP
rungame.bat -port=PPPP

Where PPPP is the desired port you wish to open.
THIS ARGUMENT WILL ALSO ONLY RUN ON THE TEST PROGRAM.
You can include this and other arguments in the same molds of the network target argument. You can also specify multiple arguments.
Notice that, in some cases, it might be necessary to configure your firewall for the connection to work. Failure on package delivering could be seen on terminal or console, if you execute the program for these means.

Fullscreen

To run the game on fullscreen mode, run Oficina including the fullscreen argument.

./rungame.sh --fullscreen
rungame.bat --fullscreen

On Linux systems, Oficina will attempt to make the window size fit your current native resolution, but internal OpenGL context resolution will remain the same. This is done because of SDL's screen resolution issues when attempting fullscreen with a resolution that is different from your screen monitor's resolution.

Installation

Dependancies

Oficina Framework depends on the following libraries:

  • SDL2 (SDL 2.0)
  • SDL2_image (SDL_image 2.0)
  • SDL2_mixer (SDL_mixer 2.0)
  • physfs (PhysicsFS)
  • OpenGL

Make sure you have these libraries installed when building the library or any application depending on it.
Normally, these libraries will be available on your repository. They are all opensource, so you will not have difficulty trying to find them.
There may be subdependancies on libogg/libvorbis or zlib, so make sure you also install them correctly.

Building

Building Oficina is rather easy.
Having Oficina's source code, navigate to the source folder, and create the required subfolders for building.

$ mkdir bin lib obj

Then, all you need to do is build it with Makefile, using the following command:

$ make

Make sure you are using GCC/MinGW as your compiler, and also make sure you have all the needed dependancies installed.
The objects for building Oficina's static libraries will be stored in obj folder, and the static library itself will be stored in lib.
Notice that, running the command "make" alone will only generate the library with debug mode active (liboficinad.a).
If you wish to build Oficina on Release target, you must run the make command like this:

$ make target=release

This will create liboficina.a on lib/ folder instead.
Make sure to clean the objects generated from the previous compilation, else you may face building problems!
To clean the objects, run:

$ make clean

Test Build Application

You can also build the Test Build application to test Oficina.
To do so, execute the following command:

$ make test

If you wish to run the Test Build application under Release target, add the target flag to the end of this command:

$ make test target=release

Installing

Installing Oficina Framework on a Linux environment is also easy.
All you need to do is navigate to the folder and run:

$ make install

You may need superuser privileges to run this action.
This will build both Debug and Release targets of Oficina and copy them and the required headers to your local prefix' (normally /usr/local) include and lib subfolders.
If you wish to change the prefix to, say, /usr, run the installation using the following command:

$ make install prefix=/usr

Windows users will want to build each target separately, then manually copy the contents of lib/ into their MinGW/lib folder, and also copy both the folder OficinaFramework (the one containing only headers) and the file GonglyScriptStructure.h into MinGW/include.

Uninstalling

You can also uninstall Oficina Framework using the Makefile.
Just run

$ make uninstall

You may need superuser privileges to run this action.
If you installed it on another prefix, say, /usr, then you may also want to explicitly show that to the Makefile by running:

$ make uninstall prefix=/usr

Windows users will want to manually remove both files liboficina.a and liboficinad.a from MinGW/lib folder, the folder MinGW/include/OficinaFramework and the file MinGW/include/GonglyScriptStructure.h.

Building Your Own Application

To build your own application, you must use the correct build flags.
After correctly installing Oficina and its dependancies, you will want to compile your own code like this:

# On Linux
$ g++ --std=c++11 your_source_code_and_objects_here -o output_executable_name -loficinad -lSDL2 -lSDL2_image -lSDL2_mixer -lGL -lphysfs
# On Windows
$ g++ --std=c++11 your_source_code_and_objects_here -o output_executable_name -loficinad -lmingw32 -lSDL2main -lSDL2 -lSDL2_image -lSDL2_mixer -lopengl32 -lwsock32 -lphysfs

Notice the following:

  • Oficina's statically linked through the command -loficinad. Notice that, the presence of the character "d" in the end of the flag refers to a debug compilation. To link for release targets, use the flag -loficina instead.
  • Oficina's linking flags MUST STRICTLY come before the flags shown on the commands above, or else there will be undefined reference errors, although order of the dependancy flags are not important, as long as they come after Oficina's (with exception of the -lmingw32 -lSDL2main flags, which must also come between Oficina's and the rest);
  • Oficina is built under C++11, so your code must also be built under C++11 specification;
  • Oficina's debug static library is built with DEBUG_ENABLED flag active, but it isn't activated by default in your application. To achieve that, add the flag -DDEBUG_ENABLED to your build command.

If you're using an IDE like Code::Blocks, you'll want to configure your building targets to use these linking targets accordingly. This is normally done on C::B by right-clicking the project name on the Projects tree and clicking "Build Options". Creating Defines (like the DEBUG_ENABLED case) can also be done from there.

Command Line Arguments

Any game compiled with Oficina Framework has a number of fixed argument flags that can be run from any application.
These flags are configuration flags, normally for setting framerate and resolution configuration, and are normally used on the Gongly Launcher.
The flags are:

--fullscreen

Sets the window to full screen size.

--resolution=x

Sets both Window Size and Resolution to "x".
Refer to Screen Resolution or Window Size for possible values, as they're strictly related.

--vsync

Enables vertical synchro.
Refer to Enable Vertical Synchro for more details.

--fps=x

Sets default framerate for the application to "x".
Refer to Framerate for possible values.

--diagnostics

Enables system diagnostics, if application was compiled in debug mode and has a font binded to the debug window.

--no_multithreaded_audio

Forces program to run audio loop on the same rendering and logic thread.
This may lower CPU consumption, but may also cause BGM loops to not work properly.

--no-bgm

Mutes ALL background music.

--no-sfx

Mutes ALL sound effects.

--version
-v

Forces application to output which version of Oficina it was compiled with then halts the application.