diff options
author | Alexis211 <alexis211@gmail.com> | 2009-11-29 12:30:07 +0100 |
---|---|---|
committer | Alexis211 <alexis211@gmail.com> | 2009-11-29 12:30:07 +0100 |
commit | 74dea7d492d6d352bfacb147b1c08ad0cf0a8b29 (patch) | |
tree | f613c8395b75a68e51d69c24eb3acdb0816ad509 /Source/Applications | |
parent | d3e4ef59cbb45f02e07fe17fb7c58cba3c737900 (diff) | |
parent | a913d4c2cb4daf10c0eac4d548fccb26b2a9f099 (diff) | |
download | Melon-74dea7d492d6d352bfacb147b1c08ad0cf0a8b29.tar.gz Melon-74dea7d492d6d352bfacb147b1c08ad0cf0a8b29.zip |
Merge branch 'mountpoints' of github.com:Alexis211/Melon into mountpoints
Diffstat (limited to 'Source/Applications')
-rw-r--r-- | Source/Applications/Demos/GOL.cpp | 11 | ||||
-rw-r--r-- | Source/Applications/PaperWork/main.cpp | 7 |
2 files changed, 14 insertions, 4 deletions
diff --git a/Source/Applications/Demos/GOL.cpp b/Source/Applications/Demos/GOL.cpp index 32eb30a..e6da3a6 100644 --- a/Source/Applications/Demos/GOL.cpp +++ b/Source/Applications/Demos/GOL.cpp @@ -1,6 +1,7 @@ #include <Binding/VirtualTerminal.class.h> #include <Binding/Thread.class.h> #include <String.class.h> +#include <ByteArray.class.h> #include <Rand.ns.h> int main(Vector<String> args) { @@ -22,7 +23,7 @@ int main(Vector<String> args) { } } - char *tmp = new char[w * h + 1]; + ByteArray tmp((w + 1) * (h + 1)); bool run = true; while (run) { @@ -37,7 +38,7 @@ int main(Vector<String> args) { } } outvt.moveCursor(0, 0); - outvt << String(tmp, w*h) << "Press Ctrl+h for help"; + outvt << tmp.toString() << "Press Ctrl+h for help"; //Compute next generation for (int y = 0; y < h; y++) { @@ -82,12 +83,16 @@ int main(Vector<String> args) { u64int y = Rand::rand() * h / Rand::max(); cells[x * h + y] = true; } + } else if (kp.character == WChar("p")) { + outvt << " [PAUSED] press a key to resume"; + invt.getKeypress(); } else if (kp.character == WChar("h")) { outvt << "\n\n** Melon's demo Game Of Life Simulator help :\n"; outvt << " - ctrl+c : quit\n"; outvt << " - ctrl+h : show this\n"; + outvt << " - ctrl+p : pause\n"; outvt << " - ctrl+r : add some random cells\n"; - outvt << " - ctrl+R : add more cells, but not random\n\n"; + outvt << " - ctrl+R : add more cells, still random\n\n"; outvt << "Press any key to return to simultaor..."; invt.getKeypress(); } diff --git a/Source/Applications/PaperWork/main.cpp b/Source/Applications/PaperWork/main.cpp index 1a4c1c7..2fb40df 100644 --- a/Source/Applications/PaperWork/main.cpp +++ b/Source/Applications/PaperWork/main.cpp @@ -1,6 +1,8 @@ #include <Binding/Process.class.h> #include <String.class.h> +#define DEFAULT_SHELL "/Applications/Shell/Shell.app" + int main(Vector<String> args) { String act = "init"; if (args.size() == 2) { @@ -36,7 +38,10 @@ int main(Vector<String> args) { outvt << "Authentication failed.\n\n"; continue; } - Process p = Process::run("/Applications/Shell/Shell.app"); + outvt << "What shell to run [" << DEFAULT_SHELL << "]? "; + String sh = invt.readLine(); + if (sh == "") sh = DEFAULT_SHELL; + Process p = Process::run(sh); if (p.valid()) { p.setInVT(invt); p.setOutVT(outvt); |