--- /dev/null
+/* c-irrlicht --- C bindings for Irrlicht Engine
+
+ Copyright (C) 2019 Javier Sancho <jsf@jsancho.org>
+
+ This file is part of c-irrlicht.
+
+ c-irrlicht is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 3 of the
+ License, or (at your option) any later version.
+
+ c-irrlicht is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with guile-irrlicht. If not, see
+ <http://www.gnu.org/licenses/>.
+*/
+
+#include <cirrlicht/cirrlicht.h>
+#include <stddef.h>
+
+int main()
+{
+ // create irrlicht window
+ irr_core_dimension2d_u32 windowSize = {640, 480};
+ irr_IrrlichtDevice *device =
+ irr_createDevice(irr_video_EDT_SOFTWARE, &windowSize, 16,
+ 0, 0, 0);
+
+ if (!device)
+ {
+ return 1;
+ }
+
+ // set window caption
+ irr_IrrlichtDevice_setWindowCaption(device, "Hello World! - Irrlicht Engine Demo");
+
+ // instances for doing things
+ irr_video_IVideoDriver* driver = irr_IrrlichtDevice_getVideoDriver(device);
+ irr_scene_ISceneManager* smgr = irr_IrrlichtDevice_getSceneManager(device);
+ irr_gui_IGUIEnvironment* guienv = irr_IrrlichtDevice_getGUIEnvironment(device);
+
+ // add a static text
+ irr_core_rect_s32 box = {10, 10, 260, 22};
+ irr_gui_IGUIEnvironment_addStaticText(guienv,
+ "Hello World! This is the Irrlicht Software renderer!",
+ &box, 1, 1, NULL, -1, 0);
+
+ // load a quake2 mesh
+ irr_scene_IAnimatedMesh* mesh = irr_scene_ISceneManager_getMesh(smgr, "media/sydney.md2");
+ if (!mesh)
+ {
+ irr_IrrlichtDevice_drop(device);
+ return 1;
+ }
+ irr_scene_IAnimatedMeshSceneNode* node =
+ irr_scene_ISceneManager_addAnimatedMeshSceneNode(smgr, mesh, NULL, -1,
+ NULL, NULL, NULL, 0);
+
+ if (node)
+ {
+ irr_scene_IAnimatedMeshSceneNode_setMaterialFlag(node, irr_video_EMF_LIGHTING, 0);
+ irr_scene_IAnimatedMeshSceneNode_setMD2Animation(node, irr_scene_EMAT_STAND);
+ irr_video_ITexture* texture = irr_video_IVideoDriver_getTexture(driver,
+ "media/sydney.bmp");
+ irr_scene_IAnimatedMeshSceneNode_setMaterialTexture(node, 0, texture);
+ }
+
+ // camera
+ irr_core_vector3df position = {0, 30, -40};
+ irr_core_vector3df lookat = {0, 5, 0};
+ irr_scene_ISceneManager_addCameraSceneNode(smgr, NULL, &position, &lookat,
+ -1, 1);
+
+ // loop
+ irr_video_SColor bgcolor = {255, 100, 101, 140};
+ while (irr_IrrlichtDevice_run(device))
+ {
+ irr_video_IVideoDriver_beginScene(driver, 1, 1, &bgcolor, NULL, NULL);
+ irr_gui_IGUIEnvironment_drawAll(guienv);
+ irr_scene_ISceneManager_drawAll(smgr);
+ irr_video_IVideoDriver_endScene(driver);
+ }
+
+ irr_IrrlichtDevice_drop(device);
+ return 0;
+}