private void DrawGraphic(CCPoint loc) { drawNode.Clear(); drawNode.DrawRect(backgroundRect, fillColor: CCColor4B.Yellow); curLocRect = new CCRect(loc.X, 0, redBarWidth, redBarHeight); drawNode.DrawRect(curLocRect, fillColor: CCColor4B.Red); }
private void LengthSlider_ValueChanged(object sender, ValueChangedEventArgs e) { Pendulum.StringLength = e.NewValue; _pendulumRect.Size.Height = -(float)e.NewValue * _scaleFactor; _pendulumString.Clear(); _pendulumString.DrawRect(_pendulumRect); UpdateLabels(); }
public void Draw(CCDrawNode drawNode) { if (ButtonActive) { drawNode.DrawRect(rectangle, colour.To4B(), 1, CCColor4B.White); } else { drawNode.DrawRect(rectangle, colour.To4B()); } }
protected override void AddedToScene() { base.AddedToScene(); // Use the bounds to layout the positioning of our drawable assets var bounds = VisibleBoundsWorldspace; // position the label on the center of the screen label.Position = bounds.Center; step = (int)VisibleBoundsWorldspace.MaxX / SIZE; for (int i = 0; i < 5; i++) { var rectsquad = new RectSquad(5, 2, UnitType.SwordsMan, Team.Blue, 15 * i + 10, 15 * i + 10); var isAdded = army.AddSquad(rectsquad); if (isAdded) { var a = new CCRect(rectsquad.MinX * step, rectsquad.MinY * step, (rectsquad.MaxX - rectsquad.MinX) * step, (rectsquad.MaxY - rectsquad.MinY) * step); var drowNode = new CCDrawNode(); drowNode.DrawRect(a, CCColor4B.Green); AddChild(drowNode); lists.Add(new Tuple <CCDrawNode, ISquad>(drowNode, rectsquad)); } } // Register for touch events var touchListener = new CCEventListenerTouchAllAtOnce(); touchListener.OnTouchesEnded = OnTouchesEnded; AddEventListener(touchListener, this); }
public GridScene(CCGameView gameView) : base(gameView) { var layer = new CCLayerColor(CCColor4B.Transparent); var profilepos = (App.ScreenHeight / 5.25f); var boardpos = (App.ScreenHeight / 2.50f) + (App.ScreenHeight / 5f); var letpos = (App.ScreenHeight / 2.50f) + (App.ScreenHeight / 5f) + (App.ScreenHeight / 9f); var bankpos = (App.ScreenHeight / 2.50f) + (App.ScreenHeight / 5f) + (App.ScreenHeight / 9.25f) + (App.ScreenHeight / 5.5f); //var menpos = (App.ScreenHeight / 2.50f) + (App.ScreenHeight / 5f) + (App.ScreenHeight / 9.25f) + (App.ScreenHeight / 5.5f) + (App.ScreenHeight / 10f); this.AddLayer(layer); CCRect rectprof = new CCRect(0, App.ScreenHeight - profilepos, App.ScreenWidth, App.ScreenHeight / 5.25f); // CCRect rect = new CCRect(0, App.ScreenHeight - boardpos, App.ScreenWidth, App.ScreenHeight / 2.50f); CCRect rectlet = new CCRect(0, App.ScreenHeight - letpos, App.ScreenWidth, App.ScreenHeight / 9.25f); CCRect recbank = new CCRect(0, App.ScreenHeight - bankpos, App.ScreenWidth, App.ScreenHeight / 5.75f); CCRect recmen = new CCRect(0, 0, App.ScreenWidth, App.ScreenHeight / 9.5f); ProfileBoard.DrawRect(rectprof, CCColor4B.White); // GameBoard.DrawRect(rect,CCColor4B.Red); GameBoard.Position = new CCPoint(0, App.ScreenHeight - boardpos); GameBoard.ContentSize = new CCSize(App.ScreenWidth, App.ScreenHeight / 2.50f); LetterBoard.DrawRect(rectlet, CCColor4B.AliceBlue); AnswerBank.DrawRect(recbank, CCColor4B.Orange); Menus.DrawRect(recmen, CCColor4B.Green); _grid = new CCSprite("Images/Sprites/wordframe.png"); GameboardCreation(); layer.AddChild(GameBoard); layer.AddChild(ProfileBoard); layer.AddChild(LetterBoard); layer.AddChild(AnswerBank); layer.AddChild(Menus); }
internal override void UpdateCamera() { base.UpdateCamera(); // additionally color the background and the planes according to the position of the center of the camera relative to the zones CCPoint camMid = CameraPosition + (CCPoint)CameraSize / 2; float radius = camMid.Length; var bgColor = RadiusToColor(radius, groundNotAir: true); var planeColor = RadiusToColor(radius, groundNotAir: false); // draw the bg lines DrawNode.Clear(); const float bgsize = 600000f; const int lineCount = 200; var bgLineColor = CCColor4B.Lerp(planeColor, CCColor4B.Black, 0.75f); for (int i = -lineCount; i < lineCount; i++) { DrawNode.DrawLine(new CCPoint(i * bgsize / lineCount, -bgsize), new CCPoint(i * bgsize / lineCount, bgsize), 20f, bgLineColor); DrawNode.DrawLine(new CCPoint(-bgsize, i * bgsize / lineCount), new CCPoint(bgsize, i * bgsize / lineCount), 20f, bgLineColor); } // draw the bg color DrawNodeBG.Clear(); DrawNodeBG.DrawRect(new CCRect(-999999999f, -999999999f, 999999999f * 2, 999999999f * 2), bgColor); // now the planes // only color the enemies foreach (var aircraft in ActiveAircrafts) { aircraft.ColorByPlayLayer(planeColor); } }
public TMXIsoObjectsTest() { CCTMXTiledMap map = new CCTMXTiledMap("TileMaps/iso-test-objectgroup"); AddChild(map, -1, kTagTileMap); CCSize s = map.ContentSize; CCLog.Log("ContentSize: {0}, {1}", s.Width, s.Height); var objectGroup = map.ObjectGroupNamed("Object Group 1"); var objects = objectGroup.Objects; var drawNode = new CCDrawNode(); foreach (var dict in objects) { float x = float.Parse(dict["x"]); float y = float.Parse(dict["y"]); float width = (dict.ContainsKey("width") ? float.Parse(dict["width"]) : 0f); float height = (dict.ContainsKey("height") ? float.Parse(dict["height"]) : 0f); var color = new CCColor4B(255, 255, 255, 255); drawNode.DrawRect(new CCRect(x, y, width, height), CCColor4B.Transparent, 1, color); } map.AddChild(drawNode, 10); }
public void Draw() { if (drawNode != null) { drawNode.DrawRect(new CCRect(0, 0, this.ContentSize.Width, this.ContentSize.Height), CCColor4B.Blue); } }
public YesNoDialog(string title, string content, Action <object> yes, Action <object> no) { _title = new MenuItemNoActionLable(new CCLabel(title, "arial", 40)) { //Position=new CCPoint(GlobalGameData.Window_Center_X,GlobalGameData.Window_Center_Y+50), Color = CCColor3B.White, }; _content = new MenuItemNoActionLable(new CCLabel(content, "arial", 20)) { //Position=new CCPoint(GlobalGameData.Window_Center_X,GlobalGameData.Window_Center_Y), Color = CCColor3B.White, }; _yes = new CCMenuItemLabel(new CCLabel("はい", "arial", 50) { // Position = new CCPoint(GlobalGameData.Window_Center_X, GlobalGameData.Window_Center_Y) }, yes); _no = new CCMenuItemLabel(new CCLabel("いいえ", "arial", 50) { //Position = new CCPoint(GlobalGameData.Window_Center_X, GlobalGameData.Window_Center_Y) }, no); int margin = 10; var drawNode_height = _title.ContentSize.Height + _content.ContentSize.Height + _yes.ContentSize.Height + 3 * margin; var drawNode_width = 2 * margin + _content.ContentSize.Width; var _drawNode = new CCDrawNode(); _drawNode.DrawRect(new CCRect(GlobalGameData.Window_Center_X, GlobalGameData.Window_Center_Y, drawNode_width, drawNode_height), CCColor4B.White); // _backGround = _drawNode; }
public void Draw() { if (drawNode != null) { drawNode.DrawRect(new CCRect(-this.ContentSize.Width * .5f, -this.ContentSize.Height * .5f, this.ContentSize.Width * .5f, this.ContentSize.Height * .5f), CCColor4B.Blue); } }
public void Init(CCPoint point, CCDrawNode drawNode) { height = 50; var midheight = height / 2; width = 100; var midwidth = width / 2; rectangle = new CCRect(point.X - midwidth, point.Y - midheight, width, height); drawNode.DrawRect(rectangle, colour.To4B()); labelNode = new CCLabel(label, "fonts/MarkerFelt", 22, CCLabelFormat.SpriteFont) { Position = point }; AddChild(labelNode, 3); ClickEventListener.OnMouseUp = (ccevent) => { if (!rectangle.IsClickOnMe(ccevent)) { return; } ButtonActive = true; if (OnClick != null) { OnClick.Invoke(ccevent); } drawNode.RedrawMe(); }; }
private void EndGame() { hasGameEnded = true; spawner.IsSpawning = false; paddle.Visible = false; // dim the background: var drawNode = new CCDrawNode(); drawNode.DrawRect( new CCRect(0, 0, 2000, 2000), new CCColor4B(0, 0, 0, 160)); hudLayer.Children.Add(drawNode); var endGameLabel = new CCLabel("Game Over\nFinal Score:" + score, "Arial", 40, CCLabelFormat.SystemFont); endGameLabel.HorizontalAlignment = CCTextAlignment.Center; endGameLabel.Color = CCColor3B.White; endGameLabel.VerticalAlignment = CCVerticalTextAlignment.Center; endGameLabel.PositionX = hudLayer.ContentSize.Width / 2.0f; endGameLabel.PositionY = hudLayer.ContentSize.Height / 2.0f; hudLayer.Children.Add(endGameLabel); }
private void CreateHowtoLabel() { float backgroundWidth = howToImage.ScaledContentSize.Width; const float backgroundHeight = 36; labelBackground = new CCDrawNode(); var rect = new CCRect( -backgroundWidth / 2.0f, -backgroundHeight / 2.0f, backgroundWidth, backgroundHeight); labelBackground.DrawRect( rect, CCColor4B.Black); labelBackground.PositionX = ContentSize.Center.X; labelBackground.PositionY = 74; mainLayer.AddChild(labelBackground); howToLabel = new CCLabel( "Touch and move on the left side of the screen to move.\nTap on the right side to jump.", "fonts/Aldrich-Regular.ttf", 12, CCLabelFormat.SystemFont); howToLabel.PositionX = ContentSize.Center.X; howToLabel.Scale = .5f; howToLabel.PositionY = 74; howToLabel.HorizontalAlignment = CCTextAlignment.Center; howToLabel.VerticalAlignment = CCVerticalTextAlignment.Center; howToLabel.IsAntialiased = false; mainLayer.AddChild(howToLabel); }
protected override CCDrawNode Draw() { var node = new CCDrawNode(); node.DrawRect(new CCRect(0, 0, 20, this.Height), GameColors.BackgroundColor4B); node.PositionX = this.Position == WallPosition.Left ? 0 : ScreenRight - 20; return(node); }
private void MakeBox(int xpos, int ypos, int width, int height, int thickness)//Method for creating boxes { var drawNode = new CCDrawNode(); var rect = new CCRect(xpos, ypos, width, height); drawNode.DrawRect(rect, fillColor: CCColor4B.Transparent, borderWidth: thickness, borderColor: CCColor4B.White); AddChild(drawNode); }
protected void RenderTouchPoint() { touchPoint.Clear(); touchPoint.Color = new CCColor3B(_touchColor.R, _touchColor.G, _touchColor.B); touchPoint.Opacity = 255; touchPoint.DrawLine(new CCPoint(0, _touchPoint.Y), new CCPoint(ContentSize.Width, _touchPoint.Y), 5); touchPoint.DrawLine(new CCPoint(_touchPoint.X, 0), new CCPoint(_touchPoint.X, ContentSize.Height), 5); touchPoint.DrawRect(_touchPoint, 30); }
/********************************************************************** *********************************************************************/ //draw everything. Begginging from the Bottom void DrawLabelsAndBoxes() { ///////draw 29 lines of boxes and labels float yPos = 15; for (int i = 0; i < 29; i++) { //draw label on the left side var ccl_LeftNumber = new CCLabel((28 - i).ToString(), "Arial", 20); ccl_LeftNumber.Position = new CCPoint(20, yPos + 25); ccl_LeftNumber.Color = CCColor3B.Black; layer.AddChild(ccl_LeftNumber); //draw the box on the left side var leftBox = new CCRect(40, yPos, 40, 50); //x,y,length, width CCDrawNode cc_leftBox = new CCDrawNode(); cc_leftBox.DrawRect( leftBox, fillColor: CCColor4B.White, borderWidth: 1, borderColor: CCColor4B.Gray); layer.AddChild(cc_leftBox); //draw label on the right side var ccl_RightNumber = new CCLabel((28 - i).ToString(), "Arial", 20); ccl_RightNumber.Position = new CCPoint(380, yPos + 25); ccl_RightNumber.Color = CCColor3B.Black; layer.AddChild(ccl_RightNumber); //draw the box on the right side var rightBox = new CCRect(320, yPos, 40, 50); CCDrawNode cc_rightBox = new CCDrawNode(); cc_rightBox.DrawRect( rightBox, fillColor: CCColor4B.White, borderWidth: 1, borderColor: CCColor4B.Gray); layer.AddChild(cc_rightBox); //set yPos yPos += 65; //50 heigth + 15 distance } ///////////draw labels on the top //draw label on the left side var ccl_LNumber = new CCLabel("sender", "Arial", 20); ccl_LNumber.Position = new CCPoint(55, yPos + 25); ccl_LNumber.Color = CCColor3B.Gray; layer.AddChild(ccl_LNumber); //draw label on the right side var ccl_RNumber = new CCLabel("receiver", "Arial", 20); ccl_RNumber.Position = new CCPoint(345, yPos + 25); ccl_RNumber.Color = CCColor3B.Gray; layer.AddChild(ccl_RNumber); }
protected void DrawRectangle(Dictionary <string, string> dict, CCDrawNode draw) { float x = float.Parse(dict["x"]); float y = float.Parse(dict["y"]); float width = float.Parse(dict["width"]); float height = float.Parse(dict["height"]); draw.DrawRect(new CCRect(x, y, width, height), new CCColor4B(0, 0, 0, 0), 1.0f, new CCColor4B(0, 255, 0)); }
private void CreateDebugGraphic() { debugGraphic = new CCDrawNode(); debugGraphic.DrawRect( new CCRect(-width / 2, -height / 2, width, height), fillColor: new CCColor4B(180, 180, 180, 180)); this.AddChild(debugGraphic); }
void Rect() { var shape = new CCRect( 0, 0, 100, 200); drawNode.DrawRect(shape, fillColor: CCColor4B.Blue, borderWidth: 4, borderColor: CCColor4B.White); }
private void CreateDebugGraphics() { var graphic = new CCDrawNode(); graphic.DrawRect( new CCRect(0, GameCoefficients.BinHeight - CollisionHeight, _width, CollisionHeight), fillColor: _fruitColor.ToCCColor()); AddChild(graphic); }
private void UpdateGraphics() { if (GameCoefficients.ShowCollisionAreas) { graphic.Clear(); graphic.DrawRect( new CCRect(0, GameCoefficients.BinHeight - collisionHeight, width, collisionHeight), fillColor: fruitColor.ToCCColor()); } }
public void AddBorders() { var height = MyGameView.PageHeight; var rect = new CCDrawNode(); rect.DrawRect(new CCRect(0, 0, 20, height), GameColors.WallsColor4B); this._layer.AddChild(rect); rect = new CCDrawNode(); rect.DrawRect(new CCRect(180, 0, 20, height), GameColors.WallsColor4B); this._layer.AddChild(rect); }
protected override void AddedToScene() { base.AddedToScene(); bounds = VisibleBoundsWorldspace; // Om te testen? Echte graphics maken? var drawNode = new CCDrawNode(); this.AddChild(drawNode); var shape = new CCRect(140, bounds.MidY - 400, 460, 900); drawNode.DrawRect(shape, fillColor: CCColor4B.Transparent, borderWidth: 4, borderColor: CCColor4B.White); var shape2 = new CCRect(700, bounds.MidY - 400, 1000, 900); drawNode.DrawRect(shape2, fillColor: CCColor4B.Transparent, borderWidth: 4, borderColor: CCColor4B.White); m_StartPlayerNames = bounds.MidY + 400; Button PlayButton = new Button("Play game", new CCPoint(bounds.MaxX - 100, bounds.MidY), "Coalition", 70, this); PlayButton.OnClicked += new ClickEventHandler(OnPlayGame); PlayButton.Rotate(); m_Buttons.Add(PlayButton); m_BackMenuButton = new Button("<<<", new CCPoint(bounds.MinX + 70, bounds.MaxY - 100), "Coalition", 36, this); m_BackMenuButton.OnClicked += new ClickEventHandler(OnBackMenu); m_Buttons.Add(m_BackMenuButton); settings(); players(); }
protected override void AddedToScene() { base.AddedToScene(); // Use the bounds to layout the positioning of our drawable assets _bounds = VisibleBoundsWorldspace; //var background = new CCSprite("background"); //AddChild(background); _targetZone = new CCDrawNode(); _targetZone.Position = new CCPoint(_bounds.MaxX - 100, _bounds.MaxY - 100); _targetZone.DrawRect(new CCPoint(0, 0), 50, CCColor4B.Transparent); AddChild(_targetZone); var coinSprite = new CCSprite("coin"); _targetZone.AddChild(coinSprite); _line = new CCDrawNode(); AddChild(_line); _ball = new CCDrawNode(); _ball.Position = new CCPoint(100, 100); _ball.DrawCircle(new CCPoint(0, 0), 50, CCColor4B.Transparent); AddChild(_ball); ReorderChild(_ball, 2); var ballSprite = new CCSprite("ball"); _ball.AddChild(ballSprite); //ballSprite.Scale = 0.15f; _ball.ReorderChild(ballSprite, 2); _glow = new CCParticleSun(new CCPoint(0, 0), CCEmitterMode.Radius); _glow.StartColor = new CCColor4F(CCColor3B.Orange); _glow.EndColor = new CCColor4F(CCColor3B.Yellow); _glow.StartRadius = _ball.ContentSize.Width * 0.4f; _glow.EndRadius = _ball.ContentSize.Width * 0.5f; Schedule(RunGameLogic); // Register for touch events var touchListener = new CCEventListenerTouchAllAtOnce(); touchListener.OnTouchesBegan = OnTouchesBegan; touchListener.OnTouchesEnded = OnTouchesEnded; touchListener.OnTouchesMoved = HandleTouchesMoved; AddEventListener(touchListener, _ball); }
public SolidRectangle(float width, float height) { Polygon = Polygon.CreateRectangle(width, height); var graphic = new CCDrawNode(); graphic.DrawRect( new CCRect(-width / 2, -height / 2, width, height), fillColor: CCColor4B.Blue); this.AddChild(graphic); this.AddChild(Polygon); }
/********************************************************************** *********************************************************************/ static void DrawFillRight(int seqnum) { float a = 28 - seqnum; float yPos = 15 + (a * 65); //draw the box on the right side var rightBox = new CCRect(320, yPos, 40, 50); CCDrawNode cc_rightBox = new CCDrawNode(); cc_rightBox.DrawRect( rightBox, fillColor: CCColor4B.LightGray, borderWidth: 1, borderColor: CCColor4B.Gray); layer.AddChild(cc_rightBox); }
/********************************************************************** *********************************************************************/ static void DrawFillLeft(int seqnum) { float a = 28 - seqnum; float yPos = 15 + (a * 65); //draw the box on the left side var leftBox = new CCRect(40, yPos, 40, 50); //x,y,length, width CCDrawNode cc_leftBox = new CCDrawNode(); cc_leftBox.DrawRect( leftBox, fillColor: CCColor4B.LightGray, borderWidth: 1, borderColor: CCColor4B.Gray); layer.AddChild(cc_leftBox); }
public void Draw() { if (IsDebug) { CCSize visibleBoundsSize = VisibleBoundsWorldspace.Size; drawNode.DrawRect(new CCRect(0, 0, visibleBoundsSize.Width, visibleBoundsSize.Height), CCColor4B.Blue); if (JoyControl != null) { JoyControl.Draw(); } foreach (var button in Buttons) { button.Draw(); } } }
protected override void AddedToScene() { base.AddedToScene(); CCRect bounds = VisibleBoundsWorldspace; var drawNode = new CCDrawNode(); drawNode.Opacity = 50; AddChild(drawNode); var shape = new CCRect(0, bounds.Center.Y - 120, bounds.MaxX, 200); drawNode.DrawRect(shape, new CCColor4B(0, 0, 0, 150)); CCLabel pauseLabel = new CCLabel(_isSuccess ? "Score: " + _score : "GAME OVER.", "Arial", 60) { Position = bounds.Center }; AddChild(pauseLabel); CCLabel resumeLabel = new CCLabel("TOUCH TO RETRY.", "Arial", 30) { PositionX = bounds.Center.X, PositionY = bounds.Center.Y - 50 }; AddChild(resumeLabel); var scaleUp = new CCScaleBy(1, 1.3f); var scaleDown = scaleUp.Reverse(); var moveSeq = new CCSequence(new CCEaseBackInOut(scaleUp), new CCEaseBackInOut(scaleDown)); CCRepeatForever repeatedAction = new CCRepeatForever(moveSeq); resumeLabel.RunAction(repeatedAction); AddChild(MenuHelper.CreateEndGameNavigation(bounds, BackToMenu, ToLevels, NextLevel)); Opacity = 180; var touchListener = new CCEventListenerTouchAllAtOnce { OnTouchesEnded = OnTouchesEnded }; AddEventListener(touchListener, this); }