Kevin Worth [Sun, 7 Jun 2009 23:07:15 +0000 (19:07 -0400)]
Add "select_mode" to determine if "selection_box.visible" is true or false
If "select_mode" is true(tile not being dragged) then
selection_box.visible is true. Previously this check was done using
"current_tile == -1", which was unclear.
It could be said that it is redundant to set "select_mode" and *then*
set "selection_box.visible" to true, but it very clearly shows what
is being done and when. In addition, checking select_mode may be used
later on with a completely different purpose.
Kevin Worth [Thu, 28 May 2009 14:02:21 +0000 (10:02 -0400)]
First attempt to fix indenting to mix of tabs and spaces
Kevin tried to fix things, and in his emacs the first level
of indent appears to be 3 columns. This commit made so Carl
can try and fix things and push them back
Kevin Worth [Thu, 7 May 2009 19:15:43 +0000 (15:15 -0400)]
Fix tile_group_is_set
Previous version was validating sets with repeat colors.
The error appeared to be an incomplete check through the array;
when num_tiles was 3, it was checking index 0 and 1. Thus, if
index 0 and 2 had the same color, it wasn't being caught.
Kevin Worth [Thu, 7 May 2009 15:06:03 +0000 (11:06 -0400)]
Fix tile group validation functions
tile_group_is_set() has been tested
and appears to be working. No major changes
made here.
tile_group_is_run_one() has been tested and
appears to be working. This version has been
significantly revamped. The concept for the previous
version was "slick" but was flawed. One failure came
from testing a 3 tile group containing a yellow tile.
The yellow tile tried to increment index 3, but the max
index was 2.
no changes made to tile_group_is_run_two() which
has not been tested. It may not be needed unless
it can be shown to be "better" than _is_run_one()
Kevin Worth [Wed, 6 May 2009 23:04:41 +0000 (19:04 -0400)]
Click-n-drag to select multiple tiles
The main purpose here is to facilitate testing of
the functions tile_group_is_set and tile_group_is_run.
Eventually it will be improved for general UI purposes.
Grouped tiles are printed to terminal.
XXX There is a bug here XXX
Selections must:
(a)start above the highest tile and catch all the
top left corners of each tile
OR
(b)start below the lowest tile and catch all the
bottom left corners of each tile
Carl Worth [Thu, 15 Mar 2007 16:25:54 +0000 (09:25 -0700)]
Use the expose event's region to avoid drawing tiles that don't need to be redrawn.
The reason that dragging was so slow before is that the program
was redrawing every single tile every time the mouse moved. Now
we only redraw tiles that are actually affected by the movement.
This is fast enough now that we probably don't even need to add
caches for pre-rendered tiles, (though of course, if we did that
it would be even faster).
Carl Worth [Wed, 14 Mar 2007 14:35:26 +0000 (07:35 -0700)]
Move tile movement/redraw code from on_button_press_event to on_button_motion_event
We queue redraws rather than calling draw_tile directly so that we
only draw in the idle loop, for much better performance, (and for
proper interaction with GTK+'s double buffering).
Carl Worth [Tue, 20 Feb 2007 17:44:35 +0000 (09:44 -0800)]
Fix card_draw for multi-digit tiles.
Previously, for tiles > 9 we were just using the next larger
character values in ACII above '9'. Oops! Now, we're properly
using snprintf to format the number as an integer within the
string.
Carl Worth [Tue, 20 Feb 2007 14:17:50 +0000 (06:17 -0800)]
Temporarily add -Wno-unused-function
Generally, this is a useful warning to have turned on, but for now
while we have some unused functions still in-progress, let's turn it
off so that we can have clean, warning-free compilation.
Carl Worth [Mon, 29 Jan 2007 15:19:33 +0000 (07:19 -0800)]
Implement card_group_is_run with one loop instead of two.
It's simpler to just implement a single check for color in the same
loop that's examining the color of every card. We don't need to
check every pair of cards for matching color as we were in the old
loop.
Carl Worth [Mon, 29 Jan 2007 14:14:50 +0000 (06:14 -0800)]
Add some minimal GTK+ love to kub
This initializes GTK+, creates a window, and establishes 4 callback functions
for handling expose, key press, and button press/release events. So far,
the callbacks are just printing things to stdout and not really doing anything
useful yet.