예제 #1
0
        //Main Thread Method
        public void updateTexture()
        {
            if (Chat.getFrameBuffer(false) == null)
            {
                return;
            }
            if (Chat.getFrameBuffer(false).getFrameBuffer() == null)
            {
                return;
            }
            List <Model> models = new List <Model>();

            Camera talkerCamera = new Camera();

            ChatMessage cm;

            if ((cm = getCurrentMessage()) != null)
            {
                lock (cm) {
                    Talkable talker = cm.getTalker();
                    Model    m      = talker.getModel();
                    talkerCamera.getTarget().set(m.getLocation());
                    talkerCamera.getTarget().addY(1.75);

                    Location j = talkerCamera.getTarget().getAbsoluteLocation();
                    j.addYaw(-23);
                    Location q = j.getRelativeInFacingDirection(3);
                    j.Dispose();
                    //j.addX(-1.25).addY(0).addZ(2.8);
                    talkerCamera.getLocation().set(q);
                    q.Dispose();
                    lock (m) {
                        models.Add(talker.getModel());
                    }
                }
            }

            Color oldSky = DisplayManager.getDisplayManager().getClearColor();

            lock (talkerCamera) {
                DisplayManager.getDisplayManager().setClearColor(Color.RED.clone().setAlpha(0));
                DisplayManager.getDisplayManager().renderToBuffer(Chat.getFrameBuffer().getFrameBuffer(), models, talkerCamera);
                DisplayManager.getDisplayManager().setClearColor(oldSky);
            }
            talkerCamera.Dispose();
        }
예제 #2
0
        public override void Dispose()
        {
            base.Dispose();
            if (this.sprite != null)
            {
                DisplayManager.getDisplayManager().removeModel(this.sprite);
                if (this.sprite.getVBO() != null)
                {
                    this.sprite.getVBO().Dispose();
                }
                this.sprite.Dispose();
            }

            up     = null;
            hover  = null;
            down   = null;
            sprite = null;
        }
예제 #3
0
		public DisplayManager () {
			DISPLAY_MANAGER_INSTANCE = this;
			
			this.graphicsContext = new GraphicsContext();
			
			this.camera = new Camera();
			
			this.models = new List<Model>();
			this.lights = new List<Light>();
			this.vboWaitingList = new List<Model>();
			this.texturesToLoad = new List<LoadableTexture>();
			
			this.frameBuffersToMake = new List<ThreadSafeFrameBuffer>();
			this.depthBuffersToMake = new List<ThreadSafeDepthBuffer>();
			
			//Generate Ambient Light
			ambientLight = new Light();
			ambientLight.setColor(Color.WHITE);
			ambientLight.setIntensity(0.2f);
			
			this.clearColor = Color.BLACK.clone();
			
		}
예제 #4
0
 public static DisplayManager getDisplayManager()
 {
     return(DisplayManager.getDisplayManager());
 }
예제 #5
0
		public static Camera getCamera() {
			if(DisplayManager.getDisplayManager().getCamera() != null) return DisplayManager.getDisplayManager().getCamera();
			Camera c = new Camera();
			DisplayManager.getDisplayManager().setCamera(c);
			return c;
		}
예제 #6
0
		public DisplayManager getDisplayManager() {return DisplayManager.getDisplayManager();}
예제 #7
0
        public override void tick()
        {
            base.tick();
            this.updateSprite();

            //Update Location
            if (this.sprite != null)
            {
                lock (this.sprite) {
                    this.sprite.getLocation().set(this.getLocation());
                    if (!this.getGUI().getScene().getModels().Contains(this.sprite))
                    {
                        this.getGUI().getScene().addModel(this.sprite);
                    }
                }
            }

            if (oldData != null && Game.GAME_INSTANCE.getTouchData().Equals(oldData))
            {
                return;
            }
            oldData = Game.GAME_INSTANCE.getTouchData();
            int touching = 0;

            foreach (TouchData td in Game.GAME_INSTANCE.getTouchData())
            {
                float x = td.X;
                float y = td.Y;
                x += 0.5f;
                y += 0.5f;
                x *= (float)DisplayManager.getDisplayManager().getCamera().getWidth();
                y *= (float)DisplayManager.getDisplayManager().getCamera().getHeight();
                Location l = new Location(x, y);

                if (isInButton(l))
                {
                    touching++;
                    if (td.Status.Equals(TouchStatus.Down))
                    {
                        this.onPress(td);
                    }
                    else if (td.Status.Equals(TouchStatus.Move))
                    {
                        this.onHold(td);
                    }
                    else if (td.Status.Equals(TouchStatus.Up))
                    {
                        this.onRelease(td);
                    }
                    else if (td.Status.Equals(TouchStatus.Canceled))
                    {
                        this.onCancelling(td);
                    }
                }
            }

            if (this.isDown && touching < 1)
            {
                this.isDown = false;
                this.updateSprite();
            }
        }
예제 #8
0
		public static DisplayManager getDisplayManager() {
			if(DISPLAY_MANAGER_INSTANCE != null) return DISPLAY_MANAGER_INSTANCE;
			return DISPLAY_MANAGER_INSTANCE = new DisplayManager();
		}