• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

A generic touchscreen calibration program for X.Org


Commit MetaInfo

Revision8a56f723d2c806481ee1b24461a3391986ae1728 (tree)
Time2010-01-09 19:13:24
AuthorTias Guns <tias@ulys...>
CommiterTias Guns

Log Message

make the touch points more visuals: draw a cross through them

Change Summary

Incremental Difference

--- a/gui_gtkmm.cpp
+++ b/gui_gtkmm.cpp
@@ -33,6 +33,8 @@ const int time_step = 100; // in milliseconds
3333 const int max_time = 15000; // 5000 = 5 sec
3434
3535 // Clock appereance
36+const int cross_lines = 25;
37+const int cross_circle = 4;
3638 const int clock_radius = 50;
3739 const int clock_line_width = 10;
3840
@@ -92,7 +94,6 @@ CalibrationArea::CalibrationArea(Calibrator* calibrator0)
9294
9395 bool CalibrationArea::on_expose_event(GdkEventExpose *event)
9496 {
95- const double radius = 4;
9697 Glib::RefPtr<Gdk::Window> window = get_window();
9798 if (window) {
9899 Cairo::RefPtr<Cairo::Context> cr = window->create_cairo_context();
@@ -110,19 +111,23 @@ bool CalibrationArea::on_expose_event(GdkEventExpose *event)
110111 cr->stroke();
111112
112113 // Draw the points
113- int i = 0;
114- for (; i < calibrator->get_numclicks(); i++) {
115- cr->arc(X[i], Y[i], radius, 0.0, 2.0 * M_PI);
116- cr->set_source_rgb(1.0, 1.0, 1.0);
117- cr->fill_preserve();
114+ for (int i = 0; i <= calibrator->get_numclicks(); i++) {
115+ // set color: already clicked or not
116+ if (i < calibrator->get_numclicks())
117+ cr->set_source_rgb(1.0, 1.0, 1.0);
118+ else
119+ cr->set_source_rgb(0.8, 0.0, 0.0);
120+
121+ cr->set_line_width(1);
122+ cr->move_to(X[i] - cross_lines, Y[i]);
123+ cr->rel_line_to(cross_lines*2, 0);
124+ cr->move_to(X[i], Y[i] - cross_lines);
125+ cr->rel_line_to(0, cross_lines*2);
118126 cr->stroke();
119- }
120127
121- cr->set_line_width(2);
122- cr->arc(X[i], Y[i], radius, 0.0, 2.0 * M_PI);
123- cr->set_source_rgb(0.8, 0.0, 0.0);
124- //cr->fill_preserve();
125- cr->stroke();
128+ cr->arc(X[i], Y[i], cross_circle, 0.0, 2.0 * M_PI);
129+ cr->stroke();
130+ }
126131
127132 // Draw the clock background
128133 cr->arc(display_width/2, display_height/2, clock_radius/2, 0.0, 2.0 * M_PI);
@@ -132,7 +137,7 @@ bool CalibrationArea::on_expose_event(GdkEventExpose *event)
132137
133138 cr->set_line_width(clock_line_width);
134139 cr->arc(display_width/2, display_height/2, (clock_radius - clock_line_width)/2,
135- 0.0, 2.0 * M_PI * (double)time_elapsed/(double)max_time);
140+ 3/2.0*M_PI, (3/2.0*M_PI) + ((double)time_elapsed/(double)max_time) * 2*M_PI);
136141 cr->set_source_rgb(0.0, 0.0, 0.0);
137142 cr->stroke();
138143