X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=src%2Fdriver-types.cpp;fp=src%2Fdriver-types.cpp;h=886d40d4f55eee55d2a71315ff991a34b6dfc465;hb=2806f03eafc48ec9ef02a3dc2d74133eaf11ccc1;hp=0000000000000000000000000000000000000000;hpb=a8ec20de5146479a15d388393b37bbf3e346f619;p=guile-irrlicht.git diff --git a/src/driver-types.cpp b/src/driver-types.cpp new file mode 100644 index 0000000..886d40d --- /dev/null +++ b/src/driver-types.cpp @@ -0,0 +1,63 @@ +/* guile-irrlicht --- GNU Guile bindings for Irrlicht Engine + + Copyright (C) 2020 Javier Sancho + + This file is part of guile-irrlicht. + + guile-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. + + guile-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 + . +*/ + +#include +#include +#include "driver-types.h" + +extern "C" { + + irr::video::E_DRIVER_TYPE + scm_to_driver_type (SCM driver_type) + { + char* driverType = scm_to_utf8_stringn (scm_symbol_to_string (driver_type), NULL); + if (!strcmp (driverType, "null")) + { + return irr::video::EDT_NULL; + } + else if (!strcmp (driverType, "software")) + { + return irr::video::EDT_SOFTWARE; + } + else if (!strcmp (driverType, "burnings")) + { + return irr::video::EDT_BURNINGSVIDEO; + } + else if (!strcmp (driverType, "direct3d8")) + { + return irr::video::EDT_DIRECT3D8; + } + else if (!strcmp (driverType, "direct3d9")) + { + return irr::video::EDT_DIRECT3D9; + } + else if (!strcmp (driverType, "opengl")) + { + return irr::video::EDT_OPENGL; + } + else + { + scm_error (scm_arg_type_key, NULL, "Wrong driver type: ~S", + scm_list_1 (driver_type), scm_list_1 (driver_type)); + } + } + +}