int main(int ac, char **av) { std::cout << META_TYPE(Entity)->getName() << " " << META_TYPE(Entity)->getSize() << std::endl; std::cout << META_TYPE(Component::TrackingCamera)->getName() << " " << META_TYPE(Component::TrackingCamera)->getSize() << std::endl; auto lol = META_TYPE(Entity); std::auto_ptr<Entity> h(); auto smart = META_OBJECT(h); //std::shared_ptr<Entity> i(); //auto smart2 = META_OBJECT(i); Engine e; // set Rendering context of the engine // you can also set any other dependencies e.setInstance<PubSub::Manager>(); e.setInstance<SdlContext, IRenderContext>(); e.setInstance<Input>(); e.setInstance<Timer>(); e.setInstance<Resources::ResourceManager>(&e); e.setInstance<Renderer>(&e); e.setInstance<SceneManager>(); // e.setInstance<BulletCollisionManager>().init(); e.setInstance<BulletDynamicManager, BulletCollisionManager>().init(); // init engine if (e.init() == false) return (EXIT_FAILURE); // add scene e.getInstance<SceneManager>().addScene(new InGameScene(e), "InGameScene"); // bind scene if (!e.getInstance<SceneManager>().initScene("InGameScene")) return false; e.getInstance<SceneManager>().enableScene("InGameScene", 100); // launch engine if (e.start() == false) return (EXIT_FAILURE); while (e.update()) ; //e.stop(); return (EXIT_SUCCESS); }
static int vlclua_input_item_set_meta( lua_State *L ) { input_item_t *p_item = vlclua_input_item_get_internal( L ); lua_settop( L, 1 + 2 ); // two arguments const char *psz_name = luaL_checkstring( L, 2 ), *psz_value = luaL_checkstring( L, 3 ); #define META_TYPE( n, s ) { s, vlc_meta_ ## n }, static const struct { const char psz_name[15]; unsigned char type; } pp_meta_types[] = { META_TYPE( Title, "title" ) META_TYPE( Artist, "artist" ) META_TYPE( Genre, "genre" ) META_TYPE( Copyright, "copyright" ) META_TYPE( Album, "album" ) META_TYPE( TrackNumber, "track_number" ) META_TYPE( Description, "description" ) META_TYPE( Rating, "rating" ) META_TYPE( Date, "date" ) META_TYPE( Setting, "setting" ) META_TYPE( URL, "url" ) META_TYPE( Language, "language" ) META_TYPE( NowPlaying, "now_playing" ) META_TYPE( ESNowPlaying, "now_playing" ) META_TYPE( Publisher, "publisher" ) META_TYPE( EncodedBy, "encoded_by" ) META_TYPE( ArtworkURL, "artwork_url" ) META_TYPE( TrackID, "track_id" ) META_TYPE( TrackTotal, "track_total" ) META_TYPE( Director, "director" ) META_TYPE( Season, "season" ) META_TYPE( Episode, "episode" ) META_TYPE( ShowName, "show_name" ) META_TYPE( Actors, "actors" ) }; #undef META_TYPE static_assert( sizeof(pp_meta_types) == VLC_META_TYPE_COUNT * sizeof(pp_meta_types[0]), "Inconsistent meta data types" ); vlc_meta_type_t type = vlc_meta_Title; for( unsigned i = 0; i < VLC_META_TYPE_COUNT; i++ ) { if( !strcasecmp( pp_meta_types[i].psz_name, psz_name ) ) { type = pp_meta_types[i].type; input_item_SetMeta( p_item, type, psz_value ); return 1; } } vlc_meta_AddExtra( p_item->p_meta, psz_name, psz_value ); return 1; }