public SpriteComponent(Transformation2D transformation, int ZValue = 0)
 {
     _visible        = true;
     _ZValue         = ZValue;
     _flipTextures   = false;
     _transformation = transformation;
     _animationChain = new List <Texture>();
 }
Exemplo n.º 2
0
        public void DrawTexture(Texture texture, Transformation2D transformation, bool flip)
        {
            SDL.SDL_Point center;
            SDL.SDL_Rect  sourceRect   = texture.SourceRectangle;
            SDL.SDL_Rect  renderRect   = texture.RenderRectangle;
            double        angleDegrees = transformation.RotationRadians * _rad2deg;

            renderRect.x = (int)transformation.Position.X;
            renderRect.y = (int)transformation.Position.Y;
            center.x     = (renderRect.w) / 2;
            center.y     = (renderRect.h) / 2;
            SDL.SDL_RendererFlip renderFlip = flip ? SDL.SDL_RendererFlip.SDL_FLIP_HORIZONTAL : SDL.SDL_RendererFlip.SDL_FLIP_NONE;
            SDL.SDL_RenderCopyEx(_renderer, texture.SDLTexture, ref sourceRect, ref renderRect, angleDegrees, ref center, renderFlip);
        }
Exemplo n.º 3
0
 public GameObject()
 {
     _components     = new List <Component>();
     _transformation = new Transformation2D();
 }