Kevin Worth [Sat, 4 Jul 2009 04:48:31 +0000 (00:48 -0400)]
Highlight and un-highlight tiles as they are selected and unselected with the click and drag selection box
This code works but could stand a once through
to check for redundancies, dead code, and/or places
for optimization. Rendering slows down dramatically
as the selection box gets bigger and more tiles are
selected.
Kevin Worth [Fri, 3 Jul 2009 16:44:12 +0000 (12:44 -0400)]
Allow selection of tile by including any edge of tile and highlight selected files.
A group of tiles can be selected by overlapping
the selection box and any edge(not including a corner)
of each tile.
Highlighting on the fly is currently buggy. Selected tiles
remain highlighted even once they are no longer within
the selection box and even after an empty space or other tile
is clicked.
Kevin Worth [Tue, 30 Jun 2009 16:27:21 +0000 (12:27 -0400)]
Highlight tile when clicked and/or dragged.
New .svg file added(highlighted version of tile)
A tile is highlighted when clicked and remains highlighted until
another tile or empty space is clicked.
Kevin Worth [Fri, 12 Jun 2009 13:54:26 +0000 (09:54 -0400)]
Allow selection of a tile by including any corner
A group of tiles can now be selected by overlapping the
selection_box with any corner of each tile(top-left,
bottom-right, etc)
Bug fix: previously, the corners of the selection_box were
not being updated if the mouse was clicked without being
dragged. Now, with each click, x2 is set equal to x1, and
y2 to y1. Then, as before, they are updated as the mouse
is dragged.
Kevin Worth [Fri, 12 Jun 2009 12:27:17 +0000 (08:27 -0400)]
Fix tile dragging
With the newly implemented "select_mode", it is now necessary to change
select_mode as soon as "on_button_press_event" realizes a tile has
been clicked on.
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.