Recognizes if input is ogg or not.
[xiph/unicode.git] / planarity / gameboard_draw_curtain.c
blobbb7ae86f85f0f1b99f9ead79bf49c28b78e99ae0
1 /*
3 * gPlanarity:
4 * The geeky little puzzle game with a big noodly crunch!
5 *
6 * gPlanarity copyright (C) 2005 Monty <monty@xiph.org>
7 * Original Flash game by John Tantalo <john.tantalo@case.edu>
8 * Original game concept by Mary Radcliffe
10 * gPlanarity is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2, or (at your option)
13 * any later version.
15 * gPlanarity is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with Postfish; see the file COPYING. If not, write to the
22 * Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
27 #define _GNU_SOURCE
28 #include <gtk/gtk.h>
29 #include <gtk/gtkmain.h>
30 #include <gdk/gdk.h>
31 #include <gdk/gdkx.h>
32 #include <stdlib.h>
33 #include <math.h>
34 #include <string.h>
36 #include "graph.h"
37 #include "gameboard.h"
39 /* cache the curtain surface/pattern ******************************/
41 #define CW 4
42 void cache_curtain(Gameboard *g){
43 int x,y;
44 cairo_t *c;
45 g->curtains=
46 cairo_surface_create_similar (cairo_get_target (g->wc),
47 CAIRO_CONTENT_COLOR_ALPHA,
48 CW,CW);
50 c = cairo_create(g->curtains);
51 cairo_save(c);
52 cairo_set_operator(c,CAIRO_OPERATOR_CLEAR);
53 cairo_set_source_rgba (c, 1,1,1,1);
54 cairo_paint(c);
55 cairo_restore(c);
57 cairo_set_line_width(c,1);
58 cairo_set_source_rgba (c, 0,0,0,.5);
60 for(y=0;y<CW;y++){
61 for(x=y&1;x<CW;x+=2){
62 cairo_move_to(c,x+.5,y);
63 cairo_rel_line_to(c,0,1);
66 cairo_stroke(c);
67 cairo_destroy(c);
69 g->curtainp=cairo_pattern_create_for_surface (g->curtains);
70 cairo_pattern_set_extend (g->curtainp, CAIRO_EXTEND_REPEAT);
74 void draw_curtain(Gameboard *g){
76 cairo_t *c = cairo_create(g->background);
78 cairo_set_source (c, g->curtainp);
79 cairo_paint(c);
80 cairo_destroy(c);