[comp.sys.amiga.tech] Screen Centering Gadget within C

uzun@pnet01.cts.com (Roger Uzun) (12/08/89)

How can one read and set the screen centering gadget, the one set in
preferences, from within a C program.  I have a program that needs all
7 sprites to be visible, and I want to read the screen centering
gadgets position, reset it to lower right, then reset it upon
exit/pause.
-Roger

UUCP: {hplabs!hp-sdd ucsd nosc}!crash!pnet01!uzun
ARPA: crash!pnet01!uzun@nosc.mil
INET: uzun@pnet01.cts.com

addison@pollux.usc.edu (Richard Addison) (12/10/89)

In article <857@crash.cts.com> uzun@pnet01.cts.com (Roger Uzun) writes:
>How can one read and set the screen centering gadget, the one set in
>preferences, from within a C program.  I have a program that needs all
>7 sprites to be visible, and I want to read the screen centering
>gadgets position, reset it to lower right, then reset it upon
>exit/pause.
>-Roger

Better yet:

  struct View *View;
  struct Screen *Screen;
  struct NewScreen NewScreen = { ... };

  if (!(Screen = OpenScreen(&NewScreen))
    Fini("Could not open custom screen");
  View = ViewAddress();
  dxoffset = /* Calculate necessary offset from View->DxOffset &
              * Screen->ViewPort.DxOffset */;
  if (dxoffset > 0)
  {
    Screen->LeftEdge = dxoffset;
    Screen->ViewPort.DxOffset = dxoffset;
    MakeScreen(Screen);  /* May not be necessary, I'd have to check */
    RethinkDisplay();
  }

Please do not shift everything over just because you want sprites on
your custom screen.  Some of us use 'morerows' screens, and shifting
everything over might mean that some of the 'morerows' screens would
be cut off on the right.

Wish for 1.4 (or what ever version that wishes may be made for):
  Make intuition fully utilize LeftEdge in NewScreen & Screen.  Also,
  add flags to say "center this screen according to preferences" and
  "shift this screen enough to handle all sprites."

  Oh, yeah:  Fix user copper list stuff so that the portion of the
  user copper list with CWait()s beyond the bottom of the visible
  portion of the screen is ignored!  Likewise, sprites should belong
  to individual screens, and move with them, instead of belonging
  to the view.

Richard Addison