00001 /* 00002 * Copyright (C) 2004 Ivo Danihelka (ivo@danihelka.net) 00003 * 00004 * This program is free software; you can redistribute it and/or modify 00005 * it under the terms of the GNU General Public License as published by 00006 * the Free Software Foundation; either version 2 of the License, or 00007 * (at your option) any later version. 00008 */ 00009 #include "demo-script.h" 00010 00011 #include "Path.h" 00012 #include "DemoMode.h" 00013 #include "Picture.h" 00014 00015 #include "def-script.h" 00016 00017 //----------------------------------------------------------------- 00018 inline DemoMode * 00019 getDemo(lua_State *L) 00020 { 00021 return dynamic_cast<DemoMode*>(script_getLeader(L)); 00022 } 00023 00024 //----------------------------------------------------------------- 00025 /** 00026 * void demo_display(picture, x, y) 00027 */ 00028 int 00029 script_demo_display(lua_State *L) throw() 00030 { 00031 BEGIN_NOEXCEPTION; 00032 const char *filename = luaL_checkstring(L, 1); 00033 int x = luaL_checkint(L, 2); 00034 int y = luaL_checkint(L, 3); 00035 00036 Picture *picture = new Picture(Path::dataReadPath(filename), V2(x, y)); 00037 getDemo(L)->action_display(picture); 00038 END_NOEXCEPTION; 00039 return 0; 00040 } 00041