1 #include <intuition/intuition.h>
2 #include <graphics/gfxbase.h>
4 #include <proto/intuition.h>
12 CenterScreen(
register struct Screen *screen,
int *dx,
int *dy)
14 int c640, c320, r400, r200, w, h, max_x, max_y;
15 struct Preferences prefs;
16 extern struct GfxBase *GfxBase;
18 GetPrefs(&prefs,
sizeof(prefs));
19 c640 = 640 + prefs.ColumnSizeChange;
21 r200 = 200 + prefs.RowSizeChange;
25 if (screen->ViewPort.Modes & LACE){
29 if (screen->ViewPort.Modes & HIRES){
32 if (screen->ViewPort.DWidth <= max_x) {
33 w = screen->ViewPort.DWidth;
37 if (screen->ViewPort.DHeight <= max_y) {
38 h = screen->ViewPort.DHeight;
43 if (screen->ViewPort.Modes & HIRES){
44 screen->ViewPort.DxOffset += (c640 - w) / 2;
45 *dx = screen->ViewPort.DxOffset / 2;
47 screen->ViewPort.DxOffset += (c320 - w) / 2;
48 *dx = screen->ViewPort.DxOffset;
50 if (screen->ViewPort.Modes & LACE){
51 screen->ViewPort.DyOffset += (r400 - h) / 2;
52 *dy = screen->ViewPort.DyOffset / 2;
54 screen->ViewPort.DyOffset += (r200 - h) / 2;
55 *dy = screen->ViewPort.DyOffset;