示例#1
0
        void DrawText(Font font, string text, KokoEngine.Vector2 position, KokoEngine.Color color, float alignmentOffset, float rotation, float scale, float layer)
        {
            // Parameters of draw call
            SpriteFont font_     = font.ToMonoSpriteFont();
            Vector2    position_ = position.ToMonoVector2();
            Color      color_    = color.ToMonoColor();
            Vector2    origin    = font_.MeasureString(text) * alignmentOffset;

            // Draw call
            _spriteBatch.DrawString(font_, text, position_, color_, rotation, origin, scale, SpriteEffects.None, layer);
        }
示例#2
0
        void DrawLine(KokoEngine.Vector2 start, KokoEngine.Vector2 end, KokoEngine.Color color, int size)
        {
            Vector2   start_ = start.ToMonoVector2();
            Vector2   end_   = end.ToMonoVector2();
            Vector2   edge   = end_ - start_;
            float     angle  = (float)Math.Atan2(edge.Y, edge.X);
            Color     color_ = color.ToMonoColor();
            Rectangle destinationRectangle = new Rectangle((int)start.X, (int)start.Y, (int)edge.Length(), size);

            // Draw call
            _spriteBatch.Draw(_dummyTexture, destinationRectangle, null, color_, angle, new Vector2(0, 0), SpriteEffects.None, 0.6f);
        }