627 glDisable(GL_TEXTURE_2D); |
628 glDisable(GL_TEXTURE_2D); |
628 {$ENDIF} |
629 {$ENDIF} |
629 end; |
630 end; |
630 |
631 |
631 procedure UpdateViewLimits(); |
632 procedure UpdateViewLimits(); |
632 var tmp: real; |
633 var tmp: LongInt; |
633 begin |
634 begin |
634 // cScaleFactor is 2.0 on "no zoom" |
635 // cScaleFactor is 2.0 on "no zoom" |
635 tmp:= cScreenWidth / cScaleFactor; |
636 tmp:= round(0.5 + cScreenWidth / cScaleFactor); |
636 ViewRightX:= 1 + round(tmp); |
637 ViewRightX := tmp; |
637 ViewLeftX:= round(-tmp); |
638 ViewLeftX := -tmp; |
638 tmp:= cScreenHeight / cScaleFactor; |
639 tmp:= round(0.5 + cScreenHeight / cScaleFactor); |
639 ViewBottomY:= 1 + round(tmp) + cScreenHeight div 2; |
640 ViewBottomY:= tmp + cScreenHeight div 2; |
640 ViewTopY:= round(-tmp) + cScreenHeight div 2; |
641 ViewTopY := -tmp + cScreenHeight div 2; |
641 |
642 |
642 // visual debugging fun :D |
643 // visual debugging fun :D |
643 if cViewLimitsDebug then |
644 if cViewLimitsDebug then |
644 begin |
645 begin |
645 // some margin on each side |
646 // some margin on each side |
646 tmp:= min(cScreenWidth, cScreenHeight) div 2 / cScaleFactor; |
647 tmp:= trunc(min(cScreenWidth, cScreenHeight) div 2 / cScaleFactor); |
647 ViewLeftX := ViewLeftX + trunc(tmp); |
648 ViewLeftX := ViewLeftX + trunc(tmp); |
648 ViewRightX := ViewRightX - trunc(tmp); |
649 ViewRightX := ViewRightX - trunc(tmp); |
649 ViewBottomY:= ViewBottomY - trunc(tmp); |
650 ViewBottomY:= ViewBottomY - trunc(tmp); |
650 ViewTopY := ViewTopY + trunc(tmp); |
651 ViewTopY := ViewTopY + trunc(tmp); |
651 end; |
652 end; |