Example #1
0
        public override void Initialize()
        {
            TypeO.RequireTypeO(new Core.Engine.Version(0, 1, 1));
            TypeO.RequireModule <DesktopModule>(new Core.Engine.Version(0, 1, 1));
            TypeO.AddService <ISDLService, SDLService>();
            ((ISDLService)TypeO.Context.Services[typeof(ISDLService)]).Option = Option;

            //Initial SDL
            foreach (var hint in Option.Hints)
            {
                SDL2.SDL.SDL_SetHint(hint.Key, hint.Value);
            }

            foreach (var eventState in Option.EventStates)
            {
                SDL2.SDL.SDL_EventState(eventState.Key, eventState.Value);
            }

            if (SDL2.SDL.SDL_Init(Option.SDLInitFlags) != 0)
            {
                var message = $"SDL_Init Error: {SDL2.SDL.SDL_GetError()}";
                Logger.Log(LogLevel.Fatal, message);
                TypeO.Context.Exit();
                throw new ApplicationException(message);
            }

            if (SDL_image.IMG_Init(Option.IMGInitFlags) == 0)
            {
                var message = $"IMG_Init Error: {SDL2.SDL.SDL_GetError()}";
                Logger.Log(LogLevel.Fatal, message);
                TypeO.Context.Exit();
                throw new ApplicationException(message);
            }

            if (SDL_ttf.TTF_Init() != 0)
            {
                var message = $"TTF_Init Error: {SDL2.SDL.SDL_GetError()}";
                Logger.Log(LogLevel.Fatal, message);
                TypeO.Context.Exit();
                throw new ApplicationException(message);
            }
        }
Example #2
0
 public override void Initialize()
 {
     TypeO.RequireModule <TestModule>(new TypeOEngine.Typedeaf.Core.Engine.Version(2, 2, 2));
 }