Utah Raster Toolkit  9999-git
URT Development version (post-3.1b)
Macros | Functions
CenterScreen.c File Reference
#include <intuition/intuition.h>
#include <graphics/gfxbase.h>
Include dependency graph for CenterScreen.c:

Go to the source code of this file.

Macros

#define MAX_X   362
 
#define MAX_Y_NTSC   241
 
#define MAX_Y_PAL   283
 

Functions

void CenterScreen (register struct Screen *screen, int *dx, int *dy)
 

Macro Definition Documentation

#define MAX_X   362

Definition at line 7 of file CenterScreen.c.

#define MAX_Y_NTSC   241

Definition at line 8 of file CenterScreen.c.

#define MAX_Y_PAL   283

Definition at line 9 of file CenterScreen.c.

Function Documentation

void CenterScreen ( register struct Screen screen,
int dx,
int dy 
)

Definition at line 12 of file CenterScreen.c.

13 {
14  int c640, c320, r400, r200, w, h, max_x, max_y;
15  struct Preferences prefs;
16  extern struct GfxBase *GfxBase;
17 
18  GetPrefs(&prefs, sizeof(prefs));
19  c640 = 640 + prefs.ColumnSizeChange;
20  c320 = c640 / 2;
21  r200 = 200 + prefs.RowSizeChange;
22  r400 = r200 * 2;
23 
24  max_y = (GfxBase->DisplayFlags & PAL) ? MAX_Y_PAL : MAX_Y_NTSC;
25  if (screen->ViewPort.Modes & LACE){
26  max_y *= 2;
27  }
28  max_x = MAX_X;
29  if (screen->ViewPort.Modes & HIRES){
30  max_x *= 2;
31  }
32  if (screen->ViewPort.DWidth <= max_x) {
33  w = screen->ViewPort.DWidth;
34  }else{
35  w = max_x;
36  }
37  if (screen->ViewPort.DHeight <= max_y) {
38  h = screen->ViewPort.DHeight;
39  }else{
40  h = max_y;
41  }
42 
43  if (screen->ViewPort.Modes & HIRES){
44  screen->ViewPort.DxOffset += (c640 - w) / 2;
45  *dx = screen->ViewPort.DxOffset / 2;
46  }else{
47  screen->ViewPort.DxOffset += (c320 - w) / 2;
48  *dx = screen->ViewPort.DxOffset;
49  }
50  if (screen->ViewPort.Modes & LACE){
51  screen->ViewPort.DyOffset += (r400 - h) / 2;
52  *dy = screen->ViewPort.DyOffset / 2;
53  }else{
54  screen->ViewPort.DyOffset += (r200 - h) / 2;
55  *dy = screen->ViewPort.DyOffset;
56  }
57 
58  RemakeDisplay();
59 }
struct GfxBase * GfxBase
Definition: getami.c:61
#define MAX_Y_PAL
Definition: CenterScreen.c:9
static struct NewScreen screen
Definition: getami.c:67
int max_y
Definition: unslice.c:42
#define MAX_Y_NTSC
Definition: CenterScreen.c:8
#define MAX_X
Definition: CenterScreen.c:7