summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQuintus <quintus@quintilianus.eu>2013-05-12 06:35:51 (GMT)
committerTony Theodore <tonyt@logyst.com>2013-05-12 06:35:51 (GMT)
commit17fb2b7f6c160a01f86f115c04dbdb9f04a8931e (patch)
treed4018e92c2937dcba960d9adb8a1bd674c2ccd51 /src
parent9e2b2fdba25b70b2e432a2a6690655117e362c1c (diff)
downloadmxe-17fb2b7f6c160a01f86f115c04dbdb9f04a8931e.zip
mxe-17fb2b7f6c160a01f86f115c04dbdb9f04a8931e.tar.gz
mxe-17fb2b7f6c160a01f86f115c04dbdb9f04a8931e.tar.bz2
new package cegui
Diffstat (limited to 'src')
-rw-r--r--src/cegui-test.cpp96
-rw-r--r--src/cegui.mk54
2 files changed, 150 insertions, 0 deletions
diff --git a/src/cegui-test.cpp b/src/cegui-test.cpp
new file mode 100644
index 0000000..88c2cf1
--- /dev/null
+++ b/src/cegui-test.cpp
@@ -0,0 +1,96 @@
+/*
+ * This file is part of MXE.
+ * See index.html for further information.
+ */
+
+/*************************************************
+ * CEGUI demo program. This creates an OpenGL window
+ * and makes CEGUI draw an "in-game" window into it.
+ ************************************************/
+
+#include <GL/freeglut.h>
+#include <CEGUI/CEGUI.h>
+#include <CEGUI/RendererModules/OpenGL/CEGUIOpenGLRenderer.h>
+
+// We’re lazy
+using namespace CEGUI;
+
+// Prototypes
+void main_loop();
+
+// Main program entry point
+int main(int argc, char* argv[])
+{
+ // Initialize OpenGL
+ glutInit(&argc, argv);
+ glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA);
+ glutInitWindowSize(640, 480);
+
+ // Create the default GL context to have CEGUI draw upon
+ int window_id = glutCreateWindow("Test");
+
+ // Initialize CEGUI (will automatically use the default GL context)
+ OpenGLRenderer& renderer = OpenGLRenderer::bootstrapSystem();
+
+ // Tell CEGUI where to find its resources
+ DefaultResourceProvider* p_provider = static_cast<DefaultResourceProvider*>(System::getSingleton().getResourceProvider());
+ p_provider->setResourceGroupDirectory("schemes", "../share/CEGUI/schemes");
+ p_provider->setResourceGroupDirectory("imagesets", "../share/CEGUI/imagesets");
+ p_provider->setResourceGroupDirectory("fonts", "../share/CEGUI/fonts");
+ p_provider->setResourceGroupDirectory("layouts", "../share/CEGUI/layouts");
+ p_provider->setResourceGroupDirectory("looknfeels", "../share/CEGUI/looknfeel");
+ p_provider->setResourceGroupDirectory("lua_scripts", "../share/CEGUI/lua_scripts");
+ p_provider->setResourceGroupDirectory("schemas", "../share/CEGUI/xml_schemas");
+ p_provider->setResourceGroupDirectory("animations", "../share/CEGUI/animations");
+
+ // Map the resource request to our provider
+ Imageset::setDefaultResourceGroup("imagesets");
+ Font::setDefaultResourceGroup("fonts");
+ Scheme::setDefaultResourceGroup("schemes");
+ WidgetLookManager::setDefaultResourceGroup("looknfeels");
+ WindowManager::setDefaultResourceGroup("layouts");
+ ScriptModule::setDefaultResourceGroup("lua_scripts");
+ AnimationManager::setDefaultResourceGroup("animations");
+ XMLParser* p_parser = System::getSingleton().getXMLParser();
+ // For the Xerces parser, set the XML schemas resource
+ if (p_parser->isPropertyPresent("SchemaDefaultResourceGroup"))
+ p_parser->setProperty("SchemaDefaultResourceGroup", "schemas");
+
+ // Configure the default window layouting
+ SchemeManager::getSingleton().create("TaharezLook.scheme");
+ System::getSingleton().setDefaultMouseCursor("TaharezLook", "MouseArrow");
+
+ // Create the hypothetical CEGUI root window
+ Window* p_root_window = WindowManager::getSingleton().createWindow("DefaultWindow", "root");
+ System::getSingleton().setGUISheet(p_root_window);
+
+ // Create an actual framed window we can look onto
+ FrameWindow* p_frame_window = static_cast<FrameWindow*>(WindowManager::getSingleton().createWindow("TaharezLook/FrameWindow", "testWindow"));
+ p_root_window->addChildWindow(p_frame_window);
+ p_frame_window->setPosition(UVector2(UDim(0.25f, 0), UDim(0.25f, 0)));
+ p_frame_window->setSize(UVector2(UDim(0.5f, 0), UDim(0.5f, 0)));
+ p_frame_window->setText("Hello World!");
+
+ // Enter main loop
+ main_loop();
+
+ // Clean up OpenGL
+ glutDestroyWindow(window_id);
+}
+
+/* Main loop for processing events, etc. For a real application,
+ * you definitely want to replace while(true) with checking a
+ * proper termination condition. Note all drawing operations take
+ * place on an invisible auxiliary buffer until you call glutSwapBuffers(),
+ * which paints the entire auxiliary buffer onto the screen.
+ */
+void main_loop()
+{
+ while(true) {
+ glutMainLoopEvent(); // Process events
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear the window background to a single color
+ glFlush();
+ System::getSingleton().renderGUI(); // Tell CEGUI to render all its stuff
+ glutSwapBuffers(); // Put the auxiliary rendering buffer onto the screen and make the screen the new auxiliary buffer.
+ }
+}
diff --git a/src/cegui.mk b/src/cegui.mk
new file mode 100644
index 0000000..ee2ad8c
--- /dev/null
+++ b/src/cegui.mk
@@ -0,0 +1,54 @@
+# This file is part of MXE.
+# See index.html for further information.
+
+PKG := cegui
+$(PKG)_IGNORE :=
+$(PKG)_CHECKSUM := f0a8616bcb37843ad2f83c88745b9313906cb8e9
+$(PKG)_SUBDIR := CEGUI-$($(PKG)_VERSION)
+$(PKG)_FILE := CEGUI-$($(PKG)_VERSION).tar.gz
+$(PKG)_URL := http://$(SOURCEFORGE_MIRROR)/project/crayzedsgui/CEGUI%20Mk-2/$($(PKG)_VERSION)/$($(PKG)_FILE)?download
+$(PKG)_DEPS := gcc pcre freeglut freeimage freetype libxml2 expat xerces
+
+define $(PKG)_UPDATE
+ echo 'TODO: Updates for package cegui need to be written.' >&2; echo $(cegui_VERSION)
+endef
+
+define $(PKG)_BUILD
+ cd '$(1)' && ./configure \
+ --host='$(TARGET)' \
+ --disable-shared \
+ --prefix='$(PREFIX)/$(TARGET)' \
+ --enable-freetype \
+ --enable-pcre \
+ --enable-xerces-c \
+ --enable-libxml \
+ --enable-expat \
+ --disable-corona \
+ --disable-devil \
+ --enable-freeimage \
+ --disable-silly \
+ --enable-tga \
+ --enable-stb \
+ --enable-opengl-renderer \
+ --disable-ogre-renderer \
+ --disable-irrlicht-renderer \
+ --disable-directfb-renderer \
+ --enable-null-renderer \
+ --disable-samples \
+ --disable-lua-module \
+ --disable-python-module \
+ PKG_CONFIG='$(TARGET)-pkg-config' \
+ CFLAGS="`$(TARGET)-pkg-config --cflags glut freeimage`" \
+ CXXFLAGS="`$(TARGET)-pkg-config --cflags glut freeimage`" \
+ LDFLAGS="`$(TARGET)-pkg-config --libs glut freeimage`"
+ $(MAKE) -C '$(1)' -j '$(JOBS)'
+ $(SED) -i 's/Cflags:\(.*\)/Cflags: \1 -DCEGUI_STATIC/' '$(1)/cegui/CEGUI.pc'
+ $(MAKE) -C '$(1)' -j '$(JOBS)' install
+
+ '$(TARGET)-g++' \
+ -W -Wall -ansi -pedantic \
+ '$(2).cpp' \
+ `'$(TARGET)-pkg-config' --cflags --libs CEGUI CEGUI-OPENGL glut freetype2 libpcre` -lCEGUIFreeImageImageCodec \
+ `'$(TARGET)-pkg-config' --libs --cflags freeimage` -lCEGUITinyXMLParser -lCEGUIFalagardWRBase \
+ -o '$(PREFIX)/$(TARGET)/bin/test-cegui.exe'
+endef