Exemplo n.º 1
0
        public static void Initilise()
        {
            AlethaApplication application;

            closureEvent = new AutoResetEvent(false);
            bw           = new BackgroundWorker();

            bw.WorkerReportsProgress      = true;
            bw.WorkerSupportsCancellation = true;
            bw.DoWork += new DoWorkEventHandler((object sender, DoWorkEventArgs e) =>
            {
                application       = new AlethaApplication();
                application.Title = "Initilising..";
#if FORCE_HIGH_FPS
                application.Run();
#else
                application.Run(60);
#endif
            });
            bw.RunWorkerCompleted += new RunWorkerCompletedEventHandler((object sender, RunWorkerCompletedEventArgs e) =>
            {
                closureEvent.Set();
            });

            bw.RunWorkerAsync();
            closureEvent.WaitOne();
        }
Exemplo n.º 2
0
        public AlethaApplication() : base(ResWidth, ResHeight, GraphicsMode)
        {
            this.VSync             = VSyncMode.On;
            this.Keyboard.KeyUp   += Keyboard_KeyUp;
            this.Keyboard.KeyDown += Keyboard_KeyDown;

            camera = new SceneCamera(ResWidth, ResHeight);


            NativeWindowContext = this;
            CurrentApplication  = this;
        }
Exemplo n.º 3
0
 public static void Main(string[] args)
 {
     AlethaApplication.Initilise();
 }
Exemplo n.º 4
0
        public static void fetch_texture(String url, OnTextueLoad onGlTexture, OnTextueImageLoadComplete onloadComplete)
        {
            int    texture = -1;
            Bitmap image   = null;

            if (onGlTexture != null)
            {
                if (url_cache_texture.ContainsKey(url))
                {
                    texture = url_cache_texture[url];
                }
                else
                {
                    texture = GL.GenTexture();
                }

                onGlTexture(texture);
            }

            if (onloadComplete != null)
            {
                if (data_cache_texture.ContainsKey(url))
                {
                    image = (Bitmap)data_cache_texture[url];
                }
                else
                {
                    //      fetch(url,'arraybuffer').then((HttpRequest request){
                    //        var respp = request.response;
                    //
                    //        print("["+request.statusText+"] "+request.responseUrl);
                    //
                    //        var image = respp;
                    //        onloadComplete(texture,image);
                    //      });

                    //try
                    //{
                    url = url.Replace("/", "\\");     // they are all located in base folder on local file system not on web

                    image = new Bitmap(url);

                    var newSize = GetTextureGLMaxSize(image);

                    Rescale(ref image, newSize);


                    //AlethaApplication.incReqests();
                    //    AlethaApplication.update_progress_bar(AlethaApplication.request_number, url);

                    //    onloadComplete(texture, image);

                    //    Console.WriteLine(url);
                    //}
                    //catch
                    //{
                    //    Console.WriteLine("[warning] could not find texture '{0}'", url);
                    //}
                }
                AlethaApplication.incReqests();
                AlethaApplication.update_progress_bar(AlethaApplication.request_number, url);

                onloadComplete(texture, image);

                Console.WriteLine(url);

                //fetch_update(url);
            }
        }