changes to textbox
This commit is contained in:
parent
a36c8759c1
commit
f6c1059250
@ -6,8 +6,8 @@ pub mod sql;
|
||||
#[get("/")]
|
||||
fn test() -> String {
|
||||
sql::create_database()
|
||||
.expect(&format!("couldn't create database"));
|
||||
format!("Hello world")
|
||||
.expect("couldn't create database");
|
||||
String::from("Hello World!")
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
@ -45,5 +45,5 @@ fn rocket() -> Rocket<Build> {
|
||||
rocket::build()
|
||||
.mount("/test", routes![test]) // testing only, should return "Hello world"
|
||||
.mount("/api", routes![post_test])
|
||||
.mount("/", FileServer::from(relative!("website"))) // hosts the fileserver
|
||||
.mount("/typing", FileServer::from(relative!("website"))) // hosts the fileserver
|
||||
}
|
BIN
website/.DS_Store
vendored
Normal file
BIN
website/.DS_Store
vendored
Normal file
Binary file not shown.
@ -11,10 +11,11 @@
|
||||
<script src="./index.js" type="text/javascript"></script>
|
||||
|
||||
<!-- Element Script Files -->
|
||||
<script src="./ui_elements/button.js"></script>
|
||||
<script src="./ui_elements/canvas.js"></script>
|
||||
<script src="./ui_elements/textbox.js"></script>
|
||||
<script src="./ui_elements/timemenu.js"></script>
|
||||
<script src="./ui_elements/timer.js"></script>
|
||||
<script src="./ui_elements/button.js"></script>
|
||||
|
||||
<!-- Screen Files-->
|
||||
<script src="./screens/screenmanager.js"></script>
|
||||
|
@ -1,4 +1,17 @@
|
||||
class Textbox {
|
||||
/**
|
||||
* Creates a new instance of the Textbox class
|
||||
* @param {int} pX
|
||||
* @param {int} pY
|
||||
* @param {int} pWidth
|
||||
* @param {int} pHeight
|
||||
* @param {int} pLayer
|
||||
* @param {bool} pVisible
|
||||
* @param {hexcode} pTextColor
|
||||
* @param {bool} pBorder
|
||||
* @param {hexcode} pBorderColor
|
||||
* @param {hexcode} pBackgroundColor
|
||||
*/
|
||||
constructor(pX, pY, pWidth, pHeight, pLayer, pVisible, pTextColor, pBorder, pBorderColor, pBackgroundColor) {
|
||||
this.x = pX;
|
||||
this.y = pY;
|
||||
@ -108,13 +121,22 @@ class Textbox {
|
||||
this.letters = pLetters;
|
||||
}
|
||||
|
||||
/**
|
||||
* takes a key and handles it in the textbox
|
||||
* @param {String} pKey
|
||||
* @returns
|
||||
*/
|
||||
letterTyped(pKey) {
|
||||
if (pKey === "Enter" && (screenManager.screen.constructor.name === "StartScreen" || screenManager.screen.constructor.name === "EndScreen")) {
|
||||
if (pKey === "Enter" && (screenManager.screen.constructor.name === "StartScreen" /* || screenManager.screen.constructor.name === "EndScreen" */)) {
|
||||
screenManager.setScreen(new TestScreen());
|
||||
return;
|
||||
}
|
||||
|
||||
if (pKey === "Backspace" && this.letters.length > 1) {
|
||||
if (screenManager.timer.time === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (pKey === "Backspace" && this.letters.length > 0) {
|
||||
this.letters.pop();
|
||||
return;
|
||||
}
|
||||
@ -143,6 +165,10 @@ class Textbox {
|
||||
this.allowedLetters = pAllowedLetters;
|
||||
}
|
||||
|
||||
/**
|
||||
* draws a Textbox
|
||||
* @returns
|
||||
*/
|
||||
draw() {
|
||||
// doesn't render the textbox if it should not be visible to the user.
|
||||
if (!this.visible) {
|
||||
|
5
website/ui_elements/timemenu.js
Normal file
5
website/ui_elements/timemenu.js
Normal file
@ -0,0 +1,5 @@
|
||||
class TimeMenu {
|
||||
constructor() {
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user