~ubuntu-branches/ubuntu/quantal/xscreensaver/quantal

« back to all changes in this revision

Viewing changes to hacks/fluidballs.c

  • Committer: Bazaar Package Importer
  • Author(s): Ted Gould
  • Date: 2008-08-28 16:15:25 UTC
  • mfrom: (1.1.6 upstream) (2.1.3 lenny)
  • Revision ID: james.westby@ubuntu.com-20080828161525-mxga521aoezxjq8h
Tags: 5.07-0ubuntu1
* Upgrade upstream version
* debian/control: Remove suggest xdaliclock as it is no longer
  included
* Remove 10_jwz-screensaver-randr-patch-3.patch as it has been merged
  upstream.
* Add 24_hacks_xsublim_enable.patch as it seems that xsublim was dropped
  from the build files.  There is nothing in the Changelog about it
  so I believe it was accidental.
* Updating the .desktop files from the XML files using gnome-screensaver's
  utility to do so.  Lots of text updates.  Also:
    * Added: abstractile.desktop
    * Added: cwaves.desktop
    * Added: m6502.desktop
    * Added: skytentacles.desktop
    * Removed: xteevee.desktop
* xscreensaver-gl-extra.files: Added skytentacles
* xscreensaver-data-extra.files: Added abstractile, cwaves and m6502
* xscreensaver-data.files: Remove partial abstractile, m6502 and cwaves

Show diffs side-by-side

added added

removed removed

Lines of Context:
94
94
draw_fps_string (b_state *state)
95
95
{  
96
96
  XFillRectangle (state->dpy, state->b, state->erase_gc,
97
 
                  0, state->xgwa.height - state->font_height,
98
 
                  state->xgwa.width, state->font_height);
 
97
                  0, state->xgwa.height - state->font_height*3 - 20,
 
98
                  state->xgwa.width, state->font_height*3 + 20);
99
99
  XDrawImageString (state->dpy, state->b, state->font_gc,
100
 
                    0, state->xgwa.height - state->font_baseline,
 
100
                    10, state->xgwa.height - state->font_height*2 -
 
101
                    state->font_baseline - 10,
101
102
                    state->fps_str, strlen(state->fps_str));
102
103
}
103
104
 
132
133
  state->xmin = wx;
133
134
  state->ymin = wy;
134
135
  state->xmax = state->xmin + state->xgwa.width;
135
 
  state->ymax = state->ymin + state->xgwa.height - state->font_height;
 
136
  state->ymax = state->ymin + state->xgwa.height - (state->font_height*3) -
 
137
    (state->font_height ? 22 : 0);
136
138
 
137
139
  if (state->dbuf && (state->ba))
138
140
    {
154
156
        XClearWindow (state->dpy, state->window);
155
157
      else if (state->fps_p && oymax != state->ymax)
156
158
        XFillRectangle (state->dpy, state->b, state->erase_gc,
157
 
                        0, state->xgwa.height - state->font_height,
158
 
                        state->xgwa.width, state->font_height);
 
159
                        0, state->xgwa.height - state->font_height*3,
 
160
                        state->xgwa.width, state->font_height*3);
159
161
    }
160
162
}
161
163
 
331
333
  if (state->fps_p)
332
334
    {
333
335
      XFontStruct *font;
334
 
      char *fontname = get_string_resource (dpy, "font", "Font");
335
 
      const char *def_font = "fixed";
336
 
      if (!fontname || !*fontname) fontname = (char *)def_font;
 
336
      char *fontname = get_string_resource (dpy, "fpsFont", "Font");
 
337
      if (!fontname) fontname = "-*-courier-bold-r-normal-*-180-*";
337
338
      font = XLoadQueryFont (dpy, fontname);
338
 
      if (!font) font = XLoadQueryFont (dpy, def_font);
 
339
      if (!font) font = XLoadQueryFont (dpy, "fixed");
339
340
      if (!font) exit(-1);
340
341
      gcv.font = font->fid;
341
342
      gcv.foreground = get_pixel_resource(state->dpy, state->xgwa.colormap,
449
450
          float fps = state->frame_count / elapsed;
450
451
          float cps = state->collision_count / elapsed;
451
452
          
452
 
          sprintf (state->fps_str, 
453
 
                   " FPS: %.2f  Collisions: %.3f/frame  Max motion: %.3f",
454
 
                   fps, cps/fps, max_d);
 
453
          sprintf (state->fps_str, "Collisions: %.3f/frame  Max motion: %.3f",
 
454
                   cps/fps, max_d);
455
455
          
456
456
          draw_fps_string(state);
457
457
        }
763
763
static const char *fluidballs_defaults [] = {
764
764
  ".background:         black",
765
765
  ".foreground:         yellow",
766
 
  ".textColor:          yellow",
 
766
  ".textColor:          white",
767
767
  "*mouseForeground:    white",
768
 
  ".font:               -*-helvetica-*-r-*-*-*-180-*-*-p-*-*-*",
769
768
  "*delay:              10000",
770
769
  "*count:              300",
771
770
  "*size:               25",
774
773
  "*wind:               0.00",
775
774
  "*elasticity:         0.97",
776
775
  "*timeScale:          1.0",
777
 
  "*doFPS:              False",
778
776
  "*shake:              True",
779
777
  "*shakeThreshold:     0.015",
780
778
  "*doubleBuffer:       True",
793
791
  { "-gravity",         ".gravity",     XrmoptionSepArg, 0 },
794
792
  { "-wind",            ".wind",        XrmoptionSepArg, 0 },
795
793
  { "-elasticity",      ".elasticity",  XrmoptionSepArg, 0 },
796
 
  { "-fps",             ".doFPS",       XrmoptionNoArg, "True" },
797
 
  { "-no-fps",          ".doFPS",       XrmoptionNoArg, "False" },
798
794
  { "-shake",           ".shake",       XrmoptionNoArg, "True" },
799
795
  { "-no-shake",        ".shake",       XrmoptionNoArg, "False" },
800
796
  { "-random",          ".random",      XrmoptionNoArg, "True" },
806
802
};
807
803
 
808
804
 
809
 
XSCREENSAVER_MODULE ("Fluidballs", fluidballs)
 
805
XSCREENSAVER_MODULE ("FluidBalls", fluidballs)