public SDLImage loadImage(string path) { SDLImage image = null; IntPtr texture = IntPtr.Zero; texture = SDL_image.IMG_LoadTexture(this.mRenderer, path); if (texture != IntPtr.Zero) { image = new SDLImage(texture); } return(image); }
public void drawImage(SDLImage image) { SDL.SDL_Rect dstRect; float x; float y; x = image.x; switch (image.horizontalAlignment) { case SDLCommon.SDLHorizontalAlignment.CENTER: x -= image.width / 2; break; case SDLCommon.SDLHorizontalAlignment.RIGHT: x -= image.width; break; } dstRect.x = (int)(x * image.scale); y = image.y; switch (image.verticalAlignment) { case SDLCommon.SDLVerticalAlignment.CENTER: y -= image.height / 2; break; case SDLCommon.SDLVerticalAlignment.BOTTOM: y -= image.height; break; } dstRect.y = (int)(y * image.scale); dstRect.w = (int)(image.width * this.mScale); dstRect.h = (int)(image.height * this.mScale); SDL.SDL_RenderCopy(this.mRenderer, image.texture, IntPtr.Zero, ref dstRect); }