[cairo-commit]
cairo-demo/sproing ChangeLog, 1.7, 1.8 sproing.c, 1.6, 1.7
Kristian Hogsberg
commit at pdx.freedesktop.org
Mon Mar 28 16:39:05 PST 2005
- Previous message: [cairo-commit]
cairo/src Makefile.am, 1.43, 1.44 cairo_array.c, 1.2,
NONE cairo_atsui_font.c, 1.4, NONE cairo_cache.c, 1.8,
NONE cairo_color.c, 1.13, NONE cairo_fixed.c, 1.10,
NONE cairo_font.c, 1.38, NONE cairo_ft_font.c, 1.49,
NONE cairo_glitz_surface.c, 1.27, NONE cairo_gstate.c, 1.97,
NONE cairo_hull.c, 1.8, NONE cairo_image_surface.c, 1.29,
NONE cairo_matrix.c, 1.21, NONE cairo_output_stream.c, 1.1,
NONE cairo_path.c, 1.24, NONE cairo_path_bounds.c, 1.17,
NONE cairo_path_data.c, 1.2, NONE cairo_path_fill.c, 1.18,
NONE cairo_path_stroke.c, 1.24, NONE cairo_pattern.c, 1.27,
NONE cairo_pdf_surface.c, 1.22, NONE cairo_pen.c, 1.22,
NONE cairo_polygon.c, 1.12, NONE cairo_ps_surface.c, 1.28,
NONE cairo_quartz_surface.c, 1.4, NONE cairo_slope.c, 1.8,
NONE cairo_spline.c, 1.14, NONE cairo_surface.c, 1.49,
NONE cairo_traps.c, 1.23, NONE cairo_unicode.c, 1.1,
NONE cairo_wideint.c, 1.4, NONE cairo_win32_font.c, 1.10,
NONE cairo_win32_surface.c, 1.12, NONE cairo_xcb_surface.c,
1.20, NONE cairo_xlib_surface.c, 1.52, NONE
- Next message: [cairo-commit] cairo ChangeLog,1.457,1.458
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Committed by: krh
Update of /cvs/cairo/cairo-demo/sproing
In directory gabe:/tmp/cvs-serv19705
Modified Files:
ChangeLog sproing.c
Log Message:
2005-03-28 Kristian Høgsberg <krh at redhat.com>
* sproing.c (model_step_object): Add simplistic collision
detection experiment.
Index: ChangeLog
===================================================================
RCS file: /cvs/cairo/cairo-demo/sproing/ChangeLog,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- ChangeLog 28 Mar 2005 20:29:14 -0000 1.7
+++ ChangeLog 29 Mar 2005 00:39:03 -0000 1.8
@@ -1,3 +1,8 @@
+2005-03-28 Kristian Høgsberg <krh at redhat.com>
+
+ * sproing.c (model_step_object): Add simplistic collision
+ detection experiment.
+
2005-03-28 Carl Worth <cworth at cworth.org>
* sproing.c: (model_step_object), (sproing_button_release_event),
Index: sproing.c
===================================================================
RCS file: /cvs/cairo/cairo-demo/sproing/sproing.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- sproing.c 28 Mar 2005 20:29:15 -0000 1.6
+++ sproing.c 29 Mar 2005 00:39:03 -0000 1.7
@@ -23,6 +23,9 @@
#define DEFAULT_SPRING_K 15.0
#define DEFAULT_FRICTION 4.2
+#define WALL_X 400
+#define WALL_Y 300
+
struct _Spring {
Object *a;
Object *b;
@@ -269,6 +272,16 @@
object->position.x += object->velocity.x;
object->position.y += object->velocity.y;
+
+ if (object->position.x > WALL_X) {
+ object->position.x = WALL_X - (object->position.x - WALL_X) * 0.7;
+ object->velocity.x = -object->velocity.x * 0.3;
+ }
+
+ if (object->position.y > WALL_Y) {
+ object->position.y = WALL_Y - (object->position.y - WALL_Y) * 0.7;
+ object->velocity.y = -object->velocity.y * 0.3;
+ }
}
object->force.x = 0.0;
@@ -499,6 +512,21 @@
}
#endif
+static void
+draw_wall (GtkWidget *widget)
+{
+ cairo_t *cr;
+
+ cr = begin_paint (widget->window);
+
+ cairo_move_to (cr, 0, WALL_Y);
+ cairo_line_to (cr, WALL_X, WALL_Y);
+ cairo_line_to (cr, WALL_X, 0);
+ cairo_stroke (cr);
+
+ end_paint (cr);
+}
+
static gboolean
sproing_expose_event (GtkWidget *widget,
GdkEventExpose *event,
@@ -524,7 +552,9 @@
model->objects[i].position.y, model->objects[i].theta, &blue);
}
#endif
-
+
+ draw_wall (widget);
+
return TRUE;
}
- Previous message: [cairo-commit]
cairo/src Makefile.am, 1.43, 1.44 cairo_array.c, 1.2,
NONE cairo_atsui_font.c, 1.4, NONE cairo_cache.c, 1.8,
NONE cairo_color.c, 1.13, NONE cairo_fixed.c, 1.10,
NONE cairo_font.c, 1.38, NONE cairo_ft_font.c, 1.49,
NONE cairo_glitz_surface.c, 1.27, NONE cairo_gstate.c, 1.97,
NONE cairo_hull.c, 1.8, NONE cairo_image_surface.c, 1.29,
NONE cairo_matrix.c, 1.21, NONE cairo_output_stream.c, 1.1,
NONE cairo_path.c, 1.24, NONE cairo_path_bounds.c, 1.17,
NONE cairo_path_data.c, 1.2, NONE cairo_path_fill.c, 1.18,
NONE cairo_path_stroke.c, 1.24, NONE cairo_pattern.c, 1.27,
NONE cairo_pdf_surface.c, 1.22, NONE cairo_pen.c, 1.22,
NONE cairo_polygon.c, 1.12, NONE cairo_ps_surface.c, 1.28,
NONE cairo_quartz_surface.c, 1.4, NONE cairo_slope.c, 1.8,
NONE cairo_spline.c, 1.14, NONE cairo_surface.c, 1.49,
NONE cairo_traps.c, 1.23, NONE cairo_unicode.c, 1.1,
NONE cairo_wideint.c, 1.4, NONE cairo_win32_font.c, 1.10,
NONE cairo_win32_surface.c, 1.12, NONE cairo_xcb_surface.c,
1.20, NONE cairo_xlib_surface.c, 1.52, NONE
- Next message: [cairo-commit] cairo ChangeLog,1.457,1.458
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the cairo-commit
mailing list