Ejemplo n.º 1
0
        public void addOnPressListener(ImageDisplayObject ob, EventHandler funcdelegate)
        {
            eventHandlerDic_onPress.Add(ob, funcdelegate);

            lock (padLock)
            {
                elementsOnPressed.Add(ob);
            }

            initiateWoker();
        }
Ejemplo n.º 2
0
        public void addClickListener(ImageDisplayObject ob, EventHandler funcdelegate)
        {
            eventHandlerDic_onClick.Add(ob, funcdelegate);

            lock (padLock)
            {
                buttonsOnClicked.Add(ob);
            }

            initiateWoker();
        }
Ejemplo n.º 3
0
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.DimGray);
            spriteBatch.Begin();

            // draw grid
            drawGrid();

            //draw ground and walls
            foreach (ImageDisplayObject dis in pavementTiles.Concat(wallstiles))
            {
                TileObject td = (TileObject)dis;
                spriteBatch.Draw(dis.getTexture(), dis.getDrawRectangle(), td.getColor());
            }

            // display objects - merge the map objects with the characters
            var disobjlist = displayList.Concat(map_objects);

            foreach (ImageDisplayObject dis in disobjlist)
            {
                spriteBatch.Draw(dis.getTexture(), dis.getDrawRectangle(), dis.getColor());
            }

            // GUI - display and text
            foreach (DisplayObject dsb in uiManager.getGUIDisplayList())
            {
                if (dsb.displayObjectType == DisplayObject.DisplayObjectType.TEXT)
                {
                    // is a textfield
                    TextField dtxt = (TextField)dsb;
                    spriteBatch.DrawString(dtxt.getFont(), dtxt.text, new Vector2(dtxt.x, dtxt.y), dtxt.colour);
                }
                else
                {
                    // is an image with texture2D
                    ImageDisplayObject idsb = (ImageDisplayObject)dsb;
                    spriteBatch.Draw(idsb.getTexture(), idsb.getDrawRectangle(), Color.White);
                }
            }

            //

            spriteBatch.End();

            base.Draw(gameTime);
        }
Ejemplo n.º 4
0
 public void addToStage(ImageDisplayObject ds)
 {
     // a temporary list is needed so it prevents mid displaylist loop new insertion errors
     tempDisplayList.Add(ds);
 }