Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also .

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also .
base repository: HaikuArchives/LightsOff
base: 65ed4cfd24df
head repository: HaikuArchives/LightsOff
compare: a517e5b7825a
  • 2 commits
  • 2 files changed
  • 0 commit comments
  • 1 contributor
Showing with 34 additions and 21 deletions.
  1. +32 −14 src/GridView.cpp
  2. +2 −7 src/GridView.h
@@ -1,20 +1,18 @@
#include "GridView.h"

#include <stdio.h>
#include <stdlib.h> // srandom

#include <Alert.h>
#include <Entry.h>
#include <Roster.h>
#include <MenuBar.h>
#include <MenuItem.h>
#include <Path.h>
#include <String.h>
#include <Roster.h>
#include <TranslationUtils.h>
#include <TranslatorFormats.h>

#include <stdio.h>
#include <stdlib.h>

#include "AboutWindow.h"
#include "GridView.h"
#include "Preferences.h"
#include "PuzzlePack.h"

enum
{
@@ -28,7 +26,7 @@ enum
M_SHOW_MANUAL
};

PuzzlePackSet gPuzzles;
static PuzzlePackSet gPuzzles;

static const float gridMargin = 50;
static const int8 minDimension = 3;
@@ -561,22 +559,42 @@ void GridView::SetLevel(int8 level)
fLevelLabel->SetText(label);
fLevelLabel->ResizeToPreferred();

if (fPuzzle)
const bool isHidden = Window()->IsHidden();

if (!isHidden) {
fGrid->SetGridValues(0);
UpdateButtons();
Window()->UpdateIfNeeded();
snooze(2e5);
}

if (fPuzzle) {
fGrid->SetGridValues(fPuzzle->ValueAt(level));
else {
if (!Window()->IsHidden())

if (isHidden)
UpdateButtons();
else
for (int8 index = 0; index < fDimension * fDimension; index++)
if (fGrid->ValueAt(index)) {
fButtons[index]->SetState(true);
Window()->UpdateIfNeeded();
snooze(5e4);
}
} else {
if (!isHidden)
for (int8 i = 0; i < 4; i++) {
fGrid->Random(fDimension + 1);
fGrid->Random(fDimension);
UpdateButtons();
Window()->UpdateIfNeeded();
snooze(1e5);
}

lastLevels[fDimension - minDimension] = level;
fGrid->Random(numMoves);
UpdateButtons();
}

fPuzzleValues = fGrid->GetGridValues();
UpdateButtons();

BMenuItem *current = fLevelMenu->ItemAt(level);
current->SetMarked(true);
@@ -1,18 +1,13 @@
#ifndef GRID_VIEW_H
#define GRID_VIEW_H

#include <vector>

#include <View.h>
#include <Message.h>
#include <FileGameSound.h>
#include <Menu.h>
#include <StringView.h>
#include <List.h>
#include <FileGameSound.h>

#include "TwoStateDrawButton.h"
#include "Grid.h"
#include "PuzzlePack.h"
#include "TwoStateDrawButton.h"

class GridView : public BView
{

No commit comments for this range

You can’t perform that action at this time.