Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void mode_7(SDL_Texture *Tile, int ScrollX, int ScrollY, int CenterX, int CenterY, double ScaleX, double ScaleY, double Angle) {
- SDL_SetRenderDrawColor(ScreenRenderer, 64, 64, 64, 255);
- SDL_RenderClear(ScreenRenderer);
- double M7A = +cos(Angle)*ScaleX;
- double M7B = +sin(Angle)*ScaleX;
- double M7C = -sin(Angle)*ScaleY;
- double M7D = +cos(Angle)*ScaleY;
- /*
- ( VRAM.X ) = ( M7A M7B ) * ( ScreenX+ScrollX-CenterX ) + ( CenterX )
- ( VRAM.Y ) ( M7C M7D ) ( ScreenY+ScrollY-CenterY ) ( CenterY )
- */
- for(int ScreenY=0; ScreenY<ScreenHeight; ScreenY++) {
- double temp1 = 0+ScrollX-CenterX;
- double temp2 = ScreenY+ScrollY-CenterY;
- double src_x = M7A*temp1 + M7B*temp2 + CenterX;
- double src_y = M7C*temp1 + M7D*temp2 + CenterY;
- for(int ScreenX=0; ScreenX<ScreenWidth; ScreenX++) {
- blit(Tile, ScreenRenderer, (int)src_x, (int)src_y, ScreenX, ScreenY, 1, 1);
- src_x += M7A;
- src_y += M7C;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement