public void update() { gameDirector.update(); Compositer.setSkyColors(gameDirector.getSkyHorizonColor(), gameDirector.getSkyZenithColor(), gameDirector.getAmbientBrighness()); updateMonsterSpawning(); handleActorActions(actorManager.update()); foreach (Actor actor in actorManager.getActors()) { Island closestIsland = islandManager.getClosestIslandToLocation(actor.getLocation()); runPhysicsWithMoveActionAndIsland(actor, actor.getVelocity(), closestIsland); } islandManager.update(); }
public void HandleExcavationMouseover(Ray hoverRay) { Vector3?space = getLastSpaceAlongRay(hoverRay); Vector3?block = getBlockAlongRay(hoverRay); if (space.HasValue && block.HasValue) { IntVector3 spaceLoc = new IntVector3((Vector3)space); IntVector3 blockLoc = new IntVector3((Vector3)block); Vector3 pointingTowardBlock = blockLoc.toVector3() - spaceLoc.toVector3(); CubeAnimator.AnimatedBodyPartGroup flag = new CubeAnimator.AnimatedBodyPartGroup(@"worldMarkup\shovel.chr", 1f / 26f); flag.setRootPartLocation(spaceLoc.toVector3() + new Vector3(.5f, .5f, .5f)); flag.setRootPartRotationOffset(Quaternion.CreateFromRotationMatrix(GeometryFunctions.getRotationMatrixFromNormal(pointingTowardBlock))); Compositer.addAnimatedBodyPartGroupForThisFrame(flag); } }
/// <summary> /// Set default values to the canvas fields /// </summary> private void SetDefaultValues() { //When the context is created, the font of the context must be set to 10px sans-serif. _family = new FontFamily(GenericFontFamilies.Serif); _parsedFont = new Font(_family, 10, FontStyle.Regular, GraphicsUnit.Pixel); _font = _parsedFont.ToString(); path = new GraphicsPath(); path.FillMode = FillMode.Winding; stack = new Stack<CanvasState> {}; //_fillStyle = "rgba(0,0,0,0)"; _transformation = new Matrix(); _globalAlpha = 1.0; _globalCompositeOperation = "source-over"; _textAlign = "start"; _textBaseLine = "alphabetic"; lineWidth = 1.0; lineCap = "butt"; lineJoin = "miter"; miterLimit = 10.0; _shadowColor = "rgba(0,0,0,0)"; _shadowOffsetX = 0; _shadowOffsetY = 0; _shadowBlur = 0; surface.SmoothingMode = SmoothingMode.HighQuality; surface.InterpolationMode = InterpolationMode.HighQualityBicubic; surface.PixelOffsetMode = PixelOffsetMode.HighQuality; surface.PageUnit = GraphicsUnit.Pixel; //scale(surface.DpiX/96, surface.DpiY/96); //surface.PageScale = surface.DpiX * 2/96; _compositier = new Compositer(); }
private void ApplyShadows() { if (ColorUtils.isValidColor(_shadowColor) && ColorUtils.ParseColor(_shadowColor).A != 0 && _shadowBlur != 0 && (_shadowOffsetX != 0 || _shadowOffsetY != 0)) { var blur = new GaussianBlur((int) _shadowBlur); var clone = (Bitmap) _surfaceBitmap.Clone(); clone.MakeTransparent(Color.Transparent); Graphics image = Graphics.FromImage(clone); image.Clear(Color.Transparent); image.DrawImage(_surfaceBitmap, (float) _shadowOffsetX, (float) _shadowOffsetY); Bitmap shadow = blur.ProcessImage(clone, ColorUtils.ParseColor(_shadowColor)); shadow.MakeTransparent(Color.Transparent); image.Flush(); if (shadow != null) { surface.Flush(); var dest = (Bitmap) _surfaceBitmap.Clone(); shadow.MakeTransparent(Color.Transparent); dest.MakeTransparent(Color.Transparent); var cmp = new Compositer(); cmp.setCompositeMode(CompositeMode.SourceOver); cmp.blendImages(shadow, dest); surface.Clear(Color.Transparent); surface.DrawImage(shadow, 0, 0); } } }
private void SetDefaultValues() { _fill = Brushes.Black; _stroke = Brushes.Black; //store current style _style = new CanvasStyle(_path); _style.Fill = _fill; _style.Stroke = _stroke; _textAlign = "start"; _textBaseLine = "alphabetic"; _globalAlpha = 1.0; _globalCompositeOperation = "source-over"; _shadowColor = "rgba(0,0,0,0)"; _shadowOffsetX = 0; _shadowOffsetY = 0; _shadowBlur = 0; lineWidth = 1.0; lineCap = "butt"; lineJoin = "miter"; miterLimit = 10.0; globalAlpha = 1; _compositier = new Compositer(); }