diff --git a/lib/settings.cpp b/lib/settings.cpp index 10b8874..ab9e089 100644 --- a/lib/settings.cpp +++ b/lib/settings.cpp @@ -4,4 +4,9 @@ Settings::Settings( void ) { colorThreshold[0] = 100; colorThreshold[1] = 1000; + + ul.x = bl.x = ul.y = ur.y = 30; + ur.x = br.x = 610; + br.y = bl.y = 450; + } diff --git a/lib/state.cpp b/lib/state.cpp index 0d7c53a..a970b6f 100644 --- a/lib/state.cpp +++ b/lib/state.cpp @@ -42,16 +42,16 @@ State State::generateState (SDL_Surface *boardImg, Settings settings) int i, j, x, y, r, sum; point p; r = 10; //what kind of magic number is this? - for (i = 0; i < size; i++) { - for (j = 0; j < size; j++) { //for all points: + for (i = 0; i < size; ++i) { + for (j = 0; j < size; ++j) { //for all points: p = positionPoint(i, j, settings); //retrieve the estimated point sum = 0; //TODO: this loop should be placed into its own function! - for (y = p.y-r; y < p.y+r; y++) { - for (x = p.x-r; x < p.x+r; x++) { //for -20 to 20 around the point + for (y = p.y-r; y < p.y+r; ++y) { + for (x = p.x-r; x < p.x+r; ++x) { //for -10 to 10 around the point uint32_t px = PX(boardImg, x, y); - sum += (1024 -PXR(px) - PXG(px) + PXB(px)); //sum up the colors + sum += (PXR(px) + PXG(px) + PXB(px)); //sum up the colors } } sum/=400;