-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
main screen, with a button that starts the game
- Loading branch information
Showing
5 changed files
with
114 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,21 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
<string name="app_name">AngryPipes</string> | ||
<string name="app_name"> | ||
AngryPipes | ||
</string> | ||
<string name="intro"> | ||
The pipes are angry.\n\n | ||
Someone bad has scrambled them,\n | ||
and now they\'re all disconnected.\n\n | ||
Connect them again to make them happy!\n\n\n | ||
</string> | ||
<string name="play"> | ||
PLAY | ||
</string> | ||
<string name="settings"> | ||
Settings | ||
</string> | ||
<string name="about"> | ||
About | ||
</string> | ||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package org.ninehells.angrypipes; | ||
|
||
import android.app.Activity; | ||
import android.os.Bundle; | ||
import android.content.SharedPreferences; | ||
import android.widget.HorizontalScrollView; | ||
import android.widget.ScrollView; | ||
|
||
import org.ninehells.angrypipes.Board; | ||
import org.ninehells.angrypipes.View; | ||
|
||
public class Game extends Activity | ||
{ | ||
@Override | ||
public void onCreate(Bundle state) | ||
{ | ||
super.onCreate(state); | ||
|
||
mPreferences = getPreferences(MODE_PRIVATE); | ||
mBoard = new Board( | ||
mPreferences.getInt("width", 20), | ||
mPreferences.getInt("height", 30), | ||
mPreferences.getString("board", "").getBytes() | ||
); | ||
|
||
View view = new View(this); | ||
view.setBoard(mBoard); | ||
|
||
ScrollView verticalScroll = new ScrollView(this); | ||
HorizontalScrollView horizontalScroll = new HorizontalScrollView(this); | ||
horizontalScroll.addView(view); | ||
verticalScroll.addView(horizontalScroll); | ||
setContentView(verticalScroll); | ||
} | ||
|
||
@Override | ||
public void onPause() | ||
{ | ||
super.onPause(); | ||
|
||
SharedPreferences.Editor ed = mPreferences.edit(); | ||
ed.putInt("width", mBoard.width()); | ||
ed.putInt("height", mBoard.height()); | ||
ed.putString("board", new String(mBoard.serialize())); | ||
ed.commit(); | ||
} | ||
|
||
private Board mBoard; | ||
private SharedPreferences mPreferences; | ||
} | ||
|
||
// vim600:fdm=syntax:fdn=2:nu: |