Jump to: navigation, search

This article explains the use of extensions. To enable them simply select the Build menu in the main menu of LateralGM and select settings. Switch to the "Extensions" tab and enable the installed extensions you wish to enable for your game.

Coding Extensions

Extensions are located in \ENIGMAsystem\SHELL\Universal_System\Extensions\ folder. Extensions comprise an About.ey descriptor, and at least an include.h header and a Makefile.

Typical About.ey:


: Date Time
: DateTime
: Adds date and time functions.
: 09/03/2011
: datetime.png

: None
: None

Typical include.h:

namespace enigma_user
time_t date_current_datetime();
time_t date_current_date();
time_t date_current_time();
time_t date_create_datetime(int year,int month,int day,int hour,int minute,int second);
time_t date_create_date(int year,int month,int day);
time_t date_create_time(int hour,int minute,int second);
int date_get_year(time_t date);
int date_get_month(time_t date);
int date_get_week(time_t date);
int date_get_day(time_t date);
int date_get_hour(time_t date);
int date_get_minute(time_t date);
int date_get_second(time_t date);
int date_get_weekday(time_t date);
int date_get_day_of_year(time_t date);
int date_get_hour_of_year(time_t date);
int date_get_minute_of_year(time_t date);
int date_get_second_of_year(time_t date);

The "namespace enigma_user { }" is used for the functions to be accessible from LGM. So any function inside this namespace can be called from LGM code editor and used in ENIGMA. If functions are declared outside this namespace, then they will not show up in the code editor and will trow a syntax error if used. This is useful when the system is a lot more complicated than just the callable functions and you don't want to interfere with ENIGMAs systems. Like the GUI extension has the whole GUI system coded inside "namespace GUI", so it doesn't conflict with ENIGMA.

include.h will simply be included from SHELLmain.cpp, and can contain anything necessary. But this can cause conflicts, which is why aforementioned namespaces should be used. The makefile can contain compilation flags, libraries and paths needed for the extension to compile. For datetime all the functions are implemented in datetime.cpp, so to compile it the makefile has only one line:

SOURCES += Universal_System/Extensions/DateTime/date_time.cpp
This will compile the .cpp file into .o object and link with it.

For more complicated extensions (like one using OpenCV library) it can look like this:

SOURCES += $(wildcard Universal_System/Extensions/OpenCV/*.cpp)
SOURCES += $(wildcard Universal_System/Extensions/OpenCV/filters/*.cpp)

OPENCV_V := 300
OPENCV_Vd:= 3.0
INCLUDES += -msse3 -I"E:/OpenCV$(OPENCV_Vd)/Build/install/include"
LDLIBS += -L"E:/OpenCV$(OPENCV_Vd)/Build/install/lib" -lopencv_world$(OPENCV_V) -llibjpeg -llibjasper -llibpng -lzlib -llibwebp -llibtiff -lIlmImf
cxxflags += -msse3
Personal tools