1 /* c-irrlicht --- C bindings for Irrlicht Engine
3 Copyright (C) 2019 Javier Sancho <jsf@jsancho.org>
5 This file is part of c-irrlicht.
7 c-irrlicht is free software; you can redistribute it and/or modify
8 it under the terms of the GNU Lesser General Public License as
9 published by the Free Software Foundation; either version 3 of the
10 License, or (at your option) any later version.
12 c-irrlicht is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 General Public License for more details.
17 You should have received a copy of the GNU Lesser General Public
18 License along with guile-irrlicht. If not, see
19 <http://www.gnu.org/licenses/>.
22 #include <cirrlicht/cirrlicht.h>
27 // create irrlicht window
28 irr_core_dimension2d_u32 windowSize = {640, 480};
29 irr_IrrlichtDevice *device =
30 irr_createDevice(irr_video_EDT_SOFTWARE, &windowSize, 16,
39 irr_setWindowCaption(device, "Hello World! - Irrlicht Engine Demo");
41 // instances for doing things
42 irr_video_IVideoDriver* driver = irr_getVideoDriver(device);
43 irr_scene_ISceneManager* smgr = irr_getSceneManager(device);
44 irr_gui_IGUIEnvironment* guienv = irr_getGUIEnvironment(device);
47 irr_core_rect_s32 box = {10, 10, 260, 22};
48 irr_gui_addStaticText(guienv,
49 "Hello World! This is the Irrlicht Software renderer!",
50 &box, 1, 1, NULL, -1, 0);
53 irr_scene_IAnimatedMesh* mesh = irr_scene_getMesh(smgr, "media/sydney.md2");
59 irr_scene_IAnimatedMeshSceneNode* node =
60 irr_scene_addAnimatedMeshSceneNode(smgr, mesh, NULL, -1,
65 irr_scene_setMaterialFlagAM(node, irr_video_EMF_LIGHTING, 0);
66 irr_scene_setMD2Animation(node, irr_scene_EMAT_STAND);
67 irr_video_ITexture* texture = irr_video_getTexture(driver, "media/sydney.bmp");
68 irr_scene_setMaterialTextureAM(node, 0, texture);
72 irr_core_vector3df position = {0, 30, -40};
73 irr_core_vector3df lookat = {0, 5, 0};
74 irr_scene_addCameraSceneNode(smgr, NULL, &position, &lookat, -1, 1);
77 irr_video_SColor bgcolor = {255, 100, 101, 140};
78 while (irr_run(device))
80 irr_video_beginScene(driver, 1, 1, &bgcolor, NULL, NULL);
81 irr_gui_drawAll(guienv);
82 irr_scene_drawAll(smgr);
83 irr_video_endScene(driver);