home
·
contact
·
privacy
projects
/
plomrogue2-experiments
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add mode line.
[plomrogue2-experiments]
/
new2
/
rogue_chat_nocanvas_monochrome.html
diff --git
a/new2/rogue_chat_nocanvas_monochrome.html
b/new2/rogue_chat_nocanvas_monochrome.html
index 32a3781161f622a21d09c574843f75378454b2e2..02d6d6b48bbff22345af283cac8bee71132707cb 100644
(file)
--- a/
new2/rogue_chat_nocanvas_monochrome.html
+++ b/
new2/rogue_chat_nocanvas_monochrome.html
@@
-152,26
+152,32
@@
let tui = {
input_lines: [],
window_width: terminal.cols / 2,
height_turn_line: 1,
input_lines: [],
window_width: terminal.cols / 2,
height_turn_line: 1,
+ height_mode_line: 1,
height_input: 1,
init: function() {
this.recalc_input_lines();
height_input: 1,
init: function() {
this.recalc_input_lines();
+ this.height_header = this.height_turn_line + this.height_mode_line;
},
switch_mode: function(mode_name, keep_pos=false) {
if (mode_name == 'study' && !keep_pos) {
explorer.position = game.things[game.player_id];
}
this.mode = mode_name;
},
switch_mode: function(mode_name, keep_pos=false) {
if (mode_name == 'study' && !keep_pos) {
explorer.position = game.things[game.player_id];
}
this.mode = mode_name;
+ this.empty_input();
this.full_refresh();
},
this.full_refresh();
},
+ draw_mode_line: function() {
+ terminal.drawBox(1, this.window_width, this.height_mode_line, this.window_width);
+ terminal.write(1, this.window_width, 'MODE ' + this.mode);
+ },
draw_history: function() {
draw_history: function() {
- if (terminal.rows <= this.height_
turn_line
+ this.height_input) {
+ if (terminal.rows <= this.height_
header
+ this.height_input) {
return;
}
return;
}
- terminal.drawBox(this.height_turn_line, this.window_width, terminal.rows - this.height_turn_line - this.height_input, this.window_width);
- console.log(this.log);
- for (let y = terminal.rows - this.height_input - this.height_turn_line,
+ terminal.drawBox(this.height_header, this.window_width, terminal.rows - this.height_header - this.height_input, this.window_width);
+ for (let y = terminal.rows - 1 - this.height_input,
i = this.log.length - 1;
i = this.log.length - 1;
- y >= this.height_
turn_line
&& i >= 0;
+ y >= this.height_
header
&& i >= 0;
y--, i--) {
terminal.write(y, this.window_width, this.log[i]);
}
y--, i--) {
terminal.write(y, this.window_width, this.log[i]);
}
@@
-220,7
+226,11
@@
let tui = {
},
empty_input: function(str) {
this.input = "";
},
empty_input: function(str) {
this.input = "";
- this.recalc_input_lines();
+ if (this.mode == 'annotate' || this.mode == 'chat') {
+ this.recalc_input_lines();
+ } else {
+ this.height_input = 0;
+ }
},
add_to_input: function(str) {
if (this.input.length + str.length > this.window_width * terminal.rows) {
},
add_to_input: function(str) {
if (this.input.length + str.length > this.window_width * terminal.rows) {
@@
-262,7
+272,7
@@
let tui = {
log_msg: function(msg) {
let lines = this.msg_into_lines_of_width(msg, this.window_width);
this.log = this.log.concat(lines);
log_msg: function(msg) {
let lines = this.msg_into_lines_of_width(msg, this.window_width);
this.log = this.log.concat(lines);
- while (this.log.length > terminal.rows
- 2
) {
+ while (this.log.length > terminal.rows) {
this.log.shift();
};
this.draw_history();
this.log.shift();
};
this.draw_history();
@@
-296,15
+306,16
@@
let tui = {
tui.log_msg("");
},
draw_info: function() {
tui.log_msg("");
},
draw_info: function() {
- terminal.drawBox(this.height_
turn_line, this.window_width, terminal.rows - this.height_turn_line
- this.height_input, this.window_width);
+ terminal.drawBox(this.height_
header, this.window_width, terminal.rows - this.height_header
- this.height_input, this.window_width);
let lines = this.msg_into_lines_of_width(explorer.get_info(), this.window_width);
let lines = this.msg_into_lines_of_width(explorer.get_info(), this.window_width);
- for (let y = this.height_
turn_line
, i = 0; y < terminal.rows && i < lines.length; y++, i++) {
+ for (let y = this.height_
header
, i = 0; y < terminal.rows && i < lines.length; y++, i++) {
terminal.write(y, this.window_width, lines[i]);
}
},
full_refresh: function() {
this.draw_map();
this.draw_turn_line();
terminal.write(y, this.window_width, lines[i]);
}
},
full_refresh: function() {
this.draw_map();
this.draw_turn_line();
+ this.draw_mode_line();
if (this.mode == 'study' || this.mode == 'annotate') {
this.draw_info();
} else {
if (this.mode == 'study' || this.mode == 'annotate') {
this.draw_info();
} else {
@@
-529,7
+540,6
@@
document.addEventListener('keydown', (event) => {
tui.full_refresh();
} else if (event.key == 'Enter') {
explorer.annotate(tui.input);
tui.full_refresh();
} else if (event.key == 'Enter') {
explorer.annotate(tui.input);
- tui.empty_input();
tui.switch_mode('study', true);
}
}
tui.switch_mode('study', true);
}
}