diff --git a/source/libraries/noble/.docs/.ldoc/config.ldoc b/source/libraries/noble/.docs/.ldoc/config.ldoc deleted file mode 100644 index 2a3611c..0000000 --- a/source/libraries/noble/.docs/.ldoc/config.ldoc +++ /dev/null @@ -1,26 +0,0 @@ -title = 'Noble Engine API reference' - -project = 'Noble Engine' -description = 'A li\'l game engine for Playdate.' - -format = 'markdown' - -no_lua_ref = true -wrap = true -no_space_before_args = true -backtick_references = true - -dir = '../../.docs' -file = { - '../../', - exclude = { - '../../.lua', - '../../.luarocks', - '../../.docs' - } -} - -style = "." -template = "." - -examples = "../../templates" \ No newline at end of file diff --git a/source/libraries/noble/.docs/.ldoc/ldoc.css b/source/libraries/noble/.docs/.ldoc/ldoc.css deleted file mode 100644 index e1dca6e..0000000 --- a/source/libraries/noble/.docs/.ldoc/ldoc.css +++ /dev/null @@ -1,524 +0,0 @@ -@import url(https://fonts.googleapis.com/css?family=Quicksand:300,700); -@import url(https://fonts.googleapis.com/css?family=Lato); -@import url(https://fonts.googleapis.com/css2?family=Source+Code+Pro:wght@200;300;400;600;700;900&display=swap); -* { - -webkit-box-sizing: border-box; - box-sizing: border-box; -} - -body { - margin: 2em; - font-family: "Lato", arial, helvetica, geneva, sans-serif; - background-color: #ffcb1f; - color: #31302f; -} - -code, -tt { - font-family: "Source Code Pro", monospace; - font-size: 1.1em; - letter-spacing: -1px; - font-weight: 600; - color: #056d8d; -} - -span.types:before { - content: ": "; -} - -span.types:after { - content: ""; -} - -.type, -.default, -.optional { - color: #74726e; -} - -.default .value { - font-weight: bold; -} - -.parameters { - list-style-type: none; -} - -.parameters li { - margin-bottom: 10px; - line-height: 1.5em; -} - -.parameter { - font-weight: 600; - color: #045771; -} - -body, td, th { - font-size: .95em; - line-height: 1.2em; -} - -p, ul { - margin: 10px 0 0 0px; -} - -ul { - padding-left: 25px; -} - -strong { - font-weight: bold; -} - -em { - font-style: italic; -} - -.logo { - width: 100%; - background-image: url("logo.png"); - background-repeat: no-repeat; - background-position: center; - height: 150px; -} - -.logo h1 { - display: none; -} - -h1 { - font-family: 'Quicksand', sans-serif; - font-weight: bold; - color: #cf5a5a; - font-size: 2.5em; - margin: 20px 0 30px 0; -} - -h2, h3, h4 { - font-family: 'Quicksand', sans-serif; - font-weight: 700; - margin: 15px 0 10px 0; -} - -h2 { - font-size: 1.25em; - color: #cf5a5a; -} - -h3 { - font-size: 1.15em; -} - -h4 { - font-size: 1em; -} - -.section-header { - margin-top: 50px; - padding: 10px; - padding-left: 15px; - margin-left: -25px; - border-radius: 50px; - border-left: 20px solid #cf5a5a; - background-color: #e9cfc8; - color: #31302f; -} - -a:link { - font-weight: bold; - color: #cf5a5a; - text-decoration: none; -} - -a:visited { - font-weight: bold; - color: #cf5a5a; - text-decoration: none; -} - -a:link:hover { - text-decoration: underline; -} - -hr { - background: #cf5a5a; - border-radius: 100px; - height: 6px; - margin: 60px 20%; - border: none; -} - -blockquote { - margin-left: 3em; -} - -ul { - list-style-type: none; -} - -p.name { - font-family: "Andale Mono", monospace; - padding-top: 1em; -} - -span.item-name { - background-color: #fbd350; - display: inline-block; - color: #31302f; - padding: 10px 20px; - border-radius: 25px; - border: 2px solid #bf9817; - font-size: 1em; - font-family: "Source Code Pro", monospace; - font-weight: 700; - letter-spacing: -1px; -} - -pre { - background-color: #056d8d; - border: 2px solid #03475c; - -webkit-box-shadow: 0 0 10px 0 rgba(49, 48, 47, 0.5); - box-shadow: 0 0 10px 0 rgba(49, 48, 47, 0.5); - border-radius: 15px; - color: #f0ece3; - padding: 15px 20px; - margin: 10px 0 10px 0; - font-family: "Source Code Pro", monospace; - -moz-tab-size: 4; - -o-tab-size: 4; - tab-size: 4; - overflow-x: auto; - width: 100%; - font-weight: 400; -} - -pre .keyword { - color: #ffcb1f; -} - -pre .string, pre .number { - color: #eb6e6e; - font-weight: bold; -} - -pre .comment { - color: #b4b1aa; -} - -pre.example { - font-size: .85em; -} - -table.index td { - text-align: left; - vertical-align: top; -} - -#container { - margin-left: auto; - margin-right: auto; - border-radius: 25px; - -webkit-box-shadow: 0 0 25px 0 rgba(49, 48, 47, 0.3); - box-shadow: 0 0 25px 0 rgba(49, 48, 47, 0.3); - overflow: hidden; - max-width: 1600px; -} - -#product { - text-align: center; - height: 500px; - background-color: #31302f; - color: #f0ece3; -} - -#product > :before { - content: 'Noble Engine'; -} - -#product big { - font-size: 2em; -} - -#main { - background-color: #31302f; - display: -webkit-box; - display: -ms-flexbox; - display: flex; - -webkit-box-orient: horizontal; - -webkit-box-direction: normal; - -ms-flex-direction: row; - flex-direction: row; -} - -#navigation { - -webkit-box-flex: 1; - -ms-flex-positive: 1; - flex-grow: 1; - -ms-flex-negative: 0; - flex-shrink: 0; - -ms-flex-preferred-size: auto; - flex-basis: auto; - width: 275px; - padding: 0 10px; - overflow: hidden; - color: #f0ece3; -} - -#navigation a:link, #navigation a:visited { - font-weight: normal; -} - -#navigation .nav-module, -#navigation .nav-modules { - color: #31302f; - padding: 15px; - border-radius: 20px; -} - -#navigation .nav-module a:link, #navigation .nav-module a:visited, -#navigation .nav-modules a:link, -#navigation .nav-modules a:visited { - color: #31302f; -} - -#navigation .nav-module ul a:active, #navigation .nav-module ul a:hover, #navigation .nav-module ul .selected, -#navigation .nav-modules ul a:active, -#navigation .nav-modules ul a:hover, -#navigation .nav-modules ul .selected { - color: #f0ece3; - background-color: #cf5a5a; - padding: 5px 10px; - margin-left: -10px; - border-radius: 30px; - text-decoration: none; -} - -#navigation .nav-module ul .selected, -#navigation .nav-modules ul .selected { - line-height: 2em; - margin-left: -28px; - padding-left: 28px; - border-radius: 0 30px 30px 0; - font-weight: bold; -} - -#navigation .nav-module { - background-color: #eb6e6e; - margin: 0 -10px 20px 10px; - border-radius: 20px 0 0 20px; -} - -#navigation .nav-module h2 { - background-color: #cf5a5a; - color: #f0ece3; - margin: 0; -} - -#navigation .nav-module ul a:active, #navigation .nav-module ul a:hover { - color: #31302f; - background-color: #ffcb1f; -} - -#navigation .nav-modules { - background-color: #f3e5bc; - margin: 0 10px 30px 10px; - padding-top: 5px; -} - -#navigation h1 { - color: #eb6e6e; - line-height: 80%; - font-family: 'Quicksand', sans-serif; - font-weight: 900; - font-size: 32px; - padding-left: 20px; - padding-bottom: 20px; -} - -#navigation h2 { - color: #31302f; - font-size: 1.1em; - background-color: #f0ece3; - padding: 5px 10px; - margin-right: 20px; - border-radius: 30px; - text-decoration: none; -} - -#navigation ul { - font-size: 1em; - list-style-type: none; - margin: 1px 1px 10px 1px; - padding-left: 0px; -} - -#navigation li { - display: block; - margin: 0px 0px 6px 12px; - padding-left: 0px; -} - -#navigation li li a { - margin: 0px 3px 0px -1em; -} - -#content { - -webkit-box-flex: 1; - -ms-flex-positive: 1; - flex-grow: 1; - -ms-flex-negative: 1; - flex-shrink: 1; - -ms-flex-preferred-size: auto; - flex-basis: auto; - min-width: 0; - padding: 2em; - padding-left: 3.5em; - border-left: 4px solid #cf5a5a; - -webkit-box-shadow: inset 0 0 50px 0 rgba(207, 90, 90, 0.25); - box-shadow: inset 0 0 50px 0 rgba(207, 90, 90, 0.25); - background-color: #f0ece3; -} - -#about { - clear: both; - padding: 20px; - border-top: 2px solid #31302f; - background-color: #cf5a5a; - color: #f0ece3; -} - -#about a:link, #about a:visited, #about a:hover, #about a:active { - color: #ffcb1f; -} - -@media print { - body { - font: 12pt "Times New Roman", "TimeNR", Times, serif; - } - a { - font-weight: bold; - color: #1c4e68; - text-decoration: underline; - } - #main { - background-color: #ffffff; - border-left: 0px; - } - #container { - margin-left: 2%; - margin-right: 2%; - background-color: #ffffff; - } - #content { - padding: 1em; - background-color: #ffffff; - } - #navigation { - display: none; - } - pre.example { - font-family: "Andale Mono", monospace; - font-size: 10pt; - page-break-inside: avoid; - } -} - -table.module_list { - border-width: 1px; - border-style: solid; - border-color: #b1e3fa; - border-collapse: collapse; -} - -table.module_list td { - border-width: 1px; - padding: 3px; - border-style: solid; - border-color: #b1e3fa; -} - -table.module_list td.name { - background-color: #e0f4fc; - min-width: 200px; -} - -table.module_list td.summary { - width: 100%; -} - -table.function_list { - border-width: 1px; - border-style: solid; - border-color: #b1e3fa; - border-collapse: collapse; -} - -table.function_list td { - border-width: 1px; - padding: 3px; - border-style: solid; - border-color: #b1e3fa; -} - -table.function_list td.name { - background-color: #e0f4fc; - min-width: 200px; -} - -table.function_list td.summary { - width: 100%; -} - -ul.nowrap { - overflow: auto; - white-space: nowrap; -} - -dl.table dt, -dl.function dt { - padding-top: 1em; -} - -dl.table dd dd, -dl.function dd { - padding-bottom: 30px; - margin: 10px 0 10px 20px; - border-bottom: 2px dotted #056d8d; -} - -dl.table dd > :last-child, -dl.function > :last-child { - border-bottom: none; -} - -dl.table h3, -dl.function h3 { - font-size: .95em; -} - -/* stop sublists from having initial vertical space */ -ul ul { - margin-top: 0px; -} - -ol ul { - margin-top: 0px; -} - -ol ol { - margin-top: 0px; -} - -ul ol { - margin-top: 0px; -} - -/* make the target distinct; helps when we're navigating to a function */ -a:target + * { - border: 2px solid #31302f; - border-bottom: 6px solid #31302f; - background-color: #cf5a5a; - color: #f0ece3; -} -/*# sourceMappingURL=ldoc.css.map */ \ No newline at end of file diff --git a/source/libraries/noble/.docs/.ldoc/ldoc.css.map b/source/libraries/noble/.docs/.ldoc/ldoc.css.map deleted file mode 100644 index 652a54b..0000000 --- a/source/libraries/noble/.docs/.ldoc/ldoc.css.map +++ /dev/null @@ -1,9 +0,0 @@ -{ - "version": 3, - "mappings": "AAAA,OAAO,CAAC,8DAAI;AACZ,OAAO,CAAC,iDAAI;AACZ,OAAO,CAAC,uGAAI;AASZ,AAAA,CAAC,CAAC;EACD,UAAU,EAAE,UAAU;CACtB;;AAED,AAAA,IAAI,CAAC;EACJ,MAAM,EAAE,GAAG;EACR,WAAW,EAAE,4CAA4C;EACzD,gBAAgB,EAZX,OAAO;EAaZ,KAAK,EAVF,OAAO;CAWb;;AAED,AAAA,IAAI;AACJ,EAAE,CAAC;EACF,WAAW,EAAE,4BAA4B;EACzC,SAAS,EAAE,KAAK;EAChB,cAAc,EAAE,IAAI;EACpB,WAAW,EAAE,GAAG;EAChB,KAAK,EArBC,OAAO;CAsBb;;AAED,AAAA,IAAI,AAAA,MAAM,AAAA,OAAO,CAAC;EAAE,OAAO,EAAC,IAAI;CAAI;;AACpC,AAAA,IAAI,AAAA,MAAM,AAAA,MAAM,CAAC;EAAE,OAAO,EAAC,EAAE;CAAI;;AAEjC,AAAA,KAAK;AACL,QAAQ;AACR,SAAS,CAAC;EACT,KAAK,EAAE,OAAgC;CACvC;;AACD,AAAA,QAAQ,CAAC,MAAM,CAAC;EAAE,WAAW,EAAE,IAAI;CAAI;;AAGvC,AAAA,WAAW,CAAC;EACX,eAAe,EAAE,IAAI;CAKrB;;AAND,AAEC,WAFU,CAEV,EAAE,CAAC;EACF,aAAa,EAAE,IAAI;EACnB,WAAW,EAAE,KAAK;CAClB;;AAGF,AAAA,UAAU,CAAC;EACV,WAAW,EAAE,GAAG;EAChB,KAAK,EAAE,OAAW;CAClB;;AAED,AAAA,IAAI,EAAE,EAAE,EAAE,EAAE,CAAC;EAAE,SAAS,EAAE,KAAK;EAAE,WAAW,EAAE,KAAK;CAAG;;AAEtD,AAAA,CAAC,EAAE,EAAE,CAAC;EAAE,MAAM,EAAE,YAAY;CAAG;;AAE/B,AAAA,EAAE,CAAC;EACF,YAAY,EAAE,IAAI;CAClB;;AAED,AAAA,MAAM,CAAC;EAAE,WAAW,EAAE,IAAI;CAAG;;AAE7B,AAAA,EAAE,CAAC;EAAE,UAAU,EAAE,MAAM;CAAG;;AAE1B,AAAA,KAAK,CAAC;EAIL,KAAK,EAAE,IAAI;EACX,gBAAgB,EAAE,eAAe;EACjC,iBAAiB,EAAE,SAAS;EAC5B,mBAAmB,EAAE,MAAM;EAC3B,MAAM,EAAE,KAAK;CACb;;AATD,AACC,KADI,CACJ,EAAE,CAAC;EACF,OAAO,EAAE,IAAI;CACb;;AAQF,AAAA,EAAE,CAAC;EACC,WAAW,EAAE,uBAAuB;EACpC,WAAW,EAAE,IAAI;EACjB,KAAK,EA7EH,OAAO;EA8ET,SAAS,EAAE,KAAK;EAChB,MAAM,EAAE,aAAa;CACxB;;AACD,AAAA,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC;EACP,WAAW,EAAE,uBAAuB;EACpC,WAAW,EAAE,GAAG;EAChB,MAAM,EAAE,aAAa;CAAG;;AAC5B,AAAA,EAAE,CAAC;EAAE,SAAS,EAAE,MAAM;EAAE,KAAK,EArFvB,OAAO;CAqF0B;;AACvC,AAAA,EAAE,CAAC;EAAE,SAAS,EAAE,MAAM;CAAI;;AAC1B,AAAA,EAAE,CAAC;EAAE,SAAS,EAAE,GAAG;CAAI;;AAEvB,AAAA,eAAe,CAAC;EACf,UAAU,EAAE,IAAI;EAChB,OAAO,EAAE,IAAI;EACb,YAAY,EAAE,IAAI;EAClB,WAAW,EAAE,KAAK;EAClB,aAAa,EAAE,IAAI;EACnB,WAAW,EAAE,IAAI,CAAC,KAAK,CA/FlB,OAAO;EAgGZ,gBAAgB,EAAE,OAA8B;EAChD,KAAK,EA5FC,OAAO;CA6Fb;;AAED,AAAA,CAAC,AAAA,KAAK,CAAC;EAAE,WAAW,EAAE,IAAI;EAAE,KAAK,EApG3B,OAAO;EAoG4B,eAAe,EAAE,IAAI;CAAI;;AAClE,AAAA,CAAC,AAAA,QAAQ,CAAC;EAAE,WAAW,EAAE,IAAI;EAAE,KAAK,EArG9B,OAAO;EAqG+B,eAAe,EAAE,IAAI;CAAI;;AACrE,AAAA,CAAC,AAAA,KAAK,AAAA,MAAM,CAAC;EAAE,eAAe,EAAE,SAAS;CAAI;;AAE7C,AAAA,EAAE,CAAC;EACC,UAAU,EAzGR,OAAO;EA0GZ,aAAa,EAAE,KAAK;EACjB,MAAM,EAAE,GAAG;EACd,MAAM,EAAE,QAAQ;EAChB,MAAM,EAAE,IAAI;CACZ;;AAED,AAAA,UAAU,CAAC;EAAE,WAAW,EAAE,GAAG;CAAI;;AAEjC,AAAA,EAAE,CAAC;EAAE,eAAe,EAAE,IAAI;CAAI;;AAE9B,AAAA,CAAC,AAAA,KAAK,CAAC;EACH,WAAW,EAAE,wBAAwB;EACrC,WAAW,EAAE,GAAG;CACnB;;AAED,AAAA,IAAI,AAAA,UAAU,CAAC;EACd,gBAAgB,EAAE,OAA8B;EAChD,OAAO,EAAE,YAAY;EACrB,KAAK,EAvHC,OAAO;EAwHb,OAAO,EAAE,SAAS;EAClB,aAAa,EAAE,IAAI;EAEnB,MAAM,EAAE,GAAG,CAAC,KAAK,CAAC,OAAY;EAI9B,SAAS,EAAE,GAAG;EACd,WAAW,EAAE,4BAA4B;EACzC,WAAW,EAAE,GAAG;EAChB,cAAc,EAAE,IAAI;CACpB;;AAED,AAAA,GAAG,CAAC;EACA,gBAAgB,EAxIb,OAAO;EAyIV,MAAM,EAAE,GAAG,CAAC,KAAK,CAAC,OAAU;EAC/B,UAAU,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAxIhB,qBAAO;EAyIb,aAAa,EAAE,IAAI;EACnB,KAAK,EA3IC,OAAO;EA4IV,OAAO,EAAE,SAAS;EAClB,MAAM,EAAE,aAAa;EAExB,WAAW,EAAE,4BAA4B;EAEzC,QAAQ,EAAE,CAAC;EACX,UAAU,EAAE,IAAI;EAChB,KAAK,EAAE,IAAI;EACX,WAAW,EAAE,GAAG;CAWhB;;AAzBD,AAeC,GAfE,CAeF,QAAQ,CAAC;EACR,KAAK,EAxJE,OAAO;CAyJd;;AAjBF,AAkBC,GAlBE,CAkBF,OAAO,EAlBR,GAAG,CAkBO,OAAO,CAAC;EAChB,KAAK,EA5JK,OAAO;EA6JjB,WAAW,EAAE,IAAI;CACjB;;AArBF,AAsBC,GAtBE,CAsBF,QAAQ,CAAC;EACR,KAAK,EAAE,OAAW;CAClB;;AAGF,AAAA,GAAG,AAAA,QAAQ,CAAC;EACR,SAAS,EAAE,KAAK;CACnB;;AAED,AAAA,KAAK,AAAA,MAAM,CAAC,EAAE,CAAC;EAAE,UAAU,EAAE,IAAI;EAAE,cAAc,EAAE,GAAG;CAAI;;AAE1D,AAAA,UAAU,CAAC;EACV,WAAW,EAAE,IAAI;EACd,YAAY,EAAE,IAAI;EACrB,aAAa,EAAE,IAAI;EACnB,UAAU,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CA1KhB,qBAAO;EA2Kb,QAAQ,EAAE,MAAM;EAChB,SAAS,EAAE,MAAM;CACjB;;AAED,AAAA,QAAQ,CAAC;EACR,UAAU,EAAE,MAAM;EAClB,MAAM,EAAE,KAAK;EACb,gBAAgB,EAlLV,OAAO;EAmLb,KAAK,EApLC,OAAO;CAwLb;;AARD,AAKC,QALO,GAKL,OAAO,CAAA;EACR,OAAO,EAAE,cAAc;CACvB;;AAGF,AAAA,QAAQ,CAAC,GAAG,CAAC;EACT,SAAS,EAAE,GAAG;CACjB;;AAED,AAAA,KAAK,CAAC;EACF,gBAAgB,EA9Lb,OAAO;EA+Lb,OAAO,EAAE,IAAI;EACb,cAAc,EAAE,GAAG;CACnB;;AAED,AAAA,WAAW,CAAC;EAEX,SAAS,EAAE,CAAC;EACZ,WAAW,EAAE,CAAC;EACd,UAAU,EAAE,IAAI;EAChB,KAAK,EAAE,KAAK;EAEZ,OAAO,EAAE,MAAM;EAEZ,QAAQ,EAAE,MAAM;EAEnB,KAAK,EA/MC,OAAO;CAiTb;;AA7GD,AAaC,WAbU,CAaV,CAAC,AAAA,KAAK,EAbP,WAAW,CAaF,CAAC,AAAA,QAAQ,CAAC;EACjB,WAAW,EAAE,MAAM;CACnB;;AAfF,AAiBC,WAjBU,CAiBV,WAAW;AAjBZ,WAAW,CAkBV,YAAY,CAAC;EACZ,KAAK,EAtNA,OAAO;EAuNZ,OAAO,EAAE,IAAI;EAMb,aAAa,EAAE,IAAI;CAmBnB;;AA7CF,AAsBE,WAtBS,CAiBV,WAAW,CAKV,CAAC,AAAA,KAAK,EAtBR,WAAW,CAiBV,WAAW,CAKF,CAAC,AAAA,QAAQ;AAtBnB,WAAW,CAkBV,YAAY,CAIX,CAAC,AAAA,KAAK;AAtBR,WAAW,CAkBV,YAAY,CAIH,CAAC,AAAA,QAAQ,CAAC;EACjB,KAAK,EA1ND,OAAO;CA2NX;;AAxBH,AA6BG,WA7BQ,CAiBV,WAAW,CAWV,EAAE,CACD,CAAC,AAAA,OAAO,EA7BX,WAAW,CAiBV,WAAW,CAWV,EAAE,CACS,CAAC,AAAA,MAAM,EA7BpB,WAAW,CAiBV,WAAW,CAWV,EAAE,CACkB,SAAS;AA7B/B,WAAW,CAkBV,YAAY,CAUX,EAAE,CACD,CAAC,AAAA,OAAO;AA7BX,WAAW,CAkBV,YAAY,CAUX,EAAE,CACS,CAAC,AAAA,MAAM;AA7BpB,WAAW,CAkBV,YAAY,CAUX,EAAE,CACkB,SAAS,CAAC;EAC5B,KAAK,EAlOF,OAAO;EAmOV,gBAAgB,EAvOd,OAAO;EAwOT,OAAO,EAAE,QAAQ;EACjB,WAAW,EAAC,KAAK;EACjB,aAAa,EAAE,IAAI;EACnB,eAAe,EAAE,IAAI;CACrB;;AApCJ,AAqCG,WArCQ,CAiBV,WAAW,CAWV,EAAE,CASD,SAAS;AArCZ,WAAW,CAkBV,YAAY,CAUX,EAAE,CASD,SAAS,CAAA;EACR,WAAW,EAAE,GAAG;EAChB,WAAW,EAAE,KAAK;EAClB,YAAY,EAAE,IAAI;EAClB,aAAa,EAAE,aAAa;EAC5B,WAAW,EAAE,IAAI;CACjB;;AA3CJ,AA8CC,WA9CU,CA8CV,WAAW,CAAC;EACX,gBAAgB,EAtPN,OAAO;EAuPjB,MAAM,EAAE,iBAAiB;EACzB,aAAa,EAAE,aAAa;CAc5B;;AA/DF,AAmDE,WAnDS,CA8CV,WAAW,CAKV,EAAE,CAAC;EACF,gBAAgB,EA5Pb,OAAO;EA6PV,KAAK,EAzPD,OAAO;EA0PX,MAAM,EAAE,CAAC;CACT;;AAvDH,AA0DG,WA1DQ,CA8CV,WAAW,CAWV,EAAE,CACD,CAAC,AAAA,OAAO,EA1DX,WAAW,CA8CV,WAAW,CAWV,EAAE,CACS,CAAC,AAAA,MAAM,CAAC;EACjB,KAAK,EA9PF,OAAO;EA+PV,gBAAgB,EAlQX,OAAO;CAmQZ;;AA7DJ,AAgEC,WAhEU,CAgEV,YAAY,CAAC;EACZ,gBAAgB,EAAE,OAA4B;EAC9C,MAAM,EAAE,gBAAgB;EACxB,WAAW,EAAE,GAAG;CAChB;;AApEF,AAsEC,WAtEU,CAsEV,EAAE,CAAC;EACF,KAAK,EA9QK,OAAO;EA+QjB,WAAW,EAAE,GAAG;EAChB,WAAW,EAAE,uBAAuB;EACpC,WAAW,EAAE,GAAG;EAChB,SAAS,EAAE,IAAI;EACf,YAAY,EAAE,IAAI;EAClB,cAAc,EAAE,IAAI;CACpB;;AA9EF,AAgFC,WAhFU,CAgFV,EAAE,CAAC;EAEF,KAAK,EArRA,OAAO;EAsRZ,SAAS,EAAC,KAAK;EAEf,gBAAgB,EAzRX,OAAO;EA0RZ,OAAO,EAAE,QAAQ;EACjB,YAAY,EAAE,IAAI;EAClB,aAAa,EAAE,IAAI;EACnB,eAAe,EAAE,IAAI;CACrB;;AA1FF,AA4FC,WA5FU,CA4FV,EAAE,CAAC;EACF,SAAS,EAAC,GAAG;EACb,eAAe,EAAE,IAAI;EACrB,MAAM,EAAE,gBAAgB;EACxB,YAAY,EAAE,GAAG;CACjB;;AAjGF,AAmGC,WAnGU,CAmGV,EAAE,CAAC;EAEF,OAAO,EAAE,KAAK;EACd,MAAM,EAAE,gBAAgB;EACxB,YAAY,EAAE,GAAG;CACjB;;AAxGF,AA0GC,WA1GU,CA0GV,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;EACP,MAAM,EAAE,gBAAgB;CACxB;;AAGF,AAAA,QAAQ,CAAC;EAER,SAAS,EAAE,CAAC;EACZ,WAAW,EAAE,CAAC;EACd,UAAU,EAAE,IAAI;EAChB,SAAS,EAAE,CAAC;EAGT,OAAO,EAAE,GAAG;EACf,YAAY,EAAC,KAAK;EACf,WAAW,EAAE,GAAG,CAAC,KAAK,CAjUpB,OAAO;EAkUZ,UAAU,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAlUvB,uBAAO;EAmUT,gBAAgB,EA/Tb,OAAO;CAgUb;;AAED,AAAA,MAAM,CAAC;EACH,KAAK,EAAE,IAAI;EACX,OAAO,EAAE,IAAI;EACb,UAAU,EAAE,GAAG,CAAC,KAAK,CApUlB,OAAO;EAqUV,gBAAgB,EA1Ud,OAAO;EA4UT,KAAK,EAxUF,OAAO;CA4Ub;;AAVD,AAOC,MAPK,CAOL,CAAC,AAAA,KAAK,EAPP,MAAM,CAOG,CAAC,AAAA,QAAQ,EAPlB,MAAM,CAOc,CAAC,AAAA,MAAM,EAP3B,MAAM,CAOuB,CAAC,AAAA,OAAO,CAAC;EACpC,KAAK,EA5UE,OAAO;CA6Ud;;AAGF,MAAM,CAAC,KAAK;EACR,AAAA,IAAI,CAAC;IACD,IAAI,EAAE,8CAA8C;GACvD;EACD,AAAA,CAAC,CAAC;IAAE,WAAW,EAAE,IAAI;IAAE,KAAK,EAAE,OAAO;IAAE,eAAe,EAAE,SAAS;GAAI;EAErE,AAAA,KAAK,CAAC;IACF,gBAAgB,EAAE,OAAO;IACzB,WAAW,EAAE,GAAG;GACnB;EAED,AAAA,UAAU,CAAC;IACP,WAAW,EAAE,EAAE;IACf,YAAY,EAAE,EAAE;IAChB,gBAAgB,EAAE,OAAO;GAC5B;EAED,AAAA,QAAQ,CAAC;IACL,OAAO,EAAE,GAAG;IACZ,gBAAgB,EAAE,OAAO;GAC5B;EAED,AAAA,WAAW,CAAC;IACR,OAAO,EAAE,IAAI;GAChB;EACD,AAAA,GAAG,AAAA,QAAQ,CAAC;IACR,WAAW,EAAE,wBAAwB;IACrC,SAAS,EAAE,IAAI;IACf,iBAAiB,EAAE,KAAK;GAC3B;;;AAGL,AAAA,KAAK,AAAA,YAAY,CAAC;EACd,YAAY,EAAE,GAAG;EACjB,YAAY,EAAE,KAAK;EACnB,YAAY,EAAE,OAAO;EACrB,eAAe,EAAE,QAAQ;CAC5B;;AACD,AAAA,KAAK,AAAA,YAAY,CAAC,EAAE,CAAC;EACjB,YAAY,EAAE,GAAG;EACjB,OAAO,EAAE,GAAG;EACZ,YAAY,EAAE,KAAK;EACnB,YAAY,EAAE,OAAO;CACxB;;AACD,AAAA,KAAK,AAAA,YAAY,CAAC,EAAE,AAAA,KAAK,CAAC;EAAE,gBAAgB,EAAE,OAAO;EAAE,SAAS,EAAE,KAAK;CAAI;;AAC3E,AAAA,KAAK,AAAA,YAAY,CAAC,EAAE,AAAA,QAAQ,CAAC;EAAE,KAAK,EAAE,IAAI;CAAI;;AAG9C,AAAA,KAAK,AAAA,cAAc,CAAC;EAChB,YAAY,EAAE,GAAG;EACjB,YAAY,EAAE,KAAK;EACnB,YAAY,EAAE,OAAO;EACrB,eAAe,EAAE,QAAQ;CAC5B;;AACD,AAAA,KAAK,AAAA,cAAc,CAAC,EAAE,CAAC;EACnB,YAAY,EAAE,GAAG;EACjB,OAAO,EAAE,GAAG;EACZ,YAAY,EAAE,KAAK;EACnB,YAAY,EAAE,OAAO;CACxB;;AACD,AAAA,KAAK,AAAA,cAAc,CAAC,EAAE,AAAA,KAAK,CAAC;EAAE,gBAAgB,EAAE,OAAO;EAAE,SAAS,EAAE,KAAK;CAAI;;AAC7E,AAAA,KAAK,AAAA,cAAc,CAAC,EAAE,AAAA,QAAQ,CAAC;EAAE,KAAK,EAAE,IAAI;CAAI;;AAEhD,AAAA,EAAE,AAAA,OAAO,CAAC;EACN,QAAQ,EAAC,IAAI;EACb,WAAW,EAAC,MAAM;CACrB;;AAED,AAAA,EAAE,AAAA,MAAM,CAAC,EAAE;AACX,EAAE,AAAA,SAAS,CAAC,EAAE,CAAC;EACd,WAAW,EAAE,GAAG;CAChB;;AACD,AAEC,EAFC,AAAA,MAAM,CAAC,EAAE,CAEV,EAAE;AADH,EAAE,AAAA,SAAS,CACV,EAAE,CAAC;EACF,cAAc,EAAE,IAAI;EACpB,MAAM,EAAE,gBAAgB;EACxB,aAAa,EAAE,GAAG,CAAC,MAAM,CA5ZpB,OAAO;CA6ZZ;;AANF,AAOC,EAPC,AAAA,MAAM,CAAC,EAAE,GAOR,WAAW;AANd,EAAE,AAAA,SAAS,GAMR,WAAW,CAAC;EACb,aAAa,EAAE,IAAI;CACnB;;AAEF,AAAA,EAAE,AAAA,MAAM,CAAC,EAAE;AACX,EAAE,AAAA,SAAS,CAAC,EAAE,CAAC;EACd,SAAS,EAAE,KAAK;CAChB;;AAED,sDAAsD;AACtD,AAAA,EAAE,CAAC,EAAE,CAAC;EAAE,UAAU,EAAE,GAAG;CAAI;;AAC3B,AAAA,EAAE,CAAC,EAAE,CAAC;EAAE,UAAU,EAAE,GAAG;CAAI;;AAC3B,AAAA,EAAE,CAAC,EAAE,CAAC;EAAE,UAAU,EAAE,GAAG;CAAI;;AAC3B,AAAA,EAAE,CAAC,EAAE,CAAC;EAAE,UAAU,EAAE,GAAG;CAAI;;AAE3B,yEAAyE;AACzE,AAAA,CAAC,AAAA,OAAO,GAAG,CAAC,CAAC;EACZ,MAAM,EAAE,GAAG,CAAC,KAAK,CA7aX,OAAO;EA8ab,aAAa,EAAE,GAAG,CAAC,KAAK,CA9alB,OAAO;EA+ab,gBAAgB,EApbX,OAAO;EAqbZ,KAAK,EAjbC,OAAO;CAkbb", - "sources": [ - "ldoc.scss" - ], - "names": [], - "file": "ldoc.css" -} \ No newline at end of file diff --git a/source/libraries/noble/.docs/.ldoc/ldoc.ltp b/source/libraries/noble/.docs/.ldoc/ldoc.ltp deleted file mode 100644 index f4f90be..0000000 --- a/source/libraries/noble/.docs/.ldoc/ldoc.ltp +++ /dev/null @@ -1,299 +0,0 @@ - - - - - $(ldoc.title) - - - - - -
- -
- -# local no_spaces = ldoc.no_spaces -# local use_li = ldoc.use_li -# local display_name = ldoc.display_name -# local iter = ldoc.modules.iter -# local function M(txt,item) return ldoc.markup(txt,item,ldoc.plain) end -# --local nowrap = ldoc.wrap and '' or 'nowrap' - - - - - -
- -# if ldoc.body then -- verbatim HTML as contents; 'non-code' entries - $(ldoc.body) -# elseif module then -- module documentation -

$(module.name)

-

$(M(module.summary,module))

-

$(M(module.description,module))

-# if module.tags.include then - $(M(ldoc.include_file(module.tags.include))) -# end -# if module.see then -# local li,il = use_li(module.see) -

See

-
    -# for see in iter(module.see) do - $(li)$(see.label)$(il) -# end -
-# end -# if module.usage then -# local li,il = use_li(module.usage) -

Usage

-# for usage in iter(module.usage) do -
$(ldoc.escape(usage))
-# end -# end -# if module.info then -

Info

-
    -# for tag, value in module.info:iter() do -
  • $(tag): $(M(value,module))
  • -# end -
-# end - -
- -# --- currently works for both Functions and Tables. The params field either contains -# --- function parameters or table fields. -# local show_return = not ldoc.no_return_or_parms -# local show_parms = show_return -# for kind, items in module.kinds() do -# local kitem = module.kinds:get_item(kind) -# local has_description = kitem and ldoc.descript(kitem) ~= "" -# kind = kind:gsub("modules.", ""):gsub(" Functions", "") -

$(kind)

- -# if kitem then -# if has_description then -
- $(M(ldoc.descript(kitem),kitem)) -
-# end -# if kitem.usage then -

Usage

-
$(ldoc.prettify(kitem.usage[1]))
-# end -# end -
-# for item in items() do -
- - $(display_name(item)) -# if ldoc.prettify_files and ldoc.is_file_prettified[item.module.file.filename] then - line $(item.lineno) -# end -
-
- $(M(ldoc.descript(item),item)) -# if ldoc.custom_tags then -# for custom in iter(ldoc.custom_tags) do -# local tag = item.tags[custom[1]] -# if tag and not custom.hidden then -# local li,il = use_li(tag) -

$(custom.title or custom[1])

-
    -# for value in iter(tag) do - $(li)$(custom.format and custom.format(value) or M(value))$(il) -# end -# end -
-# end -# end - -# if show_parms and item.params and #item.params > 0 then -# local subnames = module.kinds:type_of(item).subnames -# if subnames then -

$(subnames)

-# end -
    -# for parm in iter(item.params) do -# local param,sublist = item:subparam(parm) -# if sublist then -
  • $(sublist)$(M(item.params.map[sublist],item)) -
      -# end -# for p in iter(param) do -# local name,tp,def = item:display_name_of(p), ldoc.typename(item:type_of_param(p)), item:default_of_param(p) -
    • $(name) -# if tp ~= '' then - $(tp) -# end -# if def == true then - (optional) -# elseif def then - = $(def) (default) -# end -# if item:readonly(p) then - readonly -# end -
      - $(M(item.params.map[p],item)) -
    • -# end -# if sublist then -
    -
  • -# end -# end -
-# end - -# if show_return and item.retgroups then local groups = item.retgroups -

Returns

-# for i,group in ldoc.ipairs(groups) do local li,il = use_li(group) -
    -# for r in group:iter() do local type, ctypes = item:return_type(r); local rt = ldoc.typename(type) - $(li) -# if rt ~= '' then - $(rt) -# end - $(M(r.text,item))$(il) -# if ctypes then -
      -# for c in ctypes:iter() do -
    • $(c.name) - $(ldoc.typename(c.type)) - $(M(c.comment,item)) -
    • -# end -
    -# end -# end -
-# if i < #groups then -

Or

-# end -# end -# end - -# if show_return and item.raise then -

Raises

- $(M(item.raise,item)) -# end - -# if item.see then -# local li,il = use_li(item.see) -

See

-
    -# for see in iter(item.see) do - $(li)$(see.label)$(il) -# end -
-# end - -# if item.usage then -# local li,il = use_li(item.usage) -

Usage

-# for usage in iter(item.usage) do -
$(ldoc.prettify(usage))
-# end -# end - -
-# end -- for items -
-# end - -# else -- if module; project-level contents - -# if ldoc.description then -

$(M(ldoc.description,nil))

-# end -# if ldoc.full_description then -

$(M(ldoc.full_description,nil))

-# end - -# for kind, mods in ldoc.kinds() do -

$(kind)

-# kind = kind:lower() - -# for m in mods() do - - - - -# end -
$(m.name)$(M(ldoc.strip_header(m.summary),m))
-# end - -# end -- if module - -
- -
- -
- Noble Engine by Mark LaCroix, Noble Robot - - Documentation created using LDoc $(ldoc.version). -# if not module then - Last updated $(ldoc.updatetime) -# end - -
- -
- - - - diff --git a/source/libraries/noble/.docs/.ldoc/ldoc.scss b/source/libraries/noble/.docs/.ldoc/ldoc.scss deleted file mode 100644 index 353d8e2..0000000 --- a/source/libraries/noble/.docs/.ldoc/ldoc.scss +++ /dev/null @@ -1,443 +0,0 @@ -@import url(https://fonts.googleapis.com/css?family=Quicksand:300,700); -@import url(https://fonts.googleapis.com/css?family=Lato); -@import url(https://fonts.googleapis.com/css2?family=Source+Code+Pro:wght@200;300;400;600;700;900&display=swap); - -$red: #cf5a5a; -$redBright: #eb6e6e; -$yellow: #ffcb1f; -$blue: #056d8d; -$white:#f0ece3; -$black:#31302f; - -* { - box-sizing: border-box; -} - -body { - margin: 2em; - font-family: "Lato", arial, helvetica, geneva, sans-serif; - background-color: $yellow; - color: $black; -} - -code, -tt { - font-family: "Source Code Pro", monospace; - font-size: 1.1em; - letter-spacing: -1px; - font-weight: 600; - color: $blue; -} - -span.types:before { content:": "; } -span.types:after { content:""; } - -.type, -.default, -.optional { - color: ($black * 0.65) + ($white *0.35); -} -.default .value { font-weight: bold; } - - -.parameters { - list-style-type: none; - li { - margin-bottom: 10px; - line-height: 1.5em; - } -} - -.parameter { - font-weight: 600; - color: $blue * 0.8; -} - -body, td, th { font-size: .95em; line-height: 1.2em;} - -p, ul { margin: 10px 0 0 0px;} - -ul { - padding-left: 25px; -} - -strong { font-weight: bold;} - -em { font-style: italic;} - -.logo { - h1 { - display: none; - } - width: 100%; - background-image: url('logo.png'); - background-repeat: no-repeat; - background-position: center; - height: 150px; -} - -h1 { - font-family: 'Quicksand', sans-serif; - font-weight: bold; - color: $red; - font-size: 2.5em; - margin: 20px 0 30px 0; -} -h2, h3, h4 { - font-family: 'Quicksand', sans-serif; - font-weight: 700; - margin: 15px 0 10px 0; } -h2 { font-size: 1.25em; color: $red; } -h3 { font-size: 1.15em; } -h4 { font-size: 1em; } - -.section-header { - margin-top: 50px; - padding: 10px; - padding-left: 15px; - margin-left: -25px; - border-radius: 50px; - border-left: 20px solid $red; - background-color: ($white * 0.8) + ($red * 0.20); - color: $black; -} - -a:link { font-weight: bold; color: $red; text-decoration: none; } -a:visited { font-weight: bold; color: $red; text-decoration: none; } -a:link:hover { text-decoration: underline; } - -hr { - background: $red; - border-radius: 100px; - height: 6px; - margin: 60px 20%; - border: none; -} - -blockquote { margin-left: 3em; } - -ul { list-style-type: none; } - -p.name { - font-family: "Andale Mono", monospace; - padding-top: 1em; -} - -span.item-name { - background-color: ($white*0.25) + ($yellow*0.75); - display: inline-block; - color: $black; - padding: 10px 20px; - border-radius: 25px; - - border: 2px solid $yellow*0.75; - //border-bottom: none; - //border-bottom: 4px solid $red*0.75; - - font-size: 1em; - font-family: "Source Code Pro", monospace; - font-weight: 700; - letter-spacing: -1px; -} - -pre { - background-color: $blue; - border: 2px solid $blue*0.65; - box-shadow: 0 0 10px 0 rgba($black, 0.5); - border-radius: 15px; - color: $white; - padding: 15px 20px; - margin: 10px 0 10px 0; - //font-family: "Andale Mono", monospace; - font-family: "Source Code Pro", monospace; - //font-size: 20px !important; - tab-size: 4; - overflow-x: auto; - width: 100%; - font-weight: 400; - .keyword { - color: $yellow; - } - .string, .number { - color: $redBright; - font-weight: bold; - } - .comment { - color: $white*0.75; - } -} - -pre.example { - font-size: .85em; -} - -table.index td { text-align: left; vertical-align: top; } - -#container { - margin-left: auto; - margin-right: auto; - border-radius: 25px; - box-shadow: 0 0 25px 0 rgba($black, .3); - overflow: hidden; - max-width: 1600px; -} - -#product { - text-align: center; - height: 500px; - background-color: $black; - color: $white; - > :before{ - content: 'Noble Engine'; - } -} - -#product big { - font-size: 2em; -} - -#main { - background-color: $black; - display: flex; - flex-direction: row; -} - -#navigation { - - flex-grow: 1; - flex-shrink: 0; - flex-basis: auto; - width: 275px; - - padding: 0 10px; - - overflow: hidden; - - color: $white; - - a:link, a:visited { - font-weight: normal; - } - - .nav-module, - .nav-modules { - color: $black; - padding: 15px; - - a:link, a:visited { - color: $black; - } - - border-radius: 20px; - - ul { - a:active, a:hover, .selected { - color: $white; - background-color: $red; - padding: 5px 10px; - margin-left:-10px; - border-radius: 30px; - text-decoration: none; - } - .selected{ - line-height: 2em; - margin-left: -28px; - padding-left: 28px; - border-radius: 0 30px 30px 0; - font-weight: bold; - } - } - } - .nav-module { - background-color: $redBright; - margin: 0 -10px 20px 10px; - border-radius: 20px 0 0 20px; - - h2 { - background-color: $red; - color: $white; - margin: 0; - } - - ul { - a:active, a:hover { - color: $black; - background-color: $yellow; - } - } - } - .nav-modules { - background-color: ($white*0.8) + ($yellow*0.2); - margin: 0 10px 30px 10px; - padding-top: 5px; - } - - h1 { - color: $redBright; - line-height: 80%; - font-family: 'Quicksand', sans-serif; - font-weight: 900; - font-size: 32px; - padding-left: 20px; - padding-bottom: 20px; - } - - h2 { - - color: $black; - font-size:1.1em; - - background-color: $white; - padding: 5px 10px; - margin-right: 20px; - border-radius: 30px; - text-decoration: none; - } - - ul { - font-size:1em; - list-style-type: none; - margin: 1px 1px 10px 1px; - padding-left: 0px; - } - - li { - //font-size: 14px; - display: block; - margin: 0px 0px 6px 12px; - padding-left: 0px; - } - - li li a { - margin: 0px 3px 0px -1em; - } -} - -#content { - - flex-grow: 1; - flex-shrink: 1; - flex-basis: auto; - min-width: 0; // For pre elements... - - //margin-left: 14em; - padding: 2em; - padding-left:3.5em; - border-left: 4px solid $red; - box-shadow: inset 0 0 50px 0 rgba($red, 0.25); - background-color: $white; -} - -#about { - clear: both; - padding: 20px; - border-top: 2px solid $black; - background-color: $red; - - color:$white; - a:link, a:visited, a:hover, a:active { - color: $yellow; - } -} - -@media print { - body { - font: 12pt "Times New Roman", "TimeNR", Times, serif; - } - a { font-weight: bold; color: #1c4e68; text-decoration: underline; } - - #main { - background-color: #ffffff; - border-left: 0px; - } - - #container { - margin-left: 2%; - margin-right: 2%; - background-color: #ffffff; - } - - #content { - padding: 1em; - background-color: #ffffff; - } - - #navigation { - display: none; - } - pre.example { - font-family: "Andale Mono", monospace; - font-size: 10pt; - page-break-inside: avoid; - } -} - -table.module_list { - border-width: 1px; - border-style: solid; - border-color: #b1e3fa; - border-collapse: collapse; -} -table.module_list td { - border-width: 1px; - padding: 3px; - border-style: solid; - border-color: #b1e3fa; -} -table.module_list td.name { background-color: #e0f4fc; min-width: 200px; } -table.module_list td.summary { width: 100%; } - - -table.function_list { - border-width: 1px; - border-style: solid; - border-color: #b1e3fa; - border-collapse: collapse; -} -table.function_list td { - border-width: 1px; - padding: 3px; - border-style: solid; - border-color: #b1e3fa; -} -table.function_list td.name { background-color: #e0f4fc; min-width: 200px; } -table.function_list td.summary { width: 100%; } - -ul.nowrap { - overflow:auto; - white-space:nowrap; -} - -dl.table dt, -dl.function dt { - padding-top: 1em; -} -dl.table dd, -dl.function { - dd { - padding-bottom: 30px; - margin: 10px 0 10px 20px; - border-bottom: 2px dotted $blue; - } - > :last-child { - border-bottom: none; - } -} -dl.table h3, -dl.function h3 { - font-size: .95em; -} - -/* stop sublists from having initial vertical space */ -ul ul { margin-top: 0px; } -ol ul { margin-top: 0px; } -ol ol { margin-top: 0px; } -ul ol { margin-top: 0px; } - -/* make the target distinct; helps when we're navigating to a function */ -a:target + * { - border: 2px solid $black; - border-bottom: 6px solid $black; - background-color: $red; - color: $white; -} diff --git a/source/libraries/noble/.docs/classes/NobleScene.html b/source/libraries/noble/.docs/classes/NobleScene.html deleted file mode 100644 index e97943d..0000000 --- a/source/libraries/noble/.docs/classes/NobleScene.html +++ /dev/null @@ -1,485 +0,0 @@ - - - - - Noble Engine API reference - - - - - -
- -
- - - - - - -
- -

NobleScene

-

An abstract scene class.

-

Do not copy this file as a template for your scenes. Instead, your scenes will extend this class. - See templates/SceneTemplate.lua for a blank scene that you can copy and modify for your own scenes. - If you are using NobleEngine-ProjectTemplate, - see scenes/ExampleScene.lua for an implementation example.

-

Usage

-
YourSceneName = {}
-class("YourSceneName").extends(NobleScene)
-local scene = YourSceneName
-
- -
- -

Properties

- -
-
- - noblescene.name -
-
- The name of this scene. Optional. - If you do not set this value, it will take on the scene's className. - - - - - - -
-
- - noblescene.backgroundColor -
-
- This is the background color of this scene. - - - - - - -
-
-

Tables

- -
-
- - noblescene.inputHandler -
-
- All scenes have a default inputHandler which is made active when the scene starts. - If you do not define your scene's inputHandler, it is nil and input is disabled when this scene - starts. - - - - -

See

- - -

Usage

-
YourSceneName.inputHandler = {
-	AButtonDown = function()
-		// Your code here
-	end,
-	AButtonHold = function()
-		// Your code here
-	end,
-	-- ...
-	-- ...
-}
--- OR...
--- Use a non-scene-specific inputHandler, defined elsewhere.
-YourSceneName.inputHandler = somePreviouslyDefinedInputHandler
--- OR...
--- Reuse another scene's inputHandler.
-YourSceneName.inputHandler = SomeOtherSceneName.inputHandler
- -
-
- - noblescene.sprites -
-
- When you add a sprite to your scene, it is put in this table so the scene can keep track of it.

- -

This is intended as read-only. You should not modify this table directly. - - - - -

See

- - - -
-
-

Methods

- -
-
- - noblescene:addSprite(__sprite) -
-
- Use this to add sprites to your scene instead of playdate.graphics.sprite:add().

- -

If your sprite is a NobleSprite, using NobleSprite:add() will also call this method.

- -

Sprites added with this method that are tracked by the scene. Any not manually removed before transitioning to another scene are automatically removed in finish. - -

Parameters

-
    -
  • __sprite - playdate.graphics.sprite -
    - The sprite to add to the scene. -
  • -
- - - -

See

- - - -
-
- - noblescene:removeSprite(__sprite) -
-
- Use this to remove sprites from your scene instead of playdate.graphics.sprite:remove().

- -

If your sprite is a NobleSprite, using NobleSprite:remove() will also call this method.

- -

Sprites not manually removed before transitioning to another scene are automatically removed in finish. - -

Parameters

-
    -
  • __sprite - playdate.graphics.sprite -
    - The sprite to add to the scene. -
  • -
- - - -

See

- - - -
-
-

Callbacks

- -
-
- - noblescene:init() -
-
- Implement this in your scene if you have code to run when your scene's object is created. - - - - - -

Usage

-
function YourSceneName:init()
-	YourSceneName.super.init(self)
-	--[Your code here]--
-end
- -
-
- - noblescene:enter() -
-
- Implement if you want to run code as the transition to this scene begins, such as UI animation, triggers, etc. - - - - - -

Usage

-
function YourSceneName:enter()
-	YourSceneName.super.enter(self)
-	--[Your code here]--
-end
- -
-
- - noblescene:start() -
-
- Implement if you have code to run once the transition to this scene is complete. This method signifies the full activation of a scene. If this scene's inputHandler is defined, it is enabled now. - - - - -

See

- - -

Usage

-
function YourSceneName:start()
-	YourSceneName.super.start(self)
-	--[Your code here]--
-end
- -
-
- - noblescene:update() -
-
- Implement to run scene-specific code on every frame while this scene is active. - NOTE: you may use coroutine.yield() here, because it only runs inside of playdate.update(), which is a coroutine. - - - - - -

Usage

-
function YourSceneName:update()
-	YourSceneName.super.update(self)
-	--[Your code here]--
-end
- -
-
- - noblescene:drawBackground(__x, __y, __width, __height) -
-
- Implement this function to draw background visual elements in your scene. - This runs when the engine need to redraw a background area. - By default it runs every frame and fills the background with self.backgroundColor. All arguments are optional. - Use Graphics.sprite.setAlwaysRedraw(false) after Noble.new() to optimize partial redraw. - -

Parameters

-
    -
  • __x -
    - - - -
  • -
  • __y -
    - - - -
  • -
  • __width -
    - - - -
  • -
  • __height -
    - - - -
  • -
- - - - -

Usage

-
function YourSceneName:drawBackground(__x, __y, __width, __height)
-	YourSceneName.super.drawBackground(self) -- optional, invokes default behavior.
-	--[Your code here]--
-end
- -
-
- - noblescene:exit() -
-
- Implement this in your scene if you have "goodbye" code to run when a transition to another scene - begins, such as UI animation, saving to disk, etc. - - - - - -

Usage

-
function YourSceneName:exit()
-	YourSceneName.super.exit(self)
-	--[Your code here]--
-end
- -
-
- - noblescene:finish() -
-
- Implement this in your scene if you have code to run when a transition to another scene - is complete, such as resetting variables. - - - - - -

Usage

-
function YourSceneName:finish()
-	YourSceneName.super.finish(self)
-	--[Your code here]--
-end
- -
-
- - noblescene:pause() -
-
- pause() / resume()

- -

Implement one or both of these in your scene if you want something to happen when the game is paused/unpaused - by the system. The Playdate SDK does not require you to write pause logic, but these are useful if you want a - custom menu image (see Playdate SDK for more details), want to obscure game elements to prevent players from - cheating in a time-sensitive game, want to count the number of times the player pauses the game, etc. - - - - - -

Usage

-
function YourSceneName:pause()
-	YourSceneName.super.pause(self)
-	--[Your code here]--
-end
- -
-
- - noblescene:resume() -
-
- - - - - - -

Usage

-
function YourSceneName:resume()
-	YourSceneName.super.resume(self)
-	--[Your code here]--
-end
- -
-
- - -
- -
- -
- Noble Engine by Mark LaCroix, Noble Robot - - Documentation created using LDoc 1.5.0. - -
- -
- - - - diff --git a/source/libraries/noble/.docs/classes/NobleSprite.html b/source/libraries/noble/.docs/classes/NobleSprite.html deleted file mode 100644 index 20032d7..0000000 --- a/source/libraries/noble/.docs/classes/NobleSprite.html +++ /dev/null @@ -1,290 +0,0 @@ - - - - - Noble Engine API reference - - - - - -
- -
- - - - - - -
- -

NobleSprite

-

An extension of Playdate's sprite object, incorporating Noble.Animation and other Noble Engine features.

-

Use this in place of playdate.graphics.sprite in most cases.

- -

NobleSprite is a child class of playdate.graphics.sprite, so see the Playdate SDK documentation for additional methods and properties.

- -
- -

Fields

- -
-
- - self.animation -
-
- The animation for this NobleSprite. - - - - -

See

- - - -
-
-

Methods

- -
-
- - noblesprite:init([__view[, __viewIsSpritesheet=false[, __singleState=false[, __singleStateLoop=true]]]]) -
-
- Do not call an "init" method directly. Use NobleSprite() (see usage examples). - -

Parameters

-
    -
  • __view - string - (optional) -
    - This can be: the path to an image or spritesheet image file, an image object (Graphics.image) or an animation object (Noble.Animation) -
  • -
  • __viewIsSpritesheet - boolean - = false (default) -
    - Set this to true to indicate that __view is a spritesheet. Will only be considered if __view is a string path to an image. -
  • -
  • __singleState - boolean - = false (default) -
    - If this sprite has just one animation, set this to true. It saves you from having to use Noble.Animation.addState() -
  • -
  • __singleStateLoop - boolean - = true (default) -
    - If using a single state animation, should it loop? -
  • -
- - - -

See

- - -

Usage

-
-- Provide a spritesheet image file to create a new Noble.Animation for a NobleSprite's view.
-myNobleSprite = NobleSprite("path/to/spritesheet", true)
-
-- Provide an image file to create a new Graphics.image for a NobleSprite's view.
-myNobleSprite = NobleSprite("path/to/image")
-
-- Use an existing Noble.Animation for a NobleSprite's view.
-	local myAnimation = Noble.Animation.new("path/to/spritesheet")
- myAnimation:addState("default", 1, animation.imageTable:getLength(), nil, true)
-myNobleSprite = NobleSprite(myAnimation)
-
-- Use an existing Graphics.image object for a NobleSprite's view.
- local myImage = Graphics.image.new("path/to/image")
-myNobleSprite = NobleSprite(myImage)
-
-- Extending NobleSprite.
-
--- MyCustomSprite.lua
-MyCustomSprite = {}
-class("MyCustomSprite").extends(NobleSprite)
-
-function MyCustomSprite:init(__x, __y, __anotherFunArgument)
-	MyCustomSprite.super.init(self, "path/to/spritesheet", true)
-	-- Etc. etc.
-end
-
--- MyNobleScene.lua
-myNobleSprite = MyCustomSprite(100, 100, "Fun!")
- -
-
- - noblesprite:play() -
-
- This will enable the update loop for this NobleSprite, which also causes its Noble.Animation to play. - - - - - - -
-
- - noblesprite:pause() -
-
- This will disable the update loop for this NobleSprite, which also causes its Noble.Animation to pause. - - - - - - -
-
- - noblesprite:stop() -
-
- This will disable the update loop for this NobleSprite, and also reset its Noble.Animation (if it exists) to the first frame of its current state. - - - - - - -
-
- - noblesprite:add(__x, __y) -
-
- Use this to add this NobleSprite to your scene. This replaces playdate.graphics.sprite:add() to allow NobleSprites to be tracked by the current NobleScene.

- -

To add a playdate.graphics.sprite to a scene, use NobleScene:addSprite(__sprite). - -

Parameters

-
    -
  • __x -
    - - - -
  • -
  • __y -
    - - - -
  • -
- - - -

See

- - - -
-
- - noblesprite:remove() -
-
- Use this to remove this NobleSprite from your scene. This replaces playdate.graphics.sprite:remove() to allow NobleSprites to be tracked by the current NobleScene.

- -

To remove a playdate.graphics.sprite from a scene, use NobleScene:removeSprite(__sprite). - - - - -

See

- - - -
-
- - -
- -
- -
- Noble Engine by Mark LaCroix, Noble Robot - - Documentation created using LDoc 1.5.0. - -
- -
- - - - diff --git a/source/libraries/noble/.docs/classes/favicon.ico b/source/libraries/noble/.docs/classes/favicon.ico deleted file mode 100644 index 0e6485a..0000000 Binary files a/source/libraries/noble/.docs/classes/favicon.ico and /dev/null differ diff --git a/source/libraries/noble/.docs/examples/SceneTemplate.lua.html b/source/libraries/noble/.docs/examples/SceneTemplate.lua.html deleted file mode 100644 index 8cd7f1c..0000000 --- a/source/libraries/noble/.docs/examples/SceneTemplate.lua.html +++ /dev/null @@ -1,264 +0,0 @@ - - - - - Noble Engine API reference - - - - - -
- -
- - - - - - -
- -

SceneTemplate.lua

-
---
--- SceneTemplate.lua
---
--- Use this as a starting point for your game's scenes.
--- Copy this file to your root "scenes" directory,
--- and rename it.
---
-
--- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
--- !!! Rename "SceneTemplate" to your scene's name in these first three lines. !!!
--- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-SceneTemplate = {}
-class("SceneTemplate").extends(NobleScene)
-local scene = SceneTemplate
-
--- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
--- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
--- It is recommended that you declare, but don't yet define,
--- your scene-specific varibles and methods here. Use "local" where possible.
---
--- local variable1 = nil	-- local variable
--- scene.variable2 = nil	-- Scene variable.
---							   When accessed outside this file use SceneTemplate.variable2.
--- ...
---
-
--- This is the background color of this scene.
-scene.backgroundColor = Graphics.kColorWhite
-
--- This runs when your scene's object is created, which is the
--- first thing that happens when transitining away from another scene.
-function scene:init()
-	scene.super.init(self)
-
-	-- variable1 = 100
-	-- SceneTemplate.variable2 = "string"
-	-- ...
-
-	-- Your code here
-end
-
--- When transitioning from another scene, this runs as soon as this
--- scene needs to be visible (this moment depends on which transition type is used).
-function scene:enter()
-	scene.super.enter(self)
-	-- Your code here
-end
-
--- This runs once a transition from another scene is complete.
-function scene:start()
-	scene.super.start(self)
-	-- Your code here
-end
-
--- This runs once per frame.
-function scene:update()
-	scene.super.update(self)
-	-- Your code here
-end
-
--- This runs once per frame, and is meant for drawing code.
-function scene:drawBackground()
-	scene.super.drawBackground(self)
-	-- Your code here
-end
-
--- This runs as as soon as a transition to another scene begins.
-function scene:exit()
-	scene.super.exit(self)
-	-- Your code here
-end
-
--- This runs once a transition to another scene completes.
-function scene:finish()
-	scene.super.finish(self)
-	-- Your code here
-end
-
-function scene:pause()
-	scene.super.pause(self)
-	-- Your code here
-end
-function scene:resume()
-	scene.super.resume(self)
-	-- Your code here
-end
-
--- Define the inputHander for this scene here, or use a previously defined inputHandler.
-
--- scene.inputHandler = someOtherInputHandler
--- OR
-scene.inputHandler = {
-
-	-- A button
-	--
-	AButtonDown = function()			-- Runs once when button is pressed.
-		-- Your code here
-	end,
-	AButtonHold = function()			-- Runs every frame while the player is holding button down.
-		-- Your code here
-	end,
-	AButtonHeld = function()			-- Runs after button is held for 1 second.
-		-- Your code here
-	end,
-	AButtonUp = function()				-- Runs once when button is released.
-		-- Your code here
-	end,
-
-	-- B button
-	--
-	BButtonDown = function()
-		-- Your code here
-	end,
-	BButtonHeld = function()
-		-- Your code here
-	end,
-	BButtonHold = function()
-		-- Your code here
-	end,
-	BButtonUp = function()
-		-- Your code here
-	end,
-
-	-- D-pad left
-	--
-	leftButtonDown = function()
-		-- Your code here
-	end,
-	leftButtonHold = function()
-		-- Your code here
-	end,
-	leftButtonUp = function()
-		-- Your code here
-	end,
-
-	-- D-pad right
-	--
-	rightButtonDown = function()
-		-- Your code here
-	end,
-	rightButtonHold = function()
-		-- Your code here
-	end,
-	rightButtonUp = function()
-		-- Your code here
-	end,
-
-	-- D-pad up
-	--
-	upButtonDown = function()
-		-- Your code here
-	end,
-	upButtonHold = function()
-		-- Your code here
-	end,
-	upButtonUp = function()
-		-- Your code here
-	end,
-
-	-- D-pad down
-	--
-	downButtonDown = function()
-		-- Your code here
-	end,
-	downButtonHold = function()
-		-- Your code here
-	end,
-	downButtonUp = function()
-		-- Your code here
-	end,
-
-	-- Crank
-	--
-	cranked = function(change, acceleratedChange)	-- Runs when the crank is rotated. See Playdate SDK documentation for details.
-		-- Your code here
-	end,
-	crankDocked = function()						-- Runs once when when crank is docked.
-		-- Your code here
-	end,
-	crankUndocked = function()						-- Runs once when when crank is undocked.
-		-- Your code here
-	end
-}
- - -
- -
- -
- Noble Engine by Mark LaCroix, Noble Robot - - Documentation created using LDoc 1.5.0. - -
- -
- - - - diff --git a/source/libraries/noble/.docs/favicon.ico b/source/libraries/noble/.docs/favicon.ico deleted file mode 100644 index 0e6485a..0000000 Binary files a/source/libraries/noble/.docs/favicon.ico and /dev/null differ diff --git a/source/libraries/noble/.docs/index.html b/source/libraries/noble/.docs/index.html deleted file mode 100644 index 7a6014b..0000000 --- a/source/libraries/noble/.docs/index.html +++ /dev/null @@ -1,142 +0,0 @@ - - - - - Noble Engine API reference - - - - - -
- -
- - - - - - -
- - -

A li'l game engine for Playdate.

- -

Modules

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NobleA li'l game engine for Playdate.
Noble.AnimationAnimation states using a spritesheet/imagetable.
Noble.BonkEngine-specific error handling.
Noble.GameDataOperations for game data / save slots.
Noble.InputA complete encapsulation of the Playdate's input system.
Noble.MenuAn extended implementation of playdate.ui.gridview, meant for 1-dimensional, single-screen text menus.
Noble.SettingsOperations for game settings / stats.
Noble.TextText and font handling.
Noble.TransitionAn abstract class from which transition types are extended.
EaseExtensions to playdate.easingFunctions, aliased as Ease in Noble Engine.
-

Classes

- - - - - - - - - -
NobleSceneAn abstract scene class.
NobleSpriteAn extension of Playdate's sprite object, incorporating Noble.Animation and other Noble Engine features.
-

Examples

- - - - - -
SceneTemplate.lua
- - -
- -
- -
- Noble Engine by Mark LaCroix, Noble Robot - - Documentation created using LDoc 1.5.0. - Last updated 2024-04-28 21:37:43 - -
- -
- - - - diff --git a/source/libraries/noble/.docs/ldoc.css b/source/libraries/noble/.docs/ldoc.css deleted file mode 100644 index e1dca6e..0000000 --- a/source/libraries/noble/.docs/ldoc.css +++ /dev/null @@ -1,524 +0,0 @@ -@import url(https://fonts.googleapis.com/css?family=Quicksand:300,700); -@import url(https://fonts.googleapis.com/css?family=Lato); -@import url(https://fonts.googleapis.com/css2?family=Source+Code+Pro:wght@200;300;400;600;700;900&display=swap); -* { - -webkit-box-sizing: border-box; - box-sizing: border-box; -} - -body { - margin: 2em; - font-family: "Lato", arial, helvetica, geneva, sans-serif; - background-color: #ffcb1f; - color: #31302f; -} - -code, -tt { - font-family: "Source Code Pro", monospace; - font-size: 1.1em; - letter-spacing: -1px; - font-weight: 600; - color: #056d8d; -} - -span.types:before { - content: ": "; -} - -span.types:after { - content: ""; -} - -.type, -.default, -.optional { - color: #74726e; -} - -.default .value { - font-weight: bold; -} - -.parameters { - list-style-type: none; -} - -.parameters li { - margin-bottom: 10px; - line-height: 1.5em; -} - -.parameter { - font-weight: 600; - color: #045771; -} - -body, td, th { - font-size: .95em; - line-height: 1.2em; -} - -p, ul { - margin: 10px 0 0 0px; -} - -ul { - padding-left: 25px; -} - -strong { - font-weight: bold; -} - -em { - font-style: italic; -} - -.logo { - width: 100%; - background-image: url("logo.png"); - background-repeat: no-repeat; - background-position: center; - height: 150px; -} - -.logo h1 { - display: none; -} - -h1 { - font-family: 'Quicksand', sans-serif; - font-weight: bold; - color: #cf5a5a; - font-size: 2.5em; - margin: 20px 0 30px 0; -} - -h2, h3, h4 { - font-family: 'Quicksand', sans-serif; - font-weight: 700; - margin: 15px 0 10px 0; -} - -h2 { - font-size: 1.25em; - color: #cf5a5a; -} - -h3 { - font-size: 1.15em; -} - -h4 { - font-size: 1em; -} - -.section-header { - margin-top: 50px; - padding: 10px; - padding-left: 15px; - margin-left: -25px; - border-radius: 50px; - border-left: 20px solid #cf5a5a; - background-color: #e9cfc8; - color: #31302f; -} - -a:link { - font-weight: bold; - color: #cf5a5a; - text-decoration: none; -} - -a:visited { - font-weight: bold; - color: #cf5a5a; - text-decoration: none; -} - -a:link:hover { - text-decoration: underline; -} - -hr { - background: #cf5a5a; - border-radius: 100px; - height: 6px; - margin: 60px 20%; - border: none; -} - -blockquote { - margin-left: 3em; -} - -ul { - list-style-type: none; -} - -p.name { - font-family: "Andale Mono", monospace; - padding-top: 1em; -} - -span.item-name { - background-color: #fbd350; - display: inline-block; - color: #31302f; - padding: 10px 20px; - border-radius: 25px; - border: 2px solid #bf9817; - font-size: 1em; - font-family: "Source Code Pro", monospace; - font-weight: 700; - letter-spacing: -1px; -} - -pre { - background-color: #056d8d; - border: 2px solid #03475c; - -webkit-box-shadow: 0 0 10px 0 rgba(49, 48, 47, 0.5); - box-shadow: 0 0 10px 0 rgba(49, 48, 47, 0.5); - border-radius: 15px; - color: #f0ece3; - padding: 15px 20px; - margin: 10px 0 10px 0; - font-family: "Source Code Pro", monospace; - -moz-tab-size: 4; - -o-tab-size: 4; - tab-size: 4; - overflow-x: auto; - width: 100%; - font-weight: 400; -} - -pre .keyword { - color: #ffcb1f; -} - -pre .string, pre .number { - color: #eb6e6e; - font-weight: bold; -} - -pre .comment { - color: #b4b1aa; -} - -pre.example { - font-size: .85em; -} - -table.index td { - text-align: left; - vertical-align: top; -} - -#container { - margin-left: auto; - margin-right: auto; - border-radius: 25px; - -webkit-box-shadow: 0 0 25px 0 rgba(49, 48, 47, 0.3); - box-shadow: 0 0 25px 0 rgba(49, 48, 47, 0.3); - overflow: hidden; - max-width: 1600px; -} - -#product { - text-align: center; - height: 500px; - background-color: #31302f; - color: #f0ece3; -} - -#product > :before { - content: 'Noble Engine'; -} - -#product big { - font-size: 2em; -} - -#main { - background-color: #31302f; - display: -webkit-box; - display: -ms-flexbox; - display: flex; - -webkit-box-orient: horizontal; - -webkit-box-direction: normal; - -ms-flex-direction: row; - flex-direction: row; -} - -#navigation { - -webkit-box-flex: 1; - -ms-flex-positive: 1; - flex-grow: 1; - -ms-flex-negative: 0; - flex-shrink: 0; - -ms-flex-preferred-size: auto; - flex-basis: auto; - width: 275px; - padding: 0 10px; - overflow: hidden; - color: #f0ece3; -} - -#navigation a:link, #navigation a:visited { - font-weight: normal; -} - -#navigation .nav-module, -#navigation .nav-modules { - color: #31302f; - padding: 15px; - border-radius: 20px; -} - -#navigation .nav-module a:link, #navigation .nav-module a:visited, -#navigation .nav-modules a:link, -#navigation .nav-modules a:visited { - color: #31302f; -} - -#navigation .nav-module ul a:active, #navigation .nav-module ul a:hover, #navigation .nav-module ul .selected, -#navigation .nav-modules ul a:active, -#navigation .nav-modules ul a:hover, -#navigation .nav-modules ul .selected { - color: #f0ece3; - background-color: #cf5a5a; - padding: 5px 10px; - margin-left: -10px; - border-radius: 30px; - text-decoration: none; -} - -#navigation .nav-module ul .selected, -#navigation .nav-modules ul .selected { - line-height: 2em; - margin-left: -28px; - padding-left: 28px; - border-radius: 0 30px 30px 0; - font-weight: bold; -} - -#navigation .nav-module { - background-color: #eb6e6e; - margin: 0 -10px 20px 10px; - border-radius: 20px 0 0 20px; -} - -#navigation .nav-module h2 { - background-color: #cf5a5a; - color: #f0ece3; - margin: 0; -} - -#navigation .nav-module ul a:active, #navigation .nav-module ul a:hover { - color: #31302f; - background-color: #ffcb1f; -} - -#navigation .nav-modules { - background-color: #f3e5bc; - margin: 0 10px 30px 10px; - padding-top: 5px; -} - -#navigation h1 { - color: #eb6e6e; - line-height: 80%; - font-family: 'Quicksand', sans-serif; - font-weight: 900; - font-size: 32px; - padding-left: 20px; - padding-bottom: 20px; -} - -#navigation h2 { - color: #31302f; - font-size: 1.1em; - background-color: #f0ece3; - padding: 5px 10px; - margin-right: 20px; - border-radius: 30px; - text-decoration: none; -} - -#navigation ul { - font-size: 1em; - list-style-type: none; - margin: 1px 1px 10px 1px; - padding-left: 0px; -} - -#navigation li { - display: block; - margin: 0px 0px 6px 12px; - padding-left: 0px; -} - -#navigation li li a { - margin: 0px 3px 0px -1em; -} - -#content { - -webkit-box-flex: 1; - -ms-flex-positive: 1; - flex-grow: 1; - -ms-flex-negative: 1; - flex-shrink: 1; - -ms-flex-preferred-size: auto; - flex-basis: auto; - min-width: 0; - padding: 2em; - padding-left: 3.5em; - border-left: 4px solid #cf5a5a; - -webkit-box-shadow: inset 0 0 50px 0 rgba(207, 90, 90, 0.25); - box-shadow: inset 0 0 50px 0 rgba(207, 90, 90, 0.25); - background-color: #f0ece3; -} - -#about { - clear: both; - padding: 20px; - border-top: 2px solid #31302f; - background-color: #cf5a5a; - color: #f0ece3; -} - -#about a:link, #about a:visited, #about a:hover, #about a:active { - color: #ffcb1f; -} - -@media print { - body { - font: 12pt "Times New Roman", "TimeNR", Times, serif; - } - a { - font-weight: bold; - color: #1c4e68; - text-decoration: underline; - } - #main { - background-color: #ffffff; - border-left: 0px; - } - #container { - margin-left: 2%; - margin-right: 2%; - background-color: #ffffff; - } - #content { - padding: 1em; - background-color: #ffffff; - } - #navigation { - display: none; - } - pre.example { - font-family: "Andale Mono", monospace; - font-size: 10pt; - page-break-inside: avoid; - } -} - -table.module_list { - border-width: 1px; - border-style: solid; - border-color: #b1e3fa; - border-collapse: collapse; -} - -table.module_list td { - border-width: 1px; - padding: 3px; - border-style: solid; - border-color: #b1e3fa; -} - -table.module_list td.name { - background-color: #e0f4fc; - min-width: 200px; -} - -table.module_list td.summary { - width: 100%; -} - -table.function_list { - border-width: 1px; - border-style: solid; - border-color: #b1e3fa; - border-collapse: collapse; -} - -table.function_list td { - border-width: 1px; - padding: 3px; - border-style: solid; - border-color: #b1e3fa; -} - -table.function_list td.name { - background-color: #e0f4fc; - min-width: 200px; -} - -table.function_list td.summary { - width: 100%; -} - -ul.nowrap { - overflow: auto; - white-space: nowrap; -} - -dl.table dt, -dl.function dt { - padding-top: 1em; -} - -dl.table dd dd, -dl.function dd { - padding-bottom: 30px; - margin: 10px 0 10px 20px; - border-bottom: 2px dotted #056d8d; -} - -dl.table dd > :last-child, -dl.function > :last-child { - border-bottom: none; -} - -dl.table h3, -dl.function h3 { - font-size: .95em; -} - -/* stop sublists from having initial vertical space */ -ul ul { - margin-top: 0px; -} - -ol ul { - margin-top: 0px; -} - -ol ol { - margin-top: 0px; -} - -ul ol { - margin-top: 0px; -} - -/* make the target distinct; helps when we're navigating to a function */ -a:target + * { - border: 2px solid #31302f; - border-bottom: 6px solid #31302f; - background-color: #cf5a5a; - color: #f0ece3; -} -/*# sourceMappingURL=ldoc.css.map */ \ No newline at end of file diff --git a/source/libraries/noble/.docs/logo.png b/source/libraries/noble/.docs/logo.png deleted file mode 100644 index d2abce2..0000000 Binary files a/source/libraries/noble/.docs/logo.png and /dev/null differ diff --git a/source/libraries/noble/.docs/modules/Ease.html b/source/libraries/noble/.docs/modules/Ease.html deleted file mode 100644 index 5d9023c..0000000 --- a/source/libraries/noble/.docs/modules/Ease.html +++ /dev/null @@ -1,176 +0,0 @@ - - - - - Noble Engine API reference - - - - - -
- -
- - - - - - -
- -

Ease

-

Extensions to playdate.easingFunctions, aliased as Ease in Noble Engine.

-

See the Playdate SDK for a list of easing functions.

- -
- -

Functions

- -
-
- - enter(__easingFunction) -
-
- Returns the first half of an "inOut" or "outIn" easing function. - Returns nil for any easing function that isn't in the form of Ease.inOutXxxx or Ease.outInXxxx. Ease.linear returns itself. - -

Parameters

-
    -
  • __easingFunction -
    - - - -
  • -
- - - - -

Usage

-
local ease = Ease.outInQuad
-local easeEnter = Ease.enter(ease)	-- Returns "Ease.outQuad"
- -
-
- - exit(__easingFunction) -
-
- Returns the second half of an "inOut" or "outIn" easing function. - Returns nil for any easing function that isn't in the form of Ease.inOutXxxx or Ease.outInXxxx. Ease.linear returns itself. - -

Parameters

-
    -
  • __easingFunction -
    - - - -
  • -
- - - - -

Usage

-
local ease = Ease.outInQuad
-local easeExit = Ease.exit(ease)		-- Returns "Ease.inQuad"
- -
-
- - reverse(__easingFunction) -
-
- Returns the reverse function of the provided function. - Returns nil for any easing function that isn't in the form of Ease.inXxxx or Ease.outXxxx. Ease.linear returns itself. - -

Parameters

-
    -
  • __easingFunction -
    - - - -
  • -
- - - - -

Usage

-
local ease = Ease.inQuad
-local reverseEase = Ease.reverse(ease) -- Returns "Ease.outQuad"
- -
-
- - -
- -
- -
- Noble Engine by Mark LaCroix, Noble Robot - - Documentation created using LDoc 1.5.0. - -
- -
- - - - diff --git a/source/libraries/noble/.docs/modules/Noble.Animation.html b/source/libraries/noble/.docs/modules/Noble.Animation.html deleted file mode 100644 index 0945b8e..0000000 --- a/source/libraries/noble/.docs/modules/Noble.Animation.html +++ /dev/null @@ -1,507 +0,0 @@ - - - - - Noble Engine API reference - - - - - -
- -
- - - - - - -
- -

Noble.Animation

-

Animation states using a spritesheet/imagetable.

-

Ideal for use with NobleSprite objects. Suitable for other uses as well.

- -
- -

Setup

- -
-
- - Noble.Animation.new(__view) -
-
- Create a new animation "state machine". This function is called automatically when creating a new NobleSprite. - -

Parameters

-
    -
  • __view - string -
    - This can be: the path to a spritesheet image file or an image table object (Graphics.imagetable). See Playdate SDK docs for imagetable file naming conventions. -
  • -
- -

Returns

-
    - - animation, a new animation object. -
- - -

See

- - -

Usage

-
local myHero = MyHero("path/to/spritesheet")
-
-- When extending NobleSprite (recommended), you don't call Noble.Animation.new(),
--- but you do feed its __view argument into MySprite.super.init()...
-MyHero = {}
-class("MyHero").extends(NobleSprite)
-
-function MyHero:init()
-	MyHero.super.init(self, "assets/images/Hero")
-	-- ...
-	-- A new NobleSprite creates a Noble.Animation object named "self.animation"
-	self.animation:addState("idle", 1, 30)
-	self.animation:addState("jump", 31, 34, "float")
-	self.animation:addState("float", 35, 45)
-	self.animation:addState("turn", 46, 55, "idle")
-	self.animation:addState("walk", 56, 65)
-	-- ...
-end
-
local myAnimation = Noble.Animation.new("path/to/spritesheet")
-
-- When extending playdate.graphics.Sprite, Noble.Animation.new() must be called manually...
-MyHero = {}
-class("MyHero").extends(Graphics.sprite)
-
-function MyHero:init()
-	MyHero.super.init(self)
-	-- ...
-	self.animation = Noble.Animation.new("assets/images/Hero")
-	self.animation:addState("idle", 1, 30)
-	self.animation:addState("jump", 31, 34, "float")
-	self.animation:addState("float", 35, 45)
-	self.animation:addState("turn", 46, 55, "idle")
-	self.animation:addState("walk", 56, 65)
-	-- ...
-end
- -
-
- - animation:addState(__name, __startFrame, __endFrame, __next[, __loop=true], __onComplete[, __frameDuration=1]) -
-
- Add an animation state. The first state added will be the default set for this animation.

- -

NOTE: Added states are first-degree member objects of your Noble.Animation object, so do not use names of already existing methods/properties ("current", "draw", etc.). - -

Parameters

-
    -
  • __name - string -
    - The name of the animation, this is also used as the key for the animation. -
  • -
  • __startFrame - integer -
    - This is the first frame of this animation in the imagetable/spritesheet -
  • -
  • __endFrame - integer -
    - This is the final frame of this animation in the imagetable/spritesheet -
  • -
  • __next - string -
    - By default, animation states will loop, but if you want to sequence an animation, enter the name of the next state here. -
  • -
  • __loop - boolean - = true (default) -
    - If you want a state to "freeze" on its final frame, instead of looping, enter false here. -
  • -
  • __onComplete -
    - This function will run when this animation is complete. Be careful when using this on a looping animation! -
  • -
  • __frameDuration - integer - = 1 (default) -
    - This is the number of ticks between each frame in this animation. If not specified, it will be set to 1. -
  • -
- - - - -

Usage

-
-- You can reference an animation's state's properties using bog-standard lua syntax:
-
-animation.idle.startFrame		-- 30
-animation.walk.endFrame			-- 65
-animation.["walk"].endFrame		-- 65
-animation.jump.name				-- "jump"
-animation.["jump"].next			-- "float"
-animation.idle.next				-- nil
- -
-
-

Properties

- -
-
- - animation.current -
-
- The currently set animation state.

- -

This is intended as read-only. You should not modify this property directly. - - - - -

See

- - - -
-
- - animation.currentName -
-
- The name of the current animation state. Calling this instead of animation.current.name is just a little faster.

- -

This is intended as read-only. You should not modify this property directly. - - - - - - -

-
- - animation.currentFrame -
-
- The current frame of the animation. This is the index of the imagetable, not the frame of the current state.

- -

Most of the time, you should not modify this directly, although you can if you're feeling saucy and are prepared for unpredictable results. - - - - -

See

- - - -
-
- - animation.direction -
-
- This controls the flipping of the image when drawing. DIRECTIONRIGHT is unflipped, DIRECTIONLEFT is flipped on the X axis. - - - - - -

Usage

-
function MyHero:goLeft()
-	self.animation.direction = Noble.Animation.DIRECTION_LEFT
-	-- ...
-end
- -
-
-

Methods

- -
-
- - animation:setState(__animationState[, __continuous=false], __unlessThisState) -
-
- Sets the current animation state. This can be run in a object's update method because it only changes the animation state if the new state is different from the current one. - -

Parameters

-
    -
  • __animationState - string or Noble.Animation -
    - The name of the animation to set. You can pass the name of the state, or the object itself. -
  • -
  • __continuous - boolean - = false (default) -
    - Set to true if your new state's frames line up with the previous one's, i.e.: two walk cycles but one is wearing a cute hat! -
  • -
  • __unlessThisState - string or Noble.Animation -
    - If this state is the current state, do not set the new one. -
  • -
- - - - -

Usage

-
animation:setState("walk")
-
animation:setState(animation.walk)
-
animation:setState(animation.walkNoHat)
---
-animation:setState(animation.walkYesHat, true)
-
function MyHero:update()
-	-- Input
-	-- ...
-
-	-- Physics/collisions
-	-- ...
-
-	-- Animation states
-	if (grounded) then
-		if (turning) then
-			self.animation:setState(self.animation.turn)
-		elseif (math.abs(self.velocity.x) > 15) then
-			self.animation:setState(self.animation.walk, false, self.animation.turn)
-		else
-			self.animation:setState(self.animation.idle, false, self.animation.turn)
-		end
-	else
-		self.animation:setState(self.animation.jump, false, self.animation.float)
-	end
-
-	groundedLastFrame = grounded
-end
- -
-
- - animation:draw([__x=0[, __y=0[, __advance=true]]]) -
-
- Draw the current frame.

- -

When attached to a NobleSprite, this is called by NobleSprite:draw() when added to a scene. For non-NobleSprite sprites, put this method inside your sprite's draw() method, or inside NobleScene:update. - -

Parameters

-
    -
  • __x - number - = 0 (default) -
    - - - -
  • -
  • __y - number - = 0 (default) -
    - - - -
  • -
  • __advance - boolean - = true (default) -
    - Advances to the next frame after drawing this one. Noble.Animation is frame-based, not "delta time"-based, so its speed is dependent on your game's framerate. -
  • -
- - - - -

Usage

-
function MySprite:draw()
-	animation:draw()
-end
-
function MyScene:update()
-	animation:draw(100,100)
-end
- -
-
- - animation:drawFrame(__frameNumber[, __stateName=self.currentName[, __x=0[, __y=0[, __direction=self.direction]]]]) -
-
- Sometimes, you just want to draw a specific frame. - Use this for objects or sprites that you want to control outside of update loops, such as score counters, flipbook-style objects that respond to player input, etc. - -

Parameters

-
    -
  • __frameNumber - integer -
    - The frame to draw from the current state. This is not an imagetable index. Entering 1 will draw the selected state's startFrame. -
  • -
  • __stateName - string - = self.currentName (default) -
    - The specific state to pull the __frameNumber from. -
  • -
  • __x - number - = 0 (default) -
    - - - -
  • -
  • __y - number - = 0 (default) -
    - - - -
  • -
  • __direction - = self.direction (default) -
    - Override the current direction. -
  • -
- - - - - -
-
-

Constants

- -
-
- - Noble.Animation.DIRECTION_RIGHT -
-
- A re-contextualized instance of playdate.graphics.kImageUnflipped - - - - - - -
-
- - Noble.Animation.DIRECTION_LEFT -
-
- A re-contextualized instance of playdate.graphics.kImageFlippedX - - - - - - -
-
- - -
- -
- -
- Noble Engine by Mark LaCroix, Noble Robot - - Documentation created using LDoc 1.5.0. - -
- -
- - - - diff --git a/source/libraries/noble/.docs/modules/Noble.Bonk.html b/source/libraries/noble/.docs/modules/Noble.Bonk.html deleted file mode 100644 index 38feee4..0000000 --- a/source/libraries/noble/.docs/modules/Noble.Bonk.html +++ /dev/null @@ -1,188 +0,0 @@ - - - - - Noble Engine API reference - - - - - -
- -
- - - - - - -
- -

Noble.Bonk

-

Engine-specific error handling.

-

Noble Engine overrides/supersedes some Playdate SDK behavior. A "bonk" is what happens when your game breaks the engine.

- -

Most bonks will throw during normal operation, but others ("debug bonks") introduce some execution overhead so are not - checked by default.

- -
- -

Functions

- -
-
- - Noble.Bonk.startCheckingDebugBonks() -
-
- Begin checking for debug bonks, on every frame. This introduces needless overhead, so don't do it in a release build. - You can only run this if you ran previously Noble.new() with __enableDebugBonkChecking as true, which you should also not do in a release build. - - - - -

See

- - - -
-
- - Noble.Bonk.stopCheckingDebugBonks() -
-
- Stop checking for debug bonks on every frame.

- -

NOTE: You can only run this if debug bonk checking is enabled. - - - - - - -

-
- - Noble.Bonk.disableDebugBonkChecking() -
-
- Disable the ability to check for debug bonks. It frees up some memory. Once you disable debug bonk checking, you cannot re-enable it.

- -

NOTE: You can only run this if debug bonk checking is enabled. - - - - - - -

-
- - Noble.Bonk.checkingDebugBonks() -
-
- Are we debug bonk checking for debug bonks? - - -

Returns

-
    - - bool - - - -
- - - - -
-
- - Noble.Bonk.checkDebugBonks() -
-
- Manually check for debug bonks. - This method runs every frame when checkingDebugBonks is true, but you may call it manually instead.

- -

NOTE: You can only run this if debug bonk checking is enabled. - - - - - - -

-
- - -
- -
- -
- Noble Engine by Mark LaCroix, Noble Robot - - Documentation created using LDoc 1.5.0. - -
- -
- - - - diff --git a/source/libraries/noble/.docs/modules/Noble.GameData.html b/source/libraries/noble/.docs/modules/Noble.GameData.html deleted file mode 100644 index 9cdb090..0000000 --- a/source/libraries/noble/.docs/modules/Noble.GameData.html +++ /dev/null @@ -1,550 +0,0 @@ - - - - - Noble Engine API reference - - - - - -
- -
- - - - - - -
- -

Noble.GameData

-

Operations for game data / save slots.

-

- -

- -
- -

Functions

- -
-
- - Noble.GameData.setup(__keyValuePairs[, __numberOfSlots=1[, __saveToDisk=true[, __modifyExistingOnKeyChange=true]]]) -
-
- Sets up the GameDatas (save slots) for your game, and/or loads any existing GameDatas from disk. - You can only run this once, ideally in your main.lua before you load your first scene. - -

Parameters

-
    -
  • __keyValuePairs - table -
    - All the data items for a saved game, and their default values, as key/value pairs. NOTE: Do not use "nil" as a value. -
  • -
  • __numberOfSlots - integer - = 1 (default) -
    - If you want multiple save slots, enter an integer here. You can add additional slots later. -
  • -
  • __saveToDisk - boolean - = true (default) -
    - Saves your default values immediately to disk. -
  • -
  • __modifyExistingOnKeyChange - boolean - = true (default) -
    - Updates the existing gameData objects on disk if you make changes to your keys (not values) during development or when updating your game. -
  • -
- - - -

See

- - -

Usage

-
Noble.GameData.setup(
-	{
-		name = "",
-		checkpointReached = 0,
-		score = 0
-	},
-	3,
-	true,
-	true
-)
-Noble.GameData.set("name", "Game A", 1)
-Noble.GameData.set("name", "Game B", 2)
-Noble.GameData.set("name", "Game C", 3)
- -
-
- - Noble.GameData.get(__dataItemName[, __gameDataSlot]) -
-
- Returns the value of the requested data item. - -

Parameters

-
    -
  • __dataItemName - string -
    - The name of the data item. -
  • -
  • __gameDataSlot - integer - (optional) -
    - If set, uses a specific GameData slot. If not, uses the most recently touched GameData slot. -
  • -
- -

Returns

-
    - - any - - - -
- - - -

Usage

-
Noble.GameData.get("equippedItem")
-
Noble.GameData.get("equippedItem", 2)
- -
-
- - Noble.GameData.set(__dataItemName, __value[, __gameDataSlot[, __saveToDisk=true[, __updateTimestamp=true]]]) -
-
- Set the value of a GameData item. - -

Parameters

-
    -
  • __dataItemName - string -
    - The name of the data item. -
  • -
  • __value - any -
    - The data item's new value -
  • -
  • __gameDataSlot - integer - (optional) -
    - If set, uses a specific GameData slot. If not, uses the most recently touched GameData slot. -
  • -
  • __saveToDisk - boolean - = true (default) -
    - Saves to disk immediately. Set to false if you prefer to manually save (via a checkpoint or menu). -
  • -
  • __updateTimestamp - boolean - = true (default) -
    - Sets the timestamp of this GameData to the current time. Leave false to retain existing timestamp. -
  • -
- - - -

See

- - -

Usage

-
Noble.GameData.set("score", 74205)
-
Noble.GameData.set("score", Noble.GameData.get("score") + 100)
- -
-
- - Noble.GameData.reset(__dataItemName[, __gameDataSlot[, __saveToDisk=true[, __updateTimestamp=true]]]) -
-
- Reset a GameData item to its default value, defined in setup. - -

Parameters

-
    -
  • __dataItemName - string -
    - The name of the data item. -
  • -
  • __gameDataSlot - integer - (optional) -
    - If set, uses a specific GameData slot. If not, uses the most recently touched GameData slot. -
  • -
  • __saveToDisk - boolean - = true (default) -
    - Saves to disk immediately. Set to false if you prefer to manually save (via a checkpoint or menu). -
  • -
  • __updateTimestamp - boolean - = true (default) -
    - Resets the timestamp of this GameData to the current time. Leave false to retain existing timestamp. -
  • -
- - - -

See

- - - -
-
- - Noble.GameData.resetAll([__gameDataSlot[, __saveToDisk=true[, __updateTimestamp=true]]]) -
-
- Reset all values in a GameData slot to the default values, defined in setup. - -

Parameters

-
    -
  • __gameDataSlot - integer - (optional) -
    - If set, uses a specific GameData slot. If not, uses the most recently touched GameData slot. -
  • -
  • __saveToDisk - boolean - = true (default) -
    - Saves to disk immediately. Set to false if you prefer to manually save (via a checkpoint or menu). -
  • -
  • __updateTimestamp - boolean - = true (default) -
    - Resets the timestamp of this GameData to the current time. Leave false to retain existing timestamp. -
  • -
- - - -

See

- - - -
-
- - Noble.GameData.addSlot([__numberToAdd=1[, __saveToDisk=true]]) -
-
- Add a save slot to your game. This is useful for games which have arbitrary save slots, or encourage save scumming. - -

Parameters

-
    -
  • __numberToAdd - integer - = 1 (default) -
    - What it says on the tin. -
  • -
  • __saveToDisk - boolean - = true (default) -
    - Saves to disk immediately. Set to false if you prefer to manually save (via a checkpoint or menu). -
  • -
- - - - -

Usage

-
Noble.GameData.addSlot()
-
Noble.GameData.addSlot(10)
- -
-
- - Noble.GameData.deleteSlot(__gameDataSlot[, __collapseGameDatas=true]) -
-
- Deletes a GameData from disk if its save slot is greater than the default number established in setup. - Otherwise, resets all data items to default values using resetAll.

- -

Generally, you won't need this unless you've added save slots using addSlot. In other cases, use resetAll. - -

Parameters

-
    -
  • __gameDataSlot - integer -
    - The slot holding the GameData to delete. Unlike other methods that take this argument, this is not optional. -
  • -
  • __collapseGameDatas - boolean - = true (default) -
    - Re-sorts the gameDatas table (and renames existing JSON files on disk) to fill the gap left by the deleted GameData. -
  • -
- - - -

See

- - -

Usage

-
Noble.GameData.deleteSlot(6)
-
Noble.GameData.deleteSlot(15, false)
- -
-
- - Noble.GameData.deleteAllSlots() -
-
- Deletes all GameDatas from disk, except for the number specified in setup, which are reset to default values. - Use this to clear all data as if you were running setup again. - Generally, you don't need this unless you've added save slots using addSlot. In other cases, use resetAll on each slot. - - - - -

See

- - - -
-
- - Noble.GameData.getTimestamp(__gameDataSlot) -
-
- Returns the timestamp of the requested GameData, as a tuple (local time, GMT time). The timestamp is updated - See Playdate SDK for details on how a time object is formatted. NOTE: Timestamps are stored internally in GMT. - -

Parameters

-
    -
  • __gameDataSlot - integer -
    - The GameData slot to get the timestamp of. Unlike other methods that take this argument, this is not optional. -
  • -
- -

Returns

-
    -
  1. - table - Local time
  2. -
  3. - table - GMT time
  4. -
- - - -

Usage

-
Noble.GameData.getTimestamp(1)
- -
-
- - Noble.GameData.getNumberOfSlots() -
-
- Returns the current number of GameData slots. - - -

Returns

-
    - - int - - - -
- - - - -
-
- - Noble.GameData.getCurrentSlot() -
-
- Returns the number of the current GameData slot. - - -

Returns

-
    - - int - - - -
- - - - -
-
- - Noble.GameData.save([__gameDataSlot]) -
-
- Saves a single GameData to disk. If you want to save all GameDatas, use saveAll instead. - -

Parameters

-
    -
  • __gameDataSlot - integer - (optional) -
    - If set, uses a specific GameData slot. If not, uses the most recently touched GameData slot. -
  • -
- - - -

See

- - -

Usage

-
Noble.GameData.save()
-
Noble.GameData.save(3)
- -
-
- - Noble.GameData.saveAll() -
-
- Save all GameDatas to disk. If you only have one, or want to save a specific one, use save instead. - - - - -

See

- - - -
-
- - -
- -
- -
- Noble Engine by Mark LaCroix, Noble Robot - - Documentation created using LDoc 1.5.0. - -
- -
- - - - diff --git a/source/libraries/noble/.docs/modules/Noble.Input.html b/source/libraries/noble/.docs/modules/Noble.Input.html deleted file mode 100644 index 877a799..0000000 --- a/source/libraries/noble/.docs/modules/Noble.Input.html +++ /dev/null @@ -1,617 +0,0 @@ - - - - - Noble Engine API reference - - - - - -
- -
- - - - - - -
- -

Noble.Input

-

A complete encapsulation of the Playdate's input system.

-

The Playdate SDK gives developers multiple ways to manage input. Noble Engine's approach revolves around the SDK's "inputHandlers," extending them to include additional input methods, and pull in other hardware functions that the SDK puts elsewhere. See usage below for the full list of supported methods. -

By default, Noble Engine assumes each scene will have an inputManager assigned to it. So, for example, you can define one inputManager for menu screens and another for gameplay scenes in your main.lua, and then in each scene, set which one that scene uses. You can instead define a unique inputHandler in each scene. -

You may also create and manage inputManagers within and outside of scenes. When a NobleScene is loaded, its inputHandler will become active, thus, inputHandlers do not carry across scenes, and all input is suspended during scene transitions. An advanced use-case is to leave a scene's inputHandler as nil, and manage it separately. -

NOTE: While the Playdate SDK allows you to stack as many inputHandlers as you want, Noble Engine assumes only one active inputHandler at a time. You may still manually call playdate.inputHandlers.push() and playdate.inputHandlers.pop() yourself, but Noble Engine will not know about it and it may cause unexpected behavior. -

In addition, you may directly query button status using the SDK's methods for that, but it is not advised to use that as the primary way to manage input for Noble Engine projects, because much of Noble.Input's functionality will not apply.

-

See

- -

Usage

-
local myInputHandler = {
-	AButtonDown = function() end,	-- Fires once when button is pressed down.
-	AButtonHold = function() end,	-- Fires each frame while a button is held (Noble Engine implementation).
-	AButtonHeld = function() end,	-- Fires once after button is held for 1 second (available for A and B).
-	AButtonUp = function() end,		-- Fires once when button is released.
-	BButtonDown = function() end,
-	BButtonHold = function() end,
-	BButtonHeld = function() end,
-	BButtonUp = function() end,
-	downButtonDown = function() end,
-	downButtonHold = function() end,
-	downButtonUp = function() end,
-	leftButtonDown = function() end,
-	leftButtonHold = function() end,
-	leftButtonUp = function() end,
-	rightButtonDown = function() end,
-	rightButtonHold = function() end,
-	rightButtonUp = function() end,
-	upButtonDown = function() end,
-	upButtonHold = function() end
-	upButtonUp = function() end,
-
-	cranked = function(change, acceleratedChange) end,	-- See Playdate SDK.
-	crankDocked = function() end,						-- Noble Engine implementation.
-	crankUndocked = function() end,						-- Noble Engine implementation.
-
-	orientationChanged = function() end					-- Noble Engine implementation.
-}
-
- -
- -

Functions

- -
-
- - Noble.Input.getHandler() -
-
- Get the currently active input handler. Returns nil if none are active. - - -

Returns

-
    - - table - A table of callbacks which handle input events. -
- - -

See

- - - -
-
- - Noble.Input.setHandler([__inputHandler=nil]) -
-
- Use this to change the active inputHandler. -

Enter nil to disable input. Use Noble.Input.setEnabled to disable/enable input without losing track of the current inputHandler. - -

Parameters

-
    -
  • __inputHandler - table - = nil (default) -
    - A table of callbacks which handle input events. -
  • -
- - - -

See

- - - -
-
- - Noble.Input.clearHandler() -
-
- A helper function that calls Noble.Input.setHandler() with no argument. - - - - -

See

- - - -
-
- - Noble.Input.setEnabled(__value) -
-
- Enable and disable user input without dealing with inputHanders. - The Playdate SDK requires removing all inputHanders to halt user input, so while the currentHandler is cleared when false is passed to this method, - it is cached so it can be later re-enabled by passing true it. - -

Parameters

-
    -
  • __value - boolean -
    - Set to false to halt input. Set to true to resume accepting input. -
  • -
- - - -

See

- - - -
-
- - Noble.Input.getEnabled() -
-
- Checks to see that there is an active inputHandler - - -

Returns

-
    - - bool - Returns true if the input system is enabled. Returns false if setEnabled(false) was used, or if currentHandler is nil. -
- - - - -
-
- - Noble.Input.setCrankIndicatorStatus(__active[, __evenWhenUndocked=false]) -
-
- Enable/disable on-screen system crank indicator.

- -

NOTE: The indicator will only ever show if the crank is docked, unless __evenWhenUndocked is true. - -

Parameters

-
    -
  • __active - boolean -
    - Set true to start showing the on-screen crank indicator. Set false to stop showing it. -
  • -
  • __evenWhenUndocked - boolean - = false (default) -
    - Set true to show the crank indicator even if the crank is already undocked (__active must also be true). -
  • -
- - - - - -
-
- - Noble.Input.getCrankIndicatorStatus() -
-
- Checks whether the system crank indicator status. Returns a tuple. - - -

Returns

-
    -
  1. - bool - Is the crank indicator active?
  2. -
  3. - bool - Is the crank indicator being forced when active, even when the crank is undocked?
  4. -
- - -

See

- - - -
-
- - Noble.Input.getOrientation([__getStoredValues=false]) -
-
- Checks the current display orientation of the device. Returns a tuple. - If the accelerometer is not currently enabled, this method will turn it on, return current values, and then turn it off. - If you are trying to get raw accelerometer values rather than the display orientation, you may want to use playdate.readAccelerometer() instead. - -

Parameters

-
    -
  • __getStoredValues - boolean - = false (default) -
    - If true, this method will simply return the most recently stored values, rather than use the accelerometer to check for new ones. -
  • -
- -

Returns

-
    -
  1. - str - The named orientation of the device (a pseudo enum Noble.Input.ORIENTATION_XX)
  2. -
  3. - list - Accelerometer values, where list[1] is x, list[2] is y and list[3] is z
  4. -
- - -

See

- - - -
-
-

Constants -

- -
- A set of constants referencing device inputs, stored as strings. Can be used for querying button input, - but are mainly for on-screen prompts or other elements where a string literal is useful, such as a filename, GameData value, or localization key. - For faster performance, use the ones that exist in the Playdate SDK (i.e.: playdate.kButtonA), which are stored as binary numbers. -
-

Usage

-
function newPrompt(__input, __promptString)
-	-- ...
-	local icon = Graphics.image.new("assets/images/UI/Icon_" .. __input)
-	-- ...
-end
-
-promptMove = newPrompt(Noble.Input.DPAD_HORIZONTAL, "Move!")				-- assets/images/UI/Icon_dPadHorizontal.png"
-promptJump = newPrompt(Noble.Input.BUTTON_A, "Jump!") 						-- assets/images/UI/Icon_buttonA.png"
-promptCharge = newPrompt(Noble.Input.CRANK_FORWARD, "Charge the battery!")	-- assets/images/UI/Icon_crankForward.png"
-
-
- - Noble.Input.BUTTON_A -
-
- "buttonA" - - - - - - -
-
- - Noble.Input.BUTTON_B -
-
- "buttonB" - - - - - - -
-
- - Noble.Input.BUTTON_MENU -
-
- The system menu button.

- -

"buttonMenu" - - - - - - -

-
- - Noble.Input.DPAD -
-
- Referencing the D-pad component itself, rather than an input.

- -

"dPad" - - - - - - -

-
- - Noble.Input.DPAD_HORIZONTAL -
-
- Referencing the left and right input D-pad inputs.

- -

"dPadHorizontal" - - - - - - -

-
- - Noble.Input.DPAD_VERTICAL -
-
- Referencing the up and down input D-pad inputs.

- -

"dPadVertical" - - - - - - -

-
- - Noble.Input.DPAD_UP -
-
- "dPadUp" - - - - - - -
-
- - Noble.Input.DPAD_DOWN -
-
- "dPadDown" - - - - - - -
-
- - Noble.Input.DPAD_LEFT -
-
- "dPadLeft" - - - - - - -
-
- - Noble.Input.DPAD_RIGHT -
-
- "dPadRight" - - - - - - -
-
- - Noble.Input.CRANK -
-
- Referencing the crank component itself, rather than an input.

- -

"crank" - - - - - - -

-
- - Noble.Input.CRANK_FORWARD -
-
- AKA: Clockwise. See Playdate SDK.

- -

"crankForward" - - - - - - -

-
- - Noble.Input.CRANK_REVERSE -
-
- AKA: Anticlockwise. See Playdate SDK.

- -

"crankReverse" - - - - - - -

-
- - Noble.Input.CRANK_DOCK -
-
- Referencing the action of docking the crank.

- -

"crankDock" - - - - - - -

-
- - Noble.Input.CRANK_UNDOCK -
-
- Referencing the action of undocking the crank.

- -

"crankUndock" - - - - - - -

-
- - Noble.Input.ORIENTATION_UP -
-
- Referencing the display orientations.

- -

"orientationUp" - - - - - - -

-
- - -
- -
- -
- Noble Engine by Mark LaCroix, Noble Robot - - Documentation created using LDoc 1.5.0. - -
- -
- - - - diff --git a/source/libraries/noble/.docs/modules/Noble.Menu.html b/source/libraries/noble/.docs/modules/Noble.Menu.html deleted file mode 100644 index 98beff1..0000000 --- a/source/libraries/noble/.docs/modules/Noble.Menu.html +++ /dev/null @@ -1,928 +0,0 @@ - - - - - Noble Engine API reference - - - - - -
- -
- - - - - - -
- -

Noble.Menu

-

An extended implementation of playdate.ui.gridview, meant for 1-dimensional, single-screen text menus.

-

- -

- -
- -

Setup

- -
-
- - Noble.Menu.new([__activate=true[, __alignment=Noble.Text.ALIGN_LEFT[, __localized=false[, __color=Graphics.kColorBlack[, __padding=2[, __horizontalPadding[, __margin=2[, __font=Noble.Text.getCurrentFont()[, __selectedCornerRadius=__font:getHeight()/4[, __selectedOutlineThickness=1]]]]]]]]]]) -
-
- Create a new menu object. - -

Parameters

-
    -
  • __activate - boolean - = true (default) -
    - Activate this menu upon creation. -
  • -
  • __alignment - = Noble.Text.ALIGN_LEFT (default) -
    - The text alignment of menu items. -
  • -
  • __localized - boolean - = false (default) -
    - If true, menu item names are localization keys rather than display names. -
  • -
  • __color - = Graphics.kColorBlack (default) -
    - The color of menu item text. The selected highlight will be the inverse color. -
  • -
  • __padding - integer - = 2 (default) -
    - Cell padding for menu items. -
  • -
  • __horizontalPadding - integer - (optional) -
    - Use this to override horizontal padding, useful for certain fonts. If nil, uses __padding. -
  • -
  • __margin - integer - = 2 (default) -
    - Spacing between menu items. -
  • -
  • __font - = Noble.Text.getCurrentFont() (default) -
    - If nil, uses current set font. -
  • -
  • __selectedCornerRadius - integer - = __font:getHeight()/4 (default) -
    - Sets rounded corners for a selected menu item. -
  • -
  • __selectedOutlineThickness - integer - = 1 (default) -
    - Sets the outline thickness for selected items. -
  • -
- -

Returns

-
    - - menu, a new menu item. -
- - -

See

- - -

Usage

-
local menu = Noble.Menu.new(
-	true,
-	Noble.Text.ALIGN_CENTER,
-	false,
-	Graphics.kColorWhite,
-	4, 6,
-	Noble.Text.large,
-	nil, 3
-)
-menu:addItem("Play Game", function() TitleScreen:playGame() end)
-menu:addItem("Options", function() Noble.transition(OptionsScreen) end)
-menu:addItem("Credits", function() Noble.transition(CreditsScreen) end)
- -
-
- - menu:addItem(__nameOrKey[, __clickHandler[, __position[, __displayName[, __displayNameIsALocalizationKey=false]]]]) -
-
- Adds a item to this menu. - -

Parameters

-
    -
  • __nameOrKey - string -
    - The name of this menu item. It can be a display name or a localization key. Must be unique. -
  • -
  • __clickHandler - function - (optional) -
    - The function that runs when this menu item is "clicked." -
  • -
  • __position - integer - (optional) -
    - Insert the item at a specific position. If not set, adds to the end of the list. -
  • -
  • __displayName - string - (optional) -
    - You can create an optional, separate display name for this item. You can add or change this at runtime via setItemDisplayName. -
  • -
  • __displayNameIsALocalizationKey - boolean - = false (default) -
    - If true, will treat the __displayName as a localization key. This is separate from this menu's localized value. -
  • -
- - - -

See

- - - -
-
- - menu:removeItem([__menuItem=#menu.itemNames]) -
-
- Removes a item from this menu. - -

Parameters

-
    -
  • __menuItem - int or string - = #menu.itemNames (default) -
    - The menu item to remove. You can enter either the item's name/key or it's position. If left blank, removes the last item. -
  • -
- - - -

See

- - - -
-
-

Properties

- -
-
- - menu.localized -
-
- - - - -
    -
  • _ - boolean - = false (default) -
    - Indicates whether this menu's item names are treated as localization keys. -
  • -
- - - - - -
-
- - menu.currentItemNumber -
-
- - - - -
    -
  • _ - integer -
    - The current menu item's index.

    - -

    This is meant as a read-only value. Do not modify it directly. -

  • -
- - - -

See

- - - -
-
- - menu.currentItemName -
-
- - - - -
    -
  • _ - string -
    - The current menu item's name.

    - -

    This is meant as a read-only value. Do not modify it directly. -

  • -
- - - -

See

- - - -
-
- - menu.width -
-
- - - - -
    -
  • _ - integer -
    - The width of the widest menu item plus the menu's horizontal padding.

    - -

    This is meant as a read-only value. Do not modify it directly. -

  • -
- - - - - -
-
-

Methods

- -
-
- - menu:activate() -
-
- Activate this menu. - This selects the most recently selected menu item (or the first item if none have been previously selected), and enables this menu's selectPrevious, selectNext, and click methods. - - - - - -

Usage

-
local menu = Noble.Menu.new(false)
-menu:activate()
- -
-
- - menu:deactivate() -
-
- Deactivate this menu. - This deselects all menu items, and disables this menu's selectPrevious, selectNext, and click methods. - - - - - -

Usage

-
local menu = Noble.Menu.new(true)
-menu:deactivate()
- -
-
- - menu:isActive() -
-
- Check to see if this menu is currently active. - - -

Returns

-
    - - bool - - - -
- - - - -
-
- - menu:selectPrevious([__force=false[, __wrapSelection=true]]) -
-
- Selects the previous item in this menu. This menu must be active. - -

Parameters

-
    -
  • __force - boolean - = false (default) -
    - Force this method to run, even if this menu is not active. -
  • -
  • __wrapSelection - boolean - = true (default) -
    - Selects the final menu item if the first menu item is currently selected. -
  • -
- - - -

See

- - -

Usage

-
TitleScreen.inputHandler.upButtonDown = function()
-	menu:selectPrevious()
-end
- -
-
- - menu:selectNext([__force=false[, __wrapSelection=true]]) -
-
- Selects the next previous item in this menu. This menu must be active. - -

Parameters

-
    -
  • __force - boolean - = false (default) -
    - Force this method to run, even if this menu is not active. -
  • -
  • __wrapSelection - boolean - = true (default) -
    - Selects the first menu item if the final menu item is currently selected. -
  • -
- - - -

See

- - -

Usage

-
TitleScreen.inputHandler.downButtonDown = function()
-	menu:selectNext()
-end
- -
-
- - menu:select(__menuItem[, __force=false]) -
-
- Selects a specific item in this menu, either by it's index, or it's name. This menu must be active. - -

Parameters

-
    -
  • __menuItem - int or string -
    - The menu item to select. You can enter the item's number or it's name/key. -
  • -
  • __force - boolean - = false (default) -
    - Force this method to run, even if this menu is not active. -
  • -
- - - -

See

- - -

Usage

-
function resetMenu()
-	menu:select(1, true)
-	menu:deactivate()
-end
-
function resetMenu()
-	menu:select("Play Game", true)
-	menu:deactivate()
-end
- -
-
- - menu:click([__force=false]) -
-
- Runs the function associated with the currently selected menu item. This menu must be active. - -

Parameters

-
    -
  • __force - boolean - = false (default) -
    - Force this method to run, even if this menu is not active. -
  • -
- - - -

See

- - -

Usage

-
TitleScreen.inputHandler.AButtonDown = function()
-	menu:click()
-end
- -
-
- - menu:getItemDisplayName(__itemName) -
-
- Gets the display name of a menu item.

- -

If a menu item does not have a display name, then the __nameOrKey (or its localized string) will be returned instead. This method is used internally when draw is called.

- -

If this menu's localized value is true, a returned __nameOrKey will always be localized, but a returned display name is only localized if the __displayNameIsALocalizationKey argument was set to true when the display name was added. - -

Parameters

-
    -
  • __itemName - string -
    - The menu item you want the display name of. -
  • -
- -

Returns

-
    - - string - - - -
- - -

See

- - - -
-
- - menu:setItemDisplayName(__itemName, __displayName[, __displayNameIsALocalizationKey=false]) -
-
- When you add a menu item, you can give it a display name that's different from it's actual name. This method adds or changes the display name of a menu item. - -

Parameters

-
    -
  • __itemName - string -
    - The menu item name (or key if this menu uses localization keys). -
  • -
  • __displayName - string -
    - The display name. -
  • -
  • __displayNameIsALocalizationKey - boolean - = false (default) -
    - Set to use to indicate that this display name is a localization key. This setting is separate from localized -
  • -
- - - - -

Usage

-
function changeDifficultyLevel(__level)
-	menu:setItemDisplayName("Difficulty", "Difficulty: " .. __level)
-end
- -
-
-

Tables

- -
-
- - menu.itemNames -
-
- A string "array" of menu item strings/keys. - You cannot add or remove menu items by modifying this table. - It is meant as a read-only table, provided for convenience when iterating, etc. Modifying its values may break other methods. - - - - -

See

- - -

Usage

-
for i = 1, #menu.itemNames, 1 do
-	menu.clickHandlers[menu.itemNames[i]]	= nil -- Clears all click handlers, for some reason.
-end
- -
-
- - menu.clickHandlers -
-
- A table of functions associated with menu items. Items are a defined when calling addItem, but their associated functions may be modified afterward.

- -

You cannot add or remove menu items by modifying this table. - - - - -

See

- - -

Usage

-
local menu = Noble.Menu.new(true)
-menu.addItem("Play Game")
-menu.addItem("Options")
-
-menu.clickHandlers["Play Game"] = function() TitleScreen:playGame() end
-menu.clickHandlers["Options"] = function() Noble.transition(OptionsScreen) end
-
local menu = Noble.Menu.new(true)
-menu.addItem("Play Game")
-menu.addItem("Options")
-
-menu.clickHandlers = {
-	["Play Game"] = function TitleScreen:playGame() end,
-	["Options"] = function() Noble.transition(OptionsScreen) end
-}
- -
-
- - menu.itemPositions -
-
- A key/value table of menu item indices.

- -

This is meant as a read-only table, provided for convenience. Modifying its values will break other methods. - - - - - -

Usage

-
menu.itemPositions["Play Game"]	-- 1
-menu.itemPositions["Options"]	-- 2
- -
-
- - menu.itemWidths -
-
- A key/value table of pixel widths for each menu item, based on its text. Useful for animation, layout, etc.

- -

This is meant as a read-only table, provided for convenience. Modifying its values will break other methods. - - - - - -

Usage

-
local playGameMenuItemWidth = menu.itemWidths["Play Game"]
- -
-
-

Drawing

- -
-
- - menu:draw(__x, __y) -
-
- Draw's this menu to the screen. You may call this manually, but ideally, you will put it in in your scene's update or drawBackground method. - -

Parameters

-
    -
  • __x -
    - - - -
  • -
  • __y -
    - - - -
  • -
- - - - -

Usage

-
function YourScene:update()
-	YourScene.super.update(self)
-	menu:draw(50, 100)
-end
- -
-
- - menu:drawItem(__x, __y, __itemIndex) -
-
- This method is called for every non-selected item when draw is called. You shouldn't call this directly, but you may re-implement it if you wish. - -

Parameters

-
    -
  • __x -
    - - - -
  • -
  • __y -
    - - - -
  • -
  • __itemIndex -
    - - - -
  • -
- - - -

See

- - -

Usage

-
-- This is the default implementation for this method.
-function menu:drawItem(__x, __y, __itemIndex)
-	Graphics.setImageDrawMode(self.fillMode)
-	local xAdjustment = 0
-	if (self.alignment == Noble.Text.ALIGN_CENTER) then
-		xAdjustment = self.width/2 - self.horizontalPadding/2
-	elseif (self.alignment == Noble.Text.ALIGN_RIGHT) then
-		xAdjustment = self.width - self.horizontalPadding
-	end
-	Noble.Text.draw(self.itemNames[__itemIndex], __x + self.horizontalPadding/2 + xAdjustment, __y + self.padding/2, self.alignment, self.localized, self.font)
-end
- -
-
- - menu:drawSelectedItem(__x, __y, __itemIndex) -
-
- This method is called for every selected item when draw is called. You shouldn't call this directly, but you may re-implement it if you wish. - -

Parameters

-
    -
  • __x -
    - - - -
  • -
  • __y -
    - - - -
  • -
  • __itemIndex -
    - - - -
  • -
- - - -

See

- - -

Usage

-
-- This is the default implementation for this method.
-function menu:drawSelectedItem(__x, __y, __itemIndex)
-	local xAdjustmentText = 0
-	local xAdjustmentRect = 0
-	if (self.alignment == Noble.Text.ALIGN_CENTER) then
-		xAdjustmentText = self.width/2 - self.horizontalPadding/2
-	xAdjustmentRect = self.width/2 - self.itemWidths[self.itemNames[__itemIndex]]/2 - self.horizontalPadding/2
-	elseif (self.alignment == Noble.Text.ALIGN_RIGHT) then
-		xAdjustmentText = self.width - self.horizontalPadding
-		xAdjustmentRect = self.width - self.itemWidths[self.itemNames[__itemIndex]] - self.horizontalPadding
-	end
-	Graphics.setColor(self.color)
-	Graphics.fillRoundRect(__x + xAdjustmentRect, __y, self.itemWidths[self.itemNames[__itemIndex]]+self.horizontalPadding, self.textHeight+self.padding, self.selectedCornerRadius)
-	Graphics.setColor(self.otherColor)
-	Graphics.setLineWidth(self.selectedOutlineThickness)
-	Graphics.drawRoundRect(__x + xAdjustmentRect, __y, self.itemWidths[self.itemNames[__itemIndex]]+self.horizontalPadding, self.textHeight+self.padding, self.selectedCornerRadius)
-	Graphics.setImageDrawMode(self.otherFillMode)
-	Noble.Text.draw(self.itemNames[__itemIndex], __x + self.horizontalPadding/2 + xAdjustmentText, __y+self.padding/2, self.alignment, self.localized, self.font)
-end
- -
-
- - -
- -
- -
- Noble Engine by Mark LaCroix, Noble Robot - - Documentation created using LDoc 1.5.0. - -
- -
- - - - diff --git a/source/libraries/noble/.docs/modules/Noble.Settings.html b/source/libraries/noble/.docs/modules/Noble.Settings.html deleted file mode 100644 index 60ffb05..0000000 --- a/source/libraries/noble/.docs/modules/Noble.Settings.html +++ /dev/null @@ -1,331 +0,0 @@ - - - - - Noble Engine API reference - - - - - -
- -
- - - - - - -
- -

Noble.Settings

-

Operations for game settings / stats.

-

- -

- -
- -

Functions

- -
-
- - Noble.Settings.setup(__keyValuePairs[, __saveToDisk=true[, __modifyExistingOnKeyChange=true]]) -
-
- Sets up the settings for your game. You can only run this once, and you must run it before using other Noble.Settings functions. It is recommended to place it in your main.lua, before Noble.new().

- -

NOTE: You will not be able to add new keys via the Noble.Settings.set method. This means you need to specify the keys and default values of all of the settings in your game at setup. - If you need to add keys that are not known during setup, it is probably not a setting and you should consider using Noble.GameData instead. - -

Parameters

-
    -
  • __keyValuePairs - table -
    - table. Your game's settings, and thier default values, as key/value pairs. NOTE: Do not use "nil" as a value. -
  • -
  • __saveToDisk - boolean - = true (default) -
    - Saves your default values immediatly to disk. -
  • -
  • __modifyExistingOnKeyChange - boolean - = true (default) -
    - Updates the existing settings object on disk if you make changes to your settings keys (not values) during development or when updating your game. -
  • -
- - - - -

Usage

-
Noble.Settings.setup({
-	difficulty = "normal",
-	music = true,
-	sfx = true,
-	players = 2,
-	highScore = 0	-- You can store persistant stats here, too!
-})
- -
-
- - Noble.Settings.get(__settingName) -
-
- Get the value of a setting. - -

Parameters

-
    -
  • __settingName - string -
    - The name of the setting. -
  • -
- -

Returns

-
    - - any - The value of the requested setting. -
- - -

See

- - - -
-
- - Noble.Settings.set(__settingName, __value[, __saveToDisk=true]) -
-
- Set the value of a setting.

- -

NOTE: If __settingName is not a key in the __keyValuePairs dictionary given to the setup method it will not be added to the Settings. - -

Parameters

-
    -
  • __settingName - string -
    - The name of the setting. -
  • -
  • __value - any -
    - The setting's new value -
  • -
  • __saveToDisk - boolean - = true (default) -
    - Saves to disk immediately. Set to false if you prefer to manually save (via a confirm button, etc). -
  • -
- - - -

See

- - - -
-
- - Noble.Settings.reset(__settingName[, __saveToDisk=true]) -
-
- Resets the value of a setting to its default value defined in setup(). - -

Parameters

-
    -
  • __settingName - string -
    - The name of the setting. -
  • -
  • __saveToDisk - boolean - = true (default) -
    - Saves to disk immediately. Set to false if you prefer to manually save (via a confirm button, etc). -
  • -
- - - -

See

- - - -
-
- - Noble.Settings.resetSome(__settingNames[, __saveToDisk=true]) -
-
- Resets the value of multiple settings to thier default value defined in setup(). This is useful if you are storing persistant stats like high scores in Settings and want the player to be able to reset them seperately. - -

Parameters

-
    -
  • __settingNames - table -
    - The names of the settings, in an array-style table. -
  • -
  • __saveToDisk - boolean - = true (default) -
    - Saves to disk immediately. Set to false if you prefer to manually save (via a confirm button, etc). -
  • -
- - - -

See

- - - -
-
- - Noble.Settings.resetAll([__saveToDisk=true]) -
-
- Resets all settings to thier default values defined in setup(). - -

Parameters

-
    -
  • __saveToDisk - boolean - = true (default) -
    - Saves to disk immediately. Set to false if you prefer to manually save (via a confirm button, etc). -
  • -
- - - -

See

- - - -
-
- - Noble.Settings.save() -
-
- Saves settings to disk. - You don't need to call this unless you set __saveToDisk as false when setting or resetting a setting (say that five times fast!). - - - - -

See

- - - -
-
- - -
- -
- -
- Noble Engine by Mark LaCroix, Noble Robot - - Documentation created using LDoc 1.5.0. - -
- -
- - - - diff --git a/source/libraries/noble/.docs/modules/Noble.Text.html b/source/libraries/noble/.docs/modules/Noble.Text.html deleted file mode 100644 index 9a01b52..0000000 --- a/source/libraries/noble/.docs/modules/Noble.Text.html +++ /dev/null @@ -1,313 +0,0 @@ - - - - - Noble Engine API reference - - - - - -
- -
- - - - - - -
- -

Noble.Text

-

Text and font handling.

-

- -

- -
- -

Constants

- -
-
- - Noble.Text.ALIGN_LEFT -
-
- An alternate way to call Playdate SDK's kTextAlignment.left - - - - - - -
-
- - Noble.Text.ALIGN_RIGHT -
-
- An alternate way to call Playdate SDK's kTextAlignment.right - - - - - - -
-
- - Noble.Text.ALIGN_CENTER -
-
- An alternate way to call Playdate SDK's kTextAlignment.center - - - - - - -
-
-

Fonts

- -
- You can use these fonts in your project, or override them with your own if you wish. -
-

Usage

-
Noble.Text.FONT_SMALL = Graphics.font.new("assets/fonts/MySmallFont")
-Noble.Text.setFont(Noble.Text.FONT_SMALL)
-
-
- - Noble.Text.FONT_SYSTEM -
-
- The Playdate system font. - - - - - - -
-
- - Noble.Text.FONT_SMALL -
-
- Noble Sans: A sans-serif 8×9 font, with English and Japanese-Kana character sets. - - - - - - -
-
- - Noble.Text.FONT_MEDIUM -
-
- Noble Slab: (This font is not ready yet!) - - - - - - -
-
- - Noble.Text.FONT_LARGE -
-
- Satchel Roughed: A sans-serif 17×14 rounded font, with an English character set. - - - - - - -
-
-

Functions

- -
-
- - Noble.Text.getCurrentFont() -
-
- - - - - -

Returns

-
    - - The currently set font. -
- - - - -
-
- - Noble.Text.setFont(__font, __variant) -
-
- Set the current font - -

Parameters

-
    -
  • __font -
    - any -
  • -
  • __variant -
    - any -
  • -
- - - - - -
-
- - Noble.Text.draw(__string, __x, __y[, __alignment=Noble.Text.ALIGN_LEFT[, __localized=false[, __font=Noble.Text.getCurrentFont()]]]) -
-
- Abstracts multiple playdate.text drawing functions into one. - -

Parameters

-
    -
  • __string - string -
    - Display text or localization key. -
  • -
  • __x - number -
    - - - -
  • -
  • __y - number -
    - - - -
  • -
  • __alignment - = Noble.Text.ALIGN_LEFT (default) -
    - Left, right, or center! -
  • -
  • __localized - boolean - = false (default) -
    - If true, __string is a localization key rather than display text. -
  • -
  • __font - = Noble.Text.getCurrentFont() (default) -
    - A font to use. If not set, the currentFont is used. If set, the currentFont is not updated. -
  • -
- - - - - -
-
- - -
- -
- -
- Noble Engine by Mark LaCroix, Noble Robot - - Documentation created using LDoc 1.5.0. - -
- -
- - - - diff --git a/source/libraries/noble/.docs/modules/Noble.Transition.html b/source/libraries/noble/.docs/modules/Noble.Transition.html deleted file mode 100644 index ec3a03c..0000000 --- a/source/libraries/noble/.docs/modules/Noble.Transition.html +++ /dev/null @@ -1,1377 +0,0 @@ - - - - - Noble Engine API reference - - - - - -
- -
- - - - - - -
- -

Noble.Transition

-

An abstract class from which transition types are extended.

-

- -

- -
- -

Functions

- -
-
- - Noble.Transition.setDefaultProperties(__transition, __properties) -
-
- Use this to modify multiple default properties of a transition. Having default properties avoids having to set them every time a transition is called. - Properties added here are merged with the existing default properties table. Overwrites only happen when a new value is set. - -

Parameters

-
    -
  • __transition -
    - - - -
  • -
  • __properties -
    - - - -
  • -
- - - -

See

- - -

Usage

-
Noble.Transition.setDefaultProperties(Noble.Transition.CrossDissolve, {
-	dither = Graphics.image.kDitherTypeDiagonalLine
-	ease = Ease.outQuint
-})
-Noble.Transition.setDefaultProperties(Noble.Transition.SpotlightMask, {
-	x = 325,
-	y = 95,
-	invert = true
-})
- -
-
- - Noble.Transition:setProperties(__arguments) -
-
- Do not call this directly. Implement this in a custom transition in order to set properties from user arguments given in Noble.transition(). See existing transitions for implementation examples. - -

Parameters

-
    -
  • __arguments -
    - - - -
  • -
- - - -

See

- - - -
-
- - Noble.Transition:onStart() -
-
- Do not call this directly. Implement this in a custom transition in order to run custom code when the transition starts. Default transitions in Noble Engine do not use this. - - - - - - -
-
- - Noble.Transition:onMidpoint() -
-
- Do not call this directly. Implement this in a custom transition in order to run custom code when the transition reaches its midpoint. Default transitions in Noble Engine do not use this. - - - - - - -
-
- - Noble.Transition:onHoldTimeElapsed() -
-
- Do not call this directly. Implement this in a custom transition in order to run custom code when the transition's hold time has elapsed. Default transitions in Noble Engine do not use this. - - - - - - -
-
- - Noble.Transition:onComplete() -
-
- Do not call this directly. Implement this in a custom transition in order to run custom code when the transition completes. Default transitions in Noble Engine do not use this. - - - - - - -
-
- - Noble.Transition:draw() -
-
- Do not call this directly. Implement this in a custom transition to draw the transition. This runs once per frame while the transition is running. See existing transitions for implementation examples. - - - - - - -
-
-

Tables

- -
-
- - Noble.Transition.defaultProperties -
-
- A transition may have unique properties that can be set by the user when invoked. This table holds the default values for those properties. - - - - -

See

- - - -
-
-

Fields

- -
-
- - Noble.Transition.Type.CUT -
-
- A transition type where no time at all passes between scenes. - - - - -

See

-
    -
- - -
-
- - Noble.Transition.Type.COVER -
-
- A transition type that has an "Enter" phase and an "Exit" phase. The new scene does not become active until the Enter phase is complete. A "holdTime" value determines how long to wait after the Enter phase completes before starting the Exit phase. - - - - -

See

-
    -
- - -
-
- - Noble.Transition.Type.MIX -
-
- A transition type that takes a screenshot of the exiting scene and activates the new scene before beginning the transition, allowing for both scenes to appear to be visible during the transition. - - - - -

See

-
    -
- - -
-
-

Noble.Transition.CrossDissolve

- -
-
- - Noble.Transition.CrossDissolve.defaultProperties -
-
- A simple cross-fade. - -

Fields

-
    -
  • ease - Ease - = Ease.outCubic (default) -
    - - - -
  • -
  • dither - Graphics.image.kDither - = Graphics.image.kDitherTypeBayer4x4 (default) -
    - - - -
  • -
- - - - - -
-
-

Noble.Transition.Cut

- -
-
- - Noble.Transition.Cut.defaultProperties -
-
- An all-time classic. - This transition has no properties. - - - - - - -
-
-

Noble.Transition.Dip

- -
-
- - Noble.Transition.Dip.defaultProperties -
-
- Fade to an image, then to the next scene. - -

Fields

-
    -
  • holdTime - number - = 0.25 (default) -
    - - - -
  • -
  • panelImage - Graphics.image -
    - - - -
  • -
  • dither - Graphics.image.kDither - = Graphics.image.kDitherTypeBayer4x4 (default) -
    - - - -
  • -
  • ease - Ease - = Ease.outInQuad (default) -
    - - - -
  • -
  • x - number - = 0 (default) -
    - - - -
  • -
  • y - number - = 0 (default) -
    - - - -
  • -
- - - - - -
-
-

Noble.Transition.DipToBlack

- -
-
- - Noble.Transition.DipToBlack.defaultProperties -
-
- Fade to black, then to the next scene. - NOTE: The panelImage property is locked. - - - - -

See

- - - -
-
-

Noble.Transition.DipToWhite

- -
-
- - Noble.Transition.DipToWhite.defaultProperties -
-
- Fade to white, then to the next scene. - NOTE: The panelImage property is locked. - - - - -

See

- - - -
-
-

Noble.Transition.Imagetable

- -
-
- - Noble.Transition.Imagetable.defaultProperties -
-
- A dip-style transition using one or two imagetables. - -

Fields

-
    -
  • holdTime - number - = 0 (default) -
    - - - -
  • -
  • imagetable - Graphics.imagetable -
    - - - -
  • -
  • reverse - boolean - = false (default) -
    - - - -
  • -
  • flipX - boolean - = false (default) -
    - - - -
  • -
  • flipY - boolean - = false (default) -
    - - - -
  • -
  • rotate - boolean - = false (default) -
    - - - -
  • -
  • imagetableEnter - Graphics.imagetable -
    - - - -
  • -
  • reverseEnter - boolean - = nil (default) -
    - - - -
  • -
  • flipXEnter - boolean - = nil (default) -
    - - - -
  • -
  • flipYEnter - boolean - = nil (default) -
    - - - -
  • -
  • rotateEnter - boolean - = nil (default) -
    - - - -
  • -
  • imagetableExit - Graphics.imagetable -
    - - - -
  • -
  • reverseExit - boolean - = nil (default) -
    - - - -
  • -
  • flipXExit - boolean - = nil (default) -
    - - - -
  • -
  • flipYExit - boolean - = nil (default) -
    - - - -
  • -
  • rotateExit - boolean - = nil (default) -
    - - - -
  • -
- - - -

See

- - - -
-
-

Noble.Transition.ImagetableMask

- -
-
- - Noble.Transition.ImagetableMask.defaultProperties -
-
- A wipe transition using an animated mask in the form of an imagetable. - -

Fields

-
    -
  • imagetable - Graphics.imagetable -
    - - - -
  • -
  • reverse - boolean - = false (default) -
    - Set true to play the imagetable's frames in reverse order. -
  • -
  • flipX - boolean - = false (default) -
    - - - -
  • -
  • flipY - boolean - = false (default) -
    - - - -
  • -
  • rotate - boolean - = false (default) -
    - Set as true to rotate the image 180-degrees -
  • -
  • hasTransparency - boolean - = true (default) -
    - Set as true if the imagetable asset has transparent pixels. Set as false if the image uses white pixels for transparency. -
  • -
  • invert - boolean - = false (default) -
    - Set as true to invert the image mask. -
  • -
- - - -

See

- - - -
-
-

Noble.Transition.MetroNexus

- -
-
- - Noble.Transition.MetroNexus.defaultProperties -
-
- A "cascade" wipe transition, taken from "Metro Nexus" by Noble Robot. - This transition has no properties. - - - - - - -
-
-

Noble.Transition.SlideOff

- -
-
- - Noble.Transition.SlideOff.defaultProperties -
-
- The previous scene slides off the screen, revealing the next scene. - -

Fields

-
    -
  • ease - Ease - = Ease.outInQuad (default) -
    - - - -
  • -
  • x - number - = 0 (default) -
    - - - -
  • -
  • y - number - = 0 (default) -
    - - - -
  • -
  • rotation - number - = 0 (default) -
    - - - -
  • -
- - - - - -
-
-

Noble.Transition.SlideOffDown

- -
-
- - Noble.Transition.SlideOffDown.defaultProperties -
-
- The previous scene slides off the bottom of the screen, revealing the next scene. - NOTE: The x, y, and rotation properties are locked. - - - - -

See

- - - -
-
-

Noble.Transition.SlideOffLeft

- -
-
- - Noble.Transition.SlideOffLeft.defaultProperties -
-
- The previous scene slides off the left side of the screen, revealing the next scene. - NOTE: The x, y, and rotation properties are locked. - - - - -

See

- - - -
-
-

Noble.Transition.SlideOffRight

- -
-
- - Noble.Transition.SlideOffRight.defaultProperties -
-
- The previous scene slides off the right side of the screen, revealing the next scene. - NOTE: The x, y, and rotation properties are locked. - - - - -

See

- - - -
-
-

Noble.Transition.SlideOffUp

- -
-
- - Noble.Transition.SlideOffUp.defaultProperties -
-
- The previous scene slides off the top of the screen, revealing the next scene. - NOTE: The x, y, and rotation properties are locked. - - - - -

See

- - - -
-
-

Noble.Transition.SlideOn

- -
-
- - Noble.Transition.SlideOn.defaultProperties -
-
- The next scene slides on the screen, covering up the previous scene. - -

Fields

-
    -
  • ease - Ease - = Ease.outInQuad (default) -
    - - - -
  • -
  • x - number - = 0 (default) -
    - - - -
  • -
  • y - number - = 0 (default) -
    - - - -
  • -
  • rotation - number - = 0 (default) -
    - - - -
  • -
- - - - - -
-
-

Noble.Transition.SlideOnDown

- -
-
- - Noble.Transition.SlideOnDown.defaultProperties -
-
- The next scene slides onto the screen from the top, covering up the previous scene. - NOTE: The x, y, and rotation properties are locked. - - - - -

See

- - - -
-
-

Noble.Transition.SlideOnLeft

- -
-
- - Noble.Transition.SlideOnLeft.defaultProperties -
-
- The next scene slides onto the screen right-to-left, covering up the previous scene. - NOTE: The x, y, and rotation properties are locked. - - - - -

See

- - - -
-
-

Noble.Transition.SlideOnRight

- -
-
- - Noble.Transition.SlideOnRight.defaultProperties -
-
- The next scene slides onto the screen left-to-right, covering up the previous scene. - NOTE: The x, y, and rotation properties are locked. - - - - -

See

- - - -
-
-

Noble.Transition.SlideOnUp

- -
-
- - Noble.Transition.SlideOnUp.defaultProperties -
-
- The next scene slides onto the screen from the bottom, covering up the previous scene. - NOTE: The x, y, and rotation properties are locked. - - - - -

See

- - - -
-
-

Noble.Transition.Spotlight

- -
-
- - Noble.Transition.Spotlight.defaultProperties -
-
- A spotlight in-out transition. - -

Fields

-
    -
  • holdTime - number - = 0.25 (default) -
    - - - -
  • -
  • panelImage - Graphics.image -
    - - - -
  • -
  • dither - Graphics.image.kDither - = Graphics.image.kDitherTypeBayer4x4 (default) -
    - - - -
  • -
  • ease - Ease - = Ease.outInQuad (default) -
    - - - -
  • -
  • x - number - = 200 (default) -
    - - - -
  • -
  • y - number - = 120 (default) -
    - - - -
  • -
  • easeEnter - Ease - = nil (default) -
    - - - -
  • -
  • xEnter - number - = nil (default) -
    - - - -
  • -
  • yEnter - number - = nil (default) -
    - - - -
  • -
  • xEnterStart - number - = nil (default) -
    - - - -
  • -
  • yEnterStart - number - = nil (default) -
    - - - -
  • -
  • xEnterEnd - number - = nil (default) -
    - - - -
  • -
  • yEnterEnd - number - = nil (default) -
    - - - -
  • -
  • easeEnter - Ease - = nil (default) -
    - - - -
  • -
  • xExit - number - = nil (default) -
    - - - -
  • -
  • yExit - number - = nil (default) -
    - - - -
  • -
  • xExitStart - number - = nil (default) -
    - - - -
  • -
  • yExitStart - number - = nil (default) -
    - - - -
  • -
  • xExitEnd - number - = nil (default) -
    - - - -
  • -
  • yExitEnd - number - = nil (default) -
    - - - -
  • -
- - - -

See

- - - -
-
-

Noble.Transition.SpotlightMask

- -
-
- - Noble.Transition.SpotlightMask.defaultProperties -
-
- A circle wipe transition. - -

Fields

-
    -
  • ease - Ease - = Ease.outQuad (default) -
    - - - -
  • -
  • x - number - = 200 (default) -
    - - - -
  • -
  • y - number - = 120 (default) -
    - - - -
  • -
  • xStart - number - = nil (default) -
    - - - -
  • -
  • yStart - number - = nil (default) -
    - - - -
  • -
  • xEnd - number - = nil (default) -
    - - - -
  • -
  • yEnd - number - = nil (default) -
    - - - -
  • -
  • invert - boolean - = false (default) -
    - - - -
  • -
- - - -

See

- - - -
-
-

Noble.Transition.WidgetSatchel

- -
-
- - Noble.Transition.MetroNexus.defaultProperties -
-
- An "accordion" transition, taken from "Widget Satchel" by Noble Robot. - This transition has no properties. - - - - - - -
-
- - -
- -
- -
- Noble Engine by Mark LaCroix, Noble Robot - - Documentation created using LDoc 1.5.0. - -
- -
- - - - diff --git a/source/libraries/noble/.docs/modules/Noble.TransitionType.html b/source/libraries/noble/.docs/modules/Noble.TransitionType.html deleted file mode 100644 index 34d6549..0000000 --- a/source/libraries/noble/.docs/modules/Noble.TransitionType.html +++ /dev/null @@ -1,240 +0,0 @@ - - - - - Noble Engine API reference - - - - - -
- -
- - - - - - -
- -

Noble.TransitionType

-

A set of constants for scene transition animations.

-

- -

-

See

- - -
- -

Constants

- -
-
- - Noble.TransitionType.CUT -
-
- An all-time classic. - - - - - - -
-
- - Noble.TransitionType.CROSS_DISSOLVE -
-
- A simple cross-fade. - - - - - - -
-
- - Noble.TransitionType.DIP_TO_BLACK -
-
- Fade to black, then to the next scene. - - - - - - -
-
- - Noble.TransitionType.DIP_TO_WHITE -
-
- Fade to white, then to the next scene. - - - - - - -
-
- - Noble.TransitionType.DIP_WIDGET_SATCHEL -
-
- An "accordion" transition, from "Widget Satchel" by Noble Robot. - - - - - - -
-
- - Noble.TransitionType.DIP_METRO_NEXUS -
-
- A "cascade" transition, from "Metro Nexus" by Noble Robot. - - - - - - -
-
- - Noble.TransitionType.SLIDE_OFF_LEFT -
-
- The existing scene slides off the left side of the screen, revealing the next scene. - - - - - - -
-
- - Noble.TransitionType.SLIDE_OFF_RIGHT -
-
- The existing scene slides off the right side of the screen, revealing the next scene. - - - - - - -
-
- - Noble.TransitionType.SLIDE_OFF_UP -
-
- The existing scene slides off the top of the screen. - - - - - - -
-
- - Noble.TransitionType.SLIDE_OFF_DOWN -
-
- The existing scene slides off the bottom of the screen, revealing the next scene. - - - - - - -
-
- - -
- -
- -
- Noble Engine by Mark LaCroix, Noble Robot - - Documentation created using LDoc 1.5.0. - -
- -
- - - - diff --git a/source/libraries/noble/.docs/modules/Noble.html b/source/libraries/noble/.docs/modules/Noble.html deleted file mode 100644 index 5988601..0000000 --- a/source/libraries/noble/.docs/modules/Noble.html +++ /dev/null @@ -1,476 +0,0 @@ - - - - - Noble Engine API reference - - - - - -
- -
- - - - - - -
- -

Noble

-

A li'l game engine for Playdate.

-

- -

- -
- -

Functions

- -
-
- - new(StartingScene[, __launcherTransitionDuration=0[, __launcherTransition=Noble.Transition.DipToBlack[, __launcherTransitionProperties={}[, __configuration={}]]]]) -
-
- Engine initialization. Run this once in your main.lua file to begin your game. - -

Parameters

-
    -
  • StartingScene - NobleScene -
    - This is the scene your game begins with, such as a title screen, loading screen, splash screen, etc. NOTE: Pass the scene's class name, not an instance of the scene. -
  • -
  • __launcherTransitionDuration - number - = 0 (default) -
    - If you want to transition from the final frame of your launch image sequence, enter a duration in seconds here. -
  • -
  • __launcherTransition - Noble.Transition - = Noble.Transition.DipToBlack (default) -
    - If a transition duration is set, use this transition type. -
  • -
  • __launcherTransitionProperties - table - = {} (default) -
    - Provide a table of properties to apply to the launcher transition. See the documentation for the transition you're using for a list of available properties. -
  • -
  • __configuration - table - = {} (default) -
    - Provide a table of Noble Engine configuration values. This will run Noble.setConfig for you at launch. -
  • -
- - - -

See

- - -

Usage

-
Noble.new(
-	TitleScreen,
-	2,
-	Noble.Transition.DipToWhite,
-	{
-		holdTime = 0,
-		ease = Ease.outInQuad
-	},
-	{
-		defaultTransition = Noble.Transition.Imagetable,
-		defaultTransitionDuration = 1.75,
-		enableDebugBonkChecking = true,
-	}
-)
- -
-
- - engineInitialized() -
-
- This checks to see if Noble.new has been run. It is used internally to ward off bonks. - - -

Returns

-
    - - bool - - - -
- - -

See

- - - -
-
- - getConfig() -
-
- Retrieve miscellaneous Noble Engine configuration options / default values - - -

Returns

-
    - - A table of all configuration values -
- - -

See

- - - -
-
- - setConfig(__configuration) -
-
- Optionally customize miscellaneous Noble Engine configuration options / default values. You may run this method to change these values during runtime. - -

Parameters

-
    -
  • __configuration - table -
    - This is a table with your configuration values in it. -
  • -
- - - -

See

- - - -
-
- - resetConfig() -
-
- Reset miscellaneous Noble Engine configuration values to their defaults. - - - - -

See

- - - -
-
- - transition(NewScene[, __duration=1.5[, __transition=Noble.TransitionType.DIP_TO_BLACK[, __transitionProperties={}]]]) -
-
- Transition to a new scene (at the end of this frame). - This method will create a new scene, mark the previous one for garbage collection, and animate between them. - Additional calls to this method within the same frame (before the already-called transition begins), will override previous calls. Any calls to this method once a transition begins will be ignored until the transition completes. - -

Parameters

-
    -
  • NewScene - NobleScene -
    - The scene to transition to. Pass the scene's class, not an instance of the scene. You always transition from Noble.currentScene -
  • -
  • __duration - number - = 1.5 (default) -
    - The length of the transition, in seconds. -
  • -
  • __transition - Noble.Transition - = Noble.TransitionType.DIP_TO_BLACK (default) -
    - If a transition duration is set, use this transition type. If not set, it will use the value of configuration.defaultTransition. -
  • -
  • __transitionProperties - table - = {} (default) -
    - A table consisting of properties for this transition. Properties not set here will use values that transition's defaultProperties table. -
  • -
- - - -

See

- - -

Usage

-
Noble.transition(Level2, 1, Noble.Transition.CrossDissolve, {
-	dither = Graphics.image.kDitherTypeDiagonalLine
-	ease = Ease.outQuint
-})
---
-Noble.transition(Level2, 1, Noble.Transition.DipToBlack, {
-	holdTime = 0.5,
-	ease = Ease.outInElastic
-})
---
-Noble.transition(Level2, 1, Noble.Transition.SlideOff, {
-	x = 400,
-	y = 150
-	rotation = 45
-})
- -
-
- - currentScene() -
-
- Get the current scene object - - -

Returns

-
    - - NobleScene - - - -
- - - - -
-
- - currentSceneName() -
-
- Get the name of the current scene - - -

Returns

-
    - - string - - - -
- - - - -
-
- - isTransitioning() -
-
- Check to see if the game is transitioning between scenes. - Useful to control game logic that lives outside of a scene's update() method. - - -

Returns

-
    - - bool - - - -
- - - - -
-
-

Tables

- -
-
- - configuration -
-
- Miscellaneous Noble Engine configuration options / default values. - This table cannot be edited directly. Use Noble.getConfig and Noble.setConfig. - -

Fields

-
    -
  • defaultTransition - Noble.Transition - = Noble.Transition.DipToBlack (default) -
    - When running Noble.transition if the transition is unspecified, it will use this one. -
  • -
  • defaultTransitionDuration - number - = 1.5 (default) -
    - When running Noble.transition if the scene transition duration is unspecified, it will take this long in seconds. -
  • -
  • enableDebugBonkChecking - boolean - = false (default) -
    - Noble Engine-specific errors are called "Bonks." You can set this to true during development in order to check for more of them. However, it uses resources, so you will probably want to turn it off before release. -
  • -
  • alwaysRedraw - boolean - = true (default) -
    - This sets the Playdate SDK method playdate.graphics.sprite.setAlwaysRedraw. See the Playdate SDK for details on how this function works, and the reasons you might want to set it as true or false for your project. -
  • -
- - - -

See

- - - -
-
-

Fields

- -
-
- - showFPS -
-
- Show/hide the Playdate SDK's FPS counter. - -
    -
  • bool -
    - - - -
  • -
- - - - - -
-
- - -
- -
- -
- Noble Engine by Mark LaCroix, Noble Robot - - Documentation created using LDoc 1.5.0. - -
- -
- - - - diff --git a/source/libraries/noble/.docs/modules/favicon.ico b/source/libraries/noble/.docs/modules/favicon.ico deleted file mode 100644 index 0e6485a..0000000 Binary files a/source/libraries/noble/.docs/modules/favicon.ico and /dev/null differ diff --git a/source/libraries/noble/.docs/modules/modules.Noble.Transition.Imagetable.html b/source/libraries/noble/.docs/modules/modules.Noble.Transition.Imagetable.html deleted file mode 100644 index 303fa3e..0000000 --- a/source/libraries/noble/.docs/modules/modules.Noble.Transition.Imagetable.html +++ /dev/null @@ -1,92 +0,0 @@ - - - - - Noble Engine API reference - - - - - -
- -
- - - - - - -
- -

modules.Noble.Transition.Imagetable

-

Transition properties.

-

- -

-

See

- - -
- - - -
- -
- -
- Noble Engine by Mark LaCroix, Noble Robot - - Documentation created using LDoc 1.5.0. - -
- -
- - - - diff --git a/source/libraries/noble/.docs/modules/modules.Noble.Transition.ImagetableMask.html b/source/libraries/noble/.docs/modules/modules.Noble.Transition.ImagetableMask.html deleted file mode 100644 index a8e2326..0000000 --- a/source/libraries/noble/.docs/modules/modules.Noble.Transition.ImagetableMask.html +++ /dev/null @@ -1,92 +0,0 @@ - - - - - Noble Engine API reference - - - - - -
- -
- - - - - - -
- -

modules.Noble.Transition.ImagetableMask

-

Transition properties.

-

- -

-

See

- - -
- - - -
- -
- -
- Noble Engine by Mark LaCroix, Noble Robot - - Documentation created using LDoc 1.5.0. - -
- -
- - - - diff --git a/source/libraries/noble/.gitattributes b/source/libraries/noble/.gitattributes deleted file mode 100644 index 61d1124..0000000 --- a/source/libraries/noble/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -.docs/** linguist-documentation diff --git a/source/libraries/noble/.github/FUNDING.yml b/source/libraries/noble/.github/FUNDING.yml deleted file mode 100644 index ed753b5..0000000 --- a/source/libraries/noble/.github/FUNDING.yml +++ /dev/null @@ -1,13 +0,0 @@ -# These are supported funding model platforms - -github: NobleRobot -#patreon: # Replace with a single Patreon username -#open_collective: # Replace with a single Open Collective username -ko_fi: NobleRobot -#tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel -#community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry -#liberapay: # Replace with a single Liberapay username -#issuehunt: # Replace with a single IssueHunt username -#otechie: # Replace with a single Otechie username -#lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry -#custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/source/libraries/noble/.github/ISSUE_TEMPLATE/bug_report.md b/source/libraries/noble/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index 1286a8c..0000000 --- a/source/libraries/noble/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,23 +0,0 @@ ---- -name: Bug report -about: Help track problems in the project -title: '' -labels: bug -assignees: '' - ---- - -**Describe the bug** -(A clear and concise description of what the bug is.) - -**To reproduce** -(Steps to reproduce the behavior:) - -**Expected behavior** -(A clear and concise description of what you expected to happen.) - -**Screenshots/Code snippets** -(If applicable, add screenshots or code snippets to help explain your problem.) - -**Additional context** -(Add any other context about the problem here.) diff --git a/source/libraries/noble/.github/ISSUE_TEMPLATE/feature_request.md b/source/libraries/noble/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index 6a837ca..0000000 --- a/source/libraries/noble/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,23 +0,0 @@ ---- -name: Feature request -about: Suggest an idea for this project -title: '' -labels: enhancement -assignees: '' - ---- - -**Describe the feature** -(A clear and concise description of your proposal.) - - -**Describe alternatives you've considered** -(A clear and concise description of any alternative solutions or features you've considered.) - - -**What problems would this solve or help prevent, if any** -(OPTIONAL: If this feature is related to a bug or other problem, describe it here.) - - -**Additional context** -(Add any other context or screenshots about the feature request here.) diff --git a/source/libraries/noble/.github/workflows/Documentation.yml b/source/libraries/noble/.github/workflows/Documentation.yml deleted file mode 100644 index 075af24..0000000 --- a/source/libraries/noble/.github/workflows/Documentation.yml +++ /dev/null @@ -1,60 +0,0 @@ -name: Update documentation - -on: - push: - branches: - - 'main' - -jobs: - generate-docs: - runs-on: ubuntu-latest - steps: - - - name: Check out main branch - uses: actions/checkout@v3 - - - name: Install Lua - uses: leafo/gh-actions-lua@v10.0.0 - with: - luaVersion: "5.4" - - - name: Install Luarocks package manager - uses: leafo/gh-actions-luarocks@v4.3.0 - - - name: Install LDoc (with dependencies) - run: | - luarocks install ldoc - - - name: Generate HTML documentation using LDoc - run: | - ldoc -c .docs/.ldoc/config.ldoc . - - - name: Commit any changes made inside the .docs folder - uses: EndBug/add-and-commit@v9.1.1 - with: - add: '.docs' - remove: '.lua' - default_author: github_actions - author_name: Noble Robot - author_email: contact@noblerobot.com - message: '(Documentation updates)' - push: true - - - name: Remove .lua - uses: JesseTG/rm@v1.0.3 - with: - path: .lua - - - name: Remove .luarocks - uses: JesseTG/rm@v1.0.3 - with: - path: .luarocks - - - uses: numtide/clean-git-action@v1 - - - name: GitHub Pages Overwriter - uses: rayluo/github-pages-overwriter@v1.3 - - with: - source-directory: .docs - target-branch: gh_pages \ No newline at end of file diff --git a/source/libraries/noble/.gitignore b/source/libraries/noble/.gitignore deleted file mode 100644 index a850910..0000000 --- a/source/libraries/noble/.gitignore +++ /dev/null @@ -1,46 +0,0 @@ -# Compiled Lua sources -luac.out - -# luarocks build files -*.src.rock -*.zip -*.tar.gz - -# Object files -*.o -*.os -*.ko -*.obj -*.elf - -# Precompiled Headers -*.gch -*.pch - -# Libraries -*.lib -*.a -*.la -*.lo -*.def -*.exp - -# Shared objects (inc. Windows DLLs) -*.dll -*.so -*.so.* -*.dylib - -# Executables -*.exe -*.out -*.app -*.i*86 -*.x86_64 -*.hex - -.vscode - -# LDoc config files -config.ld -.docs_templates/ diff --git a/source/libraries/noble/CODE_OF_CONDUCT.md b/source/libraries/noble/CODE_OF_CONDUCT.md deleted file mode 100644 index d00725b..0000000 --- a/source/libraries/noble/CODE_OF_CONDUCT.md +++ /dev/null @@ -1,43 +0,0 @@ -# Contributor Code of Conduct - -## Pledge - -This project pledges to make participation a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation. - -The project's leaders pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community. - -## Standards - -Examples of behavior that contributes to a positive environment include: - -* Demonstrating empathy and kindness toward other people. -* Being respectful of differing opinions, viewpoints, and experiences. -* Giving and gracefully accepting constructive feedback. -* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience. -* Valuing the contributions of others, in effort but also time. -* Focusing on what is best not just for us as individuals, but for others as well. - -Examples of unacceptable behavior include: - -* The use of sexualized language or imagery, and sexual attention or advances of any kind. -* Trolling, insulting, or derogatory comments. -* Personal or political attacks. -* Public or private harassment. -* Publishing others' private information, such as a physical or email address, without their explicit permission. -* Other conduct which could reasonably be considered inappropriate in a professional setting. - -## Enforcement - -Project leaders are responsible for clarifying and enforcing standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful. - -Project leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate. - -Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at contact@noblerobot.com. All complaints will be reviewed and investigated promptly and fairly. - -All project leaders are obligated to respect the privacy and security of the reporter of any incident. - -## Attribution - -This Code of Conduct is adapted and simplified from Contributor Covenant version 2.0, which is available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. - -For answers to common questions about the originating document, see the FAQ at https://www.contributor-covenant.org/faq. diff --git a/source/libraries/noble/LICENSE b/source/libraries/noble/LICENSE deleted file mode 100644 index 8ddfb39..0000000 --- a/source/libraries/noble/LICENSE +++ /dev/null @@ -1,51 +0,0 @@ -Licenses - --- - -"assets/images/NobleRobotLogo.png" - -© 2021 Mark LaCroix, Noble Robot - -You are granted a non-exclusive license to this version of the Noble Robot -logo, solely for the purposes of providing credit, if you choose, in a -resulting product which uses this software. You may not sell or create -commercial derivative works from this asset, or use it in any other context. - -Where appropriate, and at your discretion, include the logo unmodified against -a black background, or inverted against a white background, with a version of -the following message: - -"Created with Noble Engine, by Noble Robot. https://noblerobot.com" - --- - -"libraries/" - -Sequence library by Nic Magnier -Signal library by Dustin Mierau - --- - -All other assets - -MIT License - -© 2021 Mark LaCroix, Noble Robot - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/source/libraries/noble/Noble.lua b/source/libraries/noble/Noble.lua deleted file mode 100644 index 3c6bd16..0000000 --- a/source/libraries/noble/Noble.lua +++ /dev/null @@ -1,375 +0,0 @@ ---- A li'l game engine for Playdate. --- @module Noble - --- --- https://noblerobot.com/ --- - --- Playdate libraries -import "CoreLibs/graphics" -import "CoreLibs/sprites" -import "CoreLibs/animation" -import "CoreLibs/animator" -import "CoreLibs/object" -import "CoreLibs/ui" -import "CoreLibs/math" -import "CoreLibs/timer" -import "CoreLibs/frameTimer" -import "CoreLibs/crank" - --- We create aliases for both fun and performance reasons. -Graphics = playdate.graphics -Display = playdate.display -Geometry = playdate.geometry -Ease = playdate.easingFunctions -UI = playdate.ui -File = playdate.file -Datastore = playdate.datastore -Timer = playdate.timer -FrameTimer = playdate.frameTimer - --- In lua, variables are global by default, but having a "Global" object to put --- variables into is useful for maintaining sanity if you're coming from an OOP language. --- It's included here for basically no reason at all. Noble Engine doesn't use it. (◔◡◔) -Global = {} - --- It all fits inside this table, oooo! -Noble = {} - --- Third-party libraries -import 'libraries/noble/libraries/Signal' -import 'libraries/noble/libraries/Sequence' - --- Noble libraries, modules, and classes. -import 'libraries/noble/utilities/Utilities.lua' -import 'libraries/noble/utilities/Ease.lua' -- Extensions to the Ease library -import 'libraries/noble/modules/Noble.Animation.lua' -import 'libraries/noble/modules/Noble.Bonk.lua' -import 'libraries/noble/modules/Noble.GameData.lua' -import 'libraries/noble/modules/Noble.Input.lua' -import 'libraries/noble/modules/Noble.Settings.lua' -import 'libraries/noble/modules/Noble.Transition.lua' -import 'libraries/noble/modules/Noble.Text.lua' -import 'libraries/noble/modules/Noble.Menu.lua' -import 'libraries/noble/modules/NobleScene.lua' -import 'libraries/noble/modules/NobleSprite.lua' - -local isTransitioning = false -local currentScene = nil -local engineInitialized = false - --- configuration --- - -local defaultConfiguration = { - defaultTransition = Noble.Transition.DipToBlack, - defaultTransitionDuration = 1.5, - defaultTransitionHoldTime = 0.25, - transitionDurationIncludesHoldTime = true, - enableDebugBonkChecking = false, - alwaysRedraw = true, -} -local configuration = Utilities.copy(defaultConfiguration) - ---- Engine initialization. Run this once in your main.lua file to begin your game. --- @tparam NobleScene StartingScene This is the scene your game begins with, such as a title screen, loading screen, splash screen, etc. **NOTE: Pass the scene's class name, not an instance of the scene.** --- @number[opt=0] __launcherTransitionDuration If you want to transition from the final frame of your launch image sequence, enter a duration in seconds here. --- @tparam[opt=Noble.Transition.DipToBlack] Noble.Transition __launcherTransition If a transition duration is set, use this transition type. --- @tparam[opt={}] table __launcherTransitionProperties Provide a table of properties to apply to the launcher transition. See the documentation for the transition you're using for a list of available properties. --- @tparam[opt={}] table __configuration Provide a table of Noble Engine configuration values. This will run `Noble.setConfig` for you at launch. --- @usage --- Noble.new( --- TitleScreen, --- 2, --- Noble.Transition.DipToWhite, --- { --- holdTime = 0, --- ease = Ease.outInQuad --- }, --- { --- defaultTransition = Noble.Transition.Imagetable, --- defaultTransitionDuration = 1.75, --- enableDebugBonkChecking = true, --- } --- ) --- @see NobleScene --- @see Noble.Transition --- @see setConfig -function Noble.new(StartingScene, __launcherTransitionDuration, __launcherTransition, __launcherTransitionProperties, __configuration) - - math.randomseed(playdate.getSecondsSinceEpoch()) -- Set a new random seed at runtime. - - if (engineInitialized) then - error("BONK: You can only run Noble.new() once.") - return - end - - -- If the user supplies a config object, we use it, otherwise, we set default values. - if (__configuration ~= nil) then - Noble.setConfig(__configuration) - else - Noble.resetConfig() - end - - -- Screen drawing: see the Playdate SDK for details on these methods. - Graphics.sprite.setBackgroundDrawingCallback( - function (x, y, width, height) - if (currentScene ~= nil) then - -- Each scene has its own method for this. We only want to run one at a time. - currentScene:drawBackground(x, y, width, height) - else - Graphics.clear(Graphics.kColorBlack) - end - end - ) - -- Override this Playdate method that we've used already and don't want to be used again! - Graphics.sprite.setBackgroundDrawingCallback = function(callback) - error("BONK: Don't call Graphics.sprite.setBackgroundDrawingCallback() directly. Put background drawing code in your scenes' drawBackground() methods instead.") - end - - -- These values are used if not set. - local launcherTransition = __launcherTransition or defaultConfiguration.defaultTransition - local launcherTransitionDuration = __launcherTransitionDuration or 1.5 - local launcherTransitionProperties =__launcherTransitionProperties or {} - - -- Now that everything is set, let's-a go! - engineInitialized = true - Noble.transition(StartingScene, launcherTransitionDuration, launcherTransition, launcherTransitionProperties) -end - ---- This checks to see if `Noble.new` has been run. It is used internally to ward off bonks. --- @treturn bool --- @see Noble.Bonk -function Noble.engineInitialized() - return engineInitialized -end - ---- Miscellaneous Noble Engine configuration options / default values. --- This table cannot be edited directly. Use `Noble.getConfig` and `Noble.setConfig`. --- @table configuration --- @tparam[opt=Noble.Transition.DipToBlack] Noble.Transition defaultTransition When running `Noble.transition` if the transition is unspecified, it will use this one. --- @number[opt=1.5] defaultTransitionDuration When running `Noble.transition` if the scene transition duration is unspecified, it will take this long in seconds. --- @bool[opt=false] enableDebugBonkChecking Noble Engine-specific errors are called "Bonks." You can set this to true during development in order to check for more of them. However, it uses resources, so you will probably want to turn it off before release. --- @bool[opt=true] alwaysRedraw This sets the Playdate SDK method `playdate.graphics.sprite.setAlwaysRedraw`. See the Playdate SDK for details on how this function works, and the reasons you might want to set it as true or false for your project. --- @see Noble.getConfig --- @see Noble.setConfig --- @see Noble.Bonk.startCheckingDebugBonks - ---- Retrieve miscellaneous Noble Engine configuration options / default values --- @return A table of all configuration values --- @see configuration --- @see setConfig -function Noble.getConfig() - return configuration -end - ---- Optionally customize miscellaneous Noble Engine configuration options / default values. You may run this method to change these values during runtime. --- @tparam table __configuration This is a table with your configuration values in it. --- @see configuration --- @see getConfig -function Noble.setConfig(__configuration) - - if (__configuration == nil) then - error("BONK: You cannot pass a nil value to Noble.setConfig(). If you want to reset to default values, use Noble.resetConfig().") - end - - if (__configuration.defaultTransition ~= nil) then configuration.defaultTransition = __configuration.defaultTransition end - if (__configuration.defaultTransitionDuration ~= nil) then configuration.defaultTransitionDuration = __configuration.defaultTransitionDuration end - if (__configuration.defaultTransitionHoldTime ~= nil) then configuration.defaultTransitionHoldTime = __configuration.defaultTransitionHoldTime end - if (__transitionDurationIncludesHoldTime ~= nil) then configuration.transitionDurationIncludesHoldTime = __configuration.transitionDurationIncludesHoldTime end - - if (__configuration.enableDebugBonkChecking ~= nil) then - configuration.enableDebugBonkChecking = __configuration.enableDebugBonkChecking - if (configuration.enableDebugBonkChecking == true) then Noble.Bonk.enableDebugBonkChecking() end - end - - if (__configuration.alwaysRedraw ~= nil) then - configuration.alwaysRedraw = __configuration.alwaysRedraw - Graphics.sprite.setAlwaysRedraw(configuration.alwaysRedraw) - end - -end - ---- Reset miscellaneous Noble Engine configuration values to their defaults. --- @see getConfig --- @see setConfig -function Noble.resetConfig() - Noble.setConfig(Utilities.copy(defaultConfiguration)) -end - --- Transition stuff --- -local currentTransition = nil -local queuedScene = nil - ---- Transition to a new scene (at the end of this frame). ---- This method will create a new scene, mark the previous one for garbage collection, and animate between them. ---- Additional calls to this method within the same frame (before the already-called transition begins), will override previous calls. Any calls to this method once a transition begins will be ignored until the transition completes. --- @tparam NobleScene NewScene The scene to transition to. Pass the scene's class, not an instance of the scene. You always transition from `Noble.currentScene` --- @number[opt=1.5] __duration The length of the transition, in seconds. --- @tparam[opt=Noble.TransitionType.DIP_TO_BLACK] Noble.Transition __transition If a transition duration is set, use this transition type. If not set, it will use the value of `configuration.defaultTransition`. --- @tparam[opt={}] table __transitionProperties A table consisting of properties for this transition. Properties not set here will use values that transition's `defaultProperties` table. --- @usage --- Noble.transition(Level2, 1, Noble.Transition.CrossDissolve, { --- dither = Graphics.image.kDitherTypeDiagonalLine --- ease = Ease.outQuint --- }) --- -- --- Noble.transition(Level2, 1, Noble.Transition.DipToBlack, { --- holdTime = 0.5, --- ease = Ease.outInElastic --- }) --- -- --- Noble.transition(Level2, 1, Noble.Transition.SlideOff, { --- x = 400, --- y = 150 --- rotation = 45 --- }) --- @see Noble.isTransitioning --- @see NobleScene --- @see Noble.Transition --- @see Noble.Transition.defaultProperties -function Noble.transition(NewScene, __duration, __transition, __transitionProperties) - if (isTransitioning) then - -- This bonk no longer throws an error (compared to previous versions of Noble Engine), but maybe it still should? - warn("BONK: You can't start a transition in the middle of another transition, silly!") - return -- Let's get otta here! - elseif (queuedScene ~= nil) then - -- Calling this method multiple times between Noble.update() calls is probably not intentional behavior. - warn("Soft-BONK: You are calling Noble.transition() multiple times within the same frame. Did you mean to do that?") - -- We don't return here because maybe the developer *did* intend to override a previous call to Noble.transition(). - end - - queuedScene = NewScene() -- Creates new scene object. Its init() function runs now. - - currentTransition = (__transition or configuration.defaultTransition)( - __duration or configuration.defaultTransitionDuration, - __transitionProperties or {} - ) -end - - --- These methods are triggered during an transition - -function Noble.transitionStartHandler() - isTransitioning = true - if (currentScene ~= nil) then - currentScene:exit() -- The current scene runs its "goodbye" code. Sprites are taken out of the simulation. - end - Noble.Input.setHandler(nil) -- Disable user input. -end - -function Noble.transitionMidpointHandler() - if (currentScene ~= nil) then - currentScene:finish() - currentScene = nil -- Allows current scene to be garbage collected. - end - currentScene = queuedScene -- New scene's update loop begins. - queuedScene = nil - currentScene:enter() -- The new scene runs its "hello" code. -end - -function Noble.transitionCompleteHandler() - isTransitioning = false -- Reset - currentTransition = nil -- Clear the transition variable. - currentScene:start() -- The new scene is now active. -end - ---- Get the current scene object --- @treturn NobleScene -function Noble.currentScene() - return currentScene -end - ---- Get the name of the current scene --- @treturn string -function Noble.currentSceneName() - return currentScene.name -end - ---- Check to see if the game is transitioning between scenes. --- Useful to control game logic that lives outside of a scene's `update()` method. --- @treturn bool -function Noble.isTransitioning() - return isTransitioning -end - ---- Show/hide the Playdate SDK's FPS counter. --- @field bool -Noble.showFPS = false; - -local crankIndicatorActive = false -local crankIndicatorForced = false - -local transitionCanvas = Graphics.image.new(400, 240) - --- Game loop --- -function playdate.update() - Noble.Input.update() -- Check for Noble Engine-specific input methods. - - Sequence.update() -- Update all animations that use the Sequence library. - - -- Here we check to see if a transition currently in progress needs screenshots of the new scene. - -- If so, we route drawing for this frame into a new context. - if (isTransitioning and currentTransition._captureScreenshotsDuringTransition) then - currentTransition.newSceneScreenshot = Graphics.image.new(400, 240) - Graphics.pushContext(currentTransition.newSceneScreenshot) - end - - Graphics.sprite.update() -- Let's draw our sprites (and backgrounds). - - if (currentScene ~= nil) then - currentScene:update() -- Scene-specific update code. - end - - if (isTransitioning) then - if (currentTransition._captureScreenshotsDuringTransition) then - Graphics.popContext() - end - transitionCanvas:clear(Graphics.kColorClear) - - Graphics.pushContext(transitionCanvas) - currentTransition:draw() - Graphics.popContext() - - Graphics.setImageDrawMode(currentTransition.drawMode) - transitionCanvas:drawIgnoringOffset(0, 0) - Graphics.setImageDrawMode(Graphics.kDrawModeCopy) - end - - -- We want to draw the crank indicator and FPS display last - crankIndicatorActive, crankIndicatorForced = Noble.Input.getCrankIndicatorStatus() - if (crankIndicatorActive) then - if (playdate.isCrankDocked() or crankIndicatorForced) then - UI.crankIndicator:update() -- Draw crank indicator (if requested). - end - end - if (Noble.showFPS) then - playdate.drawFPS(4, 4) - end - - Timer.updateTimers() -- Finally, update all SDK timers. - FrameTimer.updateTimers() -- Update all frame timers - - if (Noble.Bonk.checkingDebugBonks()) then -- Checks for code that breaks the engine. - Noble.Bonk.checkDebugBonks() - end - - -- Once this frame is complete, we can check to see if it's time to start transitioning to a new scene. - if (not isTransitioning and currentTransition ~= nil) then - currentTransition:execute() - end -end - -function playdate.gameWillPause() - if (currentScene ~= nil) then - currentScene:pause() - end -end - -function playdate.gameWillResume() - if (currentScene ~= nil) then - currentScene:resume() - end -end diff --git a/source/libraries/noble/README.gif b/source/libraries/noble/README.gif deleted file mode 100644 index 6d9e747..0000000 Binary files a/source/libraries/noble/README.gif and /dev/null differ diff --git a/source/libraries/noble/README.md b/source/libraries/noble/README.md deleted file mode 100644 index 252699f..0000000 --- a/source/libraries/noble/README.md +++ /dev/null @@ -1,66 +0,0 @@ -Noble Engine -============ -### A li'l game engine for Playdate. - -![](README.gif) - -The Playdate SDK is probably the most user-friendly console SDK ever made, but if you're familiar with state/scene-based game engine frameworks like Unity, Flixel, Citrus, or others, you may be looking for a library that can get your game "on its feet,” extend existing APIs, offer new features, or provide more intuative ways to leverage the SDK in your game. - -If so, you're looking for Noble Engine! - -Features --------- -- Complete scene lifecycle management. Handle update loops, sprites, input, and initialization steps on a per scene basis. -- Scene transition API and animation library with over a dozen transition types (cross dissolve, dip-to-black, and more). -- Settings/SaveGame API, supporting up to 1000 save slots and automatic updating of on disk files when you inevitably muck around with your data structure in development. -- Boilerplate menu object, with simple way to add/remove items and manage “click” handlers. -- Additional input methods, and per-scene \`inputHandler\` logic. -- Full state manager for sprite animations. -- New fonts! Including full Japanese katakana character set. -- Fully documented code, explaining methods and architecture, and LDoc-generated [documentation pages](https://noblerobot.github.io/NobleEngine). -- Full project template, with example scenes and launcher assets, to help beginners get started with Playdate development. -- Random goodies, like a unified text drawing method for normal/aligned/localized text, one-line methods for showing/hiding the crank indicator and the FPS counter, and more. - -Setup ------ - -### Via Template -The recommended setup procedure is to clone the [Noble Engine Project Template repository](https://github.com/NobleRobot/NobleEngine-ProjectTemplate) instead of this one. That project is available as a [GitHub Template](https://github.blog/2019-06-06-generate-new-repositories-with-repository-templates/), which you can use to start your own project if you're hosting it on GitHub, or you can clone or download it manually. - -The template repository includes this one as a [git submodule](https://www.atlassian.com/git/tutorials/git-submodule). This way, you can mange your use of Noble Engine independently from your own code. - -The project template also includes some usage examples to help you get up to speed on how Noble Engine works. - -### Manual setup -If, instead, you want to download or clone this repository directly in to a new or existing project, simply place it into `libraries/noble/` relative to your `main.lua` file. - -Once you’ve done that, using Noble Engine can be quickly wired up in your `main.lua` file: - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -import libraries/noble/Noble -import scenes/MyStartingScene -- Or whatever your game's first scene is. - -Noble.new(MyStartingScene) -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -**Note:** If you are adding Noble Engine to an existing project, it is still recommended to either start with the project template and bring your existing code in, or reorganize your project to mimic the structure of the template. The project template defines a folder layout and has some additional flotsam that reflects the “opinion” of Noble Engine, which is useful if you want to have the best experience using it. - -Documentation -------------- -Noble Engine is fully documented in code, and has a full set of html pages generated with [LDoc](https://github.com/lunarmodules/LDoc) and styled for legibility, ease-of-use, and playful charm if I do say so myself. - -These pages are included in the repository at `docs/index.html` and on [GitHub Pages](https://noblerobot.github.io/NobleEngine). - -Notes on Style --------------- -Noble Engine was originally developed for _Widget Satchel II: Return of Sprocket_, by Mark LaCroix, who never wrote a line of Lua in his life before starting this project. - -In general, Lua best-practices are followed, but in some cases code style and naming conventions are more likely to follow those found in “C-like” languages such as Haxe, C\#, Java, ActionScript, etc. - -- Methods and variables are **camelCase**. -- “Class” names are **TitleCase**, and Lua “modules” are treated as nested classes, thus `Noble.Text` instead of `noble.text`. -- Constants, such as `Noble.TransitionType.DIP_TO_BLACK`, are **ALL_CAPS_SNAKE_CASE** -- Argument names are prefixed with a **double-underscore**, as in `__displayName`. This mostly impacts documentation legibility. I’m very sorry but it couldn’t be helped. 😆 -- Names are verbose by default; no abbreviations. This includes aliases for Playdate packages, so `playdate.graphics` is aliased as `Graphics`, instead of `gfx`. - -Some of these conventions run counter to those seen in the Playdate SDK. In places where there’s a potential conflict, either an alias is created for Noble Engine’s version to match the engine’s code style, or the Playdate SDK item is given preference and Noble Engine stays out of its way. diff --git a/source/libraries/noble/assets/fonts/NobleSans-table-8-9.png b/source/libraries/noble/assets/fonts/NobleSans-table-8-9.png deleted file mode 100644 index 9ce7df9..0000000 Binary files a/source/libraries/noble/assets/fonts/NobleSans-table-8-9.png and /dev/null differ diff --git a/source/libraries/noble/assets/fonts/NobleSans.fnt b/source/libraries/noble/assets/fonts/NobleSans.fnt deleted file mode 100644 index c621ee9..0000000 --- a/source/libraries/noble/assets/fonts/NobleSans.fnt +++ /dev/null @@ -1,296 +0,0 @@ -tracking=1 - -space 2 -A 7 -B 6 -C 6 -D 6 -E 5 -F 5 -G 6 -H 6 -I 3 -J 6 -K 6 -L 5 -M 7 -N 7 -O 7 -P 6 -Q 7 -R 6 -S 6 -T 5 -U 6 -V 6 -W 8 -X 7 -Y 7 -Z 7 -. 3 -: 4 -0 6 -1 6 -2 6 -3 6 -4 6 -5 6 -6 6 -7 6 -8 6 -9 6 -- 6 -! 4 -" 5 -% 7 -' 2 -( 5 -) 5 -+ 8 -, 3 -? 4 -/ 5 -< 5 -> 5 -[ 3 -\ 5 -] 3 -{ 5 -} 5 -_ 6 -~ 7 -= 7 -* 8 -ラ 6 -リ 6 -ル 8 -レ 5 -ロ 7 -ヮ 6 -ワ 6 -ョ 6 -ヨ 6 -゠ 6 -ァ 7 -ア 7 -ィ 6 -イ 6 -ニ 7 -ユ 7 -ゥ 6 -ウ 6 -ェ 6 -エ 6 -ォ 6 -オ 6 -カ 6 -ガ 7 -キ 6 -ギ 6 -ク 6 -グ 6 -ケ 7 -ゲ 6 -コ 6 -ゴ 6 -サ 6 -ザ 6 -シ 7 -ジ 7 -ス 6 -ズ 6 -セ 7 -ゼ 7 -ソ 6 -ゾ 6 -ツ 6 -ヅ 6 -ッ 6 -タ 6 -ダ 6 -チ 6 -ヂ 6 -テ 6 -デ 6 -ナ 6 -ト 6 -ド 6 -・ 6 -ー 7 -ノ 5 -ヌ 6 -ネ 6 -マ 6 -ハ 7 -バ 7 -パ 7 -ヒ 6 -ビ 6 -ピ 6 -フ 6 -ブ 6 -プ 6 -ヘ 7 -ベ 7 -ペ 7 -ホ 7 -ボ 7 -ポ 7 -ミ 6 -ム 6 -メ 6 -モ 6 -ャ 7 -ヤ 7 -ュ 7 -ヱ 7 -ヲ 6 -ン 7 -ヰ 7 -ヴ 6 -ヵ 6 -ヶ 6 -ヷ 6 -ヸ 7 -ヹ 7 -ヺ 6 -ヽ 5 -ヾ 5 -ヿ 5 -「 6 -」 6 -。 7 -、 7 -ぁ 6 -あ 7 -ぃ 6 -い 7 -ぅ 5 -う 6 -え 6 -ぇ 5 -お 7 -ぉ 7 -か 7 -が 7 -き 6 -ぎ 7 -く 6 -ぐ 6 -げ 7 -け 7 -こ 7 -ご 7 -さ 6 -ざ 7 -じ 6 -し 6 -す 7 -ず 7 -せ 7 -ぜ 7 -そ 5 -ぞ 6 -た 7 -だ 7 -ち 6 -ぢ 7 -つ 7 -づ 7 -っ 7 -て 7 -で 7 -と 7 -ど 7 -に 7 -な 7 -ぬ 7 -ね 7 -の 7 -は 8 -ば 8 -ぱ 8 -ひ 8 -び 8 -ぴ 8 -ふ 8 -ぶ 8 -ぷ 8 -へ 7 -べ 7 -ぺ 7 -ほ 8 -ぼ 8 -ぽ 8 -ま 6 -み 7 -む 8 -め 7 -も 6 -ゃ 6 -や 7 -ゅ 7 -ゆ 8 -ょ 6 -よ 6 -ら 6 -り 6 -る 7 -ろ 7 -円 8 -れ 8 -ゎ 7 -わ 8 -ゐ 7 -ゑ 7 -を 7 -ん 7 -ゔ 7 -ゕ 7 -ゖ 6 -ゝ 5 -ゞ 5 -゛ 6 -゜ 6 -ゟ 6 -a 6 -b 6 -c 6 -d 6 -e 6 -f 5 -g 6 -h 6 -i 3 -j 5 -k 6 -l 3 -m 7 -n 6 -o 6 -p 6 -q 6 -r 5 -s 6 -t 5 -u 6 -v 6 -w 8 -| 4 -x 6 -y 6 -` 3 -z 6 -# 7 -$ 6 -& 8 -™ 8 -© 6 -® 6 -‼ 6 -� 8 -… 8 -@ 8 -; 4 -^ 7 -¥ 8 \ No newline at end of file diff --git a/source/libraries/noble/assets/fonts/SatchelRoughed-table-17-14.png b/source/libraries/noble/assets/fonts/SatchelRoughed-table-17-14.png deleted file mode 100644 index df0fe54..0000000 Binary files a/source/libraries/noble/assets/fonts/SatchelRoughed-table-17-14.png and /dev/null differ diff --git a/source/libraries/noble/assets/fonts/SatchelRoughed.fnt b/source/libraries/noble/assets/fonts/SatchelRoughed.fnt deleted file mode 100644 index 6f284fc..0000000 --- a/source/libraries/noble/assets/fonts/SatchelRoughed.fnt +++ /dev/null @@ -1,97 +0,0 @@ -tracking=1 - -space 6 -! 9 -" 8 -# 14 -$ 11 -% 17 -& 13 -' 4 -( 8 -) 8 -* 9 -+ 11 -, 5 -- 9 -. 5 -/ 11 -0 11 -1 9 -2 11 -3 11 -4 12 -5 11 -6 11 -7 12 -8 11 -9 11 -: 5 -; 5 -< 10 -= 11 -> 10 -? 10 -@ 14 -A 13 -B 11 -C 13 -D 13 -E 11 -F 11 -G 13 -H 11 -I 5 -J 11 -K 13 -L 10 -M 16 -N 13 -O 14 -P 11 -Q 14 -R 12 -S 11 -T 11 -U 12 -V 13 -W 17 -X 12 -Y 11 -Z 12 -[ 9 -\ 12 -] 9 -^ 10 -_ 15 -` 8 -a 13 -b 11 -c 13 -d 13 -e 11 -f 11 -g 13 -h 11 -i 5 -j 11 -k 13 -l 10 -m 16 -n 13 -o 14 -p 11 -q 14 -r 12 -s 11 -t 11 -u 12 -v 13 -w 17 -x 12 -y 11 -z 12 -{ 9 -| 6 -} 8 -¥ 12 \ No newline at end of file diff --git a/source/libraries/noble/assets/images/BoltTransitionEnter-table-400-240.png b/source/libraries/noble/assets/images/BoltTransitionEnter-table-400-240.png deleted file mode 100644 index ae3ef78..0000000 Binary files a/source/libraries/noble/assets/images/BoltTransitionEnter-table-400-240.png and /dev/null differ diff --git a/source/libraries/noble/assets/images/BoltTransitionExit-table-400-240.png b/source/libraries/noble/assets/images/BoltTransitionExit-table-400-240.png deleted file mode 100644 index 7e09f44..0000000 Binary files a/source/libraries/noble/assets/images/BoltTransitionExit-table-400-240.png and /dev/null differ diff --git a/source/libraries/noble/assets/images/ImagetableTransition-table-400-240.png b/source/libraries/noble/assets/images/ImagetableTransition-table-400-240.png deleted file mode 100644 index 5b69ce5..0000000 Binary files a/source/libraries/noble/assets/images/ImagetableTransition-table-400-240.png and /dev/null differ diff --git a/source/libraries/noble/assets/images/NobleRobotLogo.png b/source/libraries/noble/assets/images/NobleRobotLogo.png deleted file mode 100644 index c117ae4..0000000 Binary files a/source/libraries/noble/assets/images/NobleRobotLogo.png and /dev/null differ diff --git a/source/libraries/noble/libraries/Sequence.lua b/source/libraries/noble/libraries/Sequence.lua deleted file mode 100644 index 8b844f2..0000000 --- a/source/libraries/noble/libraries/Sequence.lua +++ /dev/null @@ -1,489 +0,0 @@ --- --- Sequence library by Nic Magnier --- - ---[[ -class to create simple animations using easing as building blocks - -To create a simple sequence: - animation = sequence.new():from(0):to(1,2.0,"outQuad"):mirror() - -In your game loop - sequence.update() - currentValue = animation:get() - -Add hooks or callback - animation = sequence.new():from(0):to(1,2.0,"outQuad"):callback(function() print("end animation") end):mirror() -]]-- -import 'CoreLibs/easing' - -Sequence = {} -Sequence.__index = Sequence - --- private member -local _easings = playdate.easingFunctions -if not _easings then - print("Sequence warning: easing function not found. Don't forget to call import 'CoreLibs/easing'") - return -end - -local _runningSequences = table.create(32,0) -local _previousUpdateTime = playdate.getCurrentTimeMilliseconds() - --- This can be useful when you want your Sequence to continue in realtime --- when using playdate.stop() / .wait(milliseconds) / .start(). --- --- If you don't set __currentTime, it defaults to playdate.getCurrentTimeMilliseconds() --- Examples: --- Use Sequence.setPreviousUpdateTime() before you call playdate.start(). --- Use Sequence.setPreviousUpdateTime(playdate.getCurrentTimeMilliseconds() + milliseconds) --- before using playdate.wait(milliseconds). -function Sequence.setPreviousUpdateTime(currentTime) - if (currentTime == nil) then - currentTime = playdate.getCurrentTimeMilliseconds() - end - - _previousUpdateTime = currentTime -end - --- create a new sequence - -function Sequence.new() - local new_sequence = { - -- runtime values - time = 0, - cachedResultTimestamp = nil, - cachedResult = 0, - previousUpdateEasingIndex = nil, - isRunning = false, - - duration = 0, - loopType = false, - easings = table.create(4, 0), - easingCount = 0, - callbacks = nil, - } - - return setmetatable(new_sequence, Sequence) -end - --- put a low pacing to slow down all animations, great for tweaking -function Sequence.update( pacing ) - pacing = pacing or 1 - - local currentTime = playdate.getCurrentTimeMilliseconds() - local deltaTime = ((currentTime-_previousUpdateTime) / 1000) * pacing - _previousUpdateTime = currentTime - - for index = #_runningSequences, 1, -1 do - local seq = _runningSequences[index] - - seq:updateCallbacks( deltaTime ) - - seq.time = seq.time + deltaTime - seq.cachedResultTimestamp = nil - - if seq:isDone() then - table.remove(_runningSequences, index) - seq.isRunning = false - end - end -end - -function Sequence.print() - print("Sequences running:", #_runningSequences) -for index, seq in pairs(_runningSequences) do - print(" Sequence", index, seq) - end -end - -function Sequence:clear() - self:stop() - self.time = 0 - self.duration = 0 - self.loopType = false - self.easingCount = 0 - self.cachedResultTimestamp = nil - self.cachedResult = 0 - self.previousUpdateEasingIndex = nil - self.callbacks = {} -end - --- Reinitialize the sequence -function Sequence:from( from ) - from = from or 0 - - -- release all easings - self:clear() - - -- setup first empty easing at the beginning of the sequence - local newEasing = self:newEasing() - newEasing.timestamp = 0 - newEasing.from = from - newEasing.to = from - newEasing.duration = 0 - newEasing.fn = _easings.flat - - return self -end - -function Sequence:to( to, duration, easingFunction, ... ) - if not self then return end - - -- default parameters - to = to or 0 - duration = duration or 0.3 - easingFunction = easingFunction or _easings.inOutQuad - if type(easingFunction)=="string" then - easingFunction = _easings[easingFunction] or _easings.inOutQuad - end - - local lastEasing = self.easings[self.easingCount] - local newEasing = self:newEasing() - - -- setup first empty easing at the beginning of the sequence - newEasing.timestamp = lastEasing.timestamp + lastEasing.duration - newEasing.from = lastEasing.to - newEasing.to = to - newEasing.duration = duration - newEasing.fn = easingFunction - newEasing.params = {...} - - -- update overall sequence infos - self.duration = self.duration + duration - - return self -end - -function Sequence:set( value ) - if not self then return end - - local lastEasing = self.easings[self.easingCount] - local newEasing = self:newEasing() - - -- setup first empty easing at the beginning of the sequence - newEasing.timestamp = lastEasing.timestamp + lastEasing.duration - newEasing.from = value - newEasing.to = value - newEasing.duration = 0 - newEasing.fn = _easings.flat - - return self -end - --- @repeatCount: number of times the last easing as to be duplicated --- @mirror: bool, does the repeating easings have to be mirrored (yoyo effect) -function Sequence:again( repeatCount, mirror ) - if not self then return end - - repeatCount = repeatCount or 1 - - local previousEasing = self.easings[self.easingCount] - - for i = 1, repeatCount do - local newEasing = self:newEasing() - - -- setup first empty easing at the beginning of the sequence - newEasing.timestamp = previousEasing.timestamp + previousEasing.duration - newEasing.duration = previousEasing.duration - newEasing.fn = previousEasing.fn - newEasing.params = previousEasing.params - - if mirror then - newEasing.from = previousEasing.to - newEasing.to = previousEasing.from - else - newEasing.from = previousEasing.from - newEasing.to = previousEasing.to - end - - -- update overall sequence infos - self.duration = self.duration + newEasing.duration - - previousEasing = newEasing - end - - return self -end - -function Sequence:sleep( duration ) - if not self then return end - - duration = duration or 0.5 - if duration==0 then - return self - end - - local lastEasing = self.easings[self.easingCount] - local new_easing = self:newEasing() - - -- setup first empty easing at the beginning of the sequence - new_easing.timestamp = lastEasing.timestamp + lastEasing.duration - new_easing.from = lastEasing.to - new_easing.to = lastEasing.to - new_easing.duration = duration - new_easing.fn = _easings.flat - - -- update overall sequence infos - self.duration = self.duration + duration - - return self -end - -function Sequence:callback( fn, timeOffset ) - if not self then return end - - timeOffset = timeOffset or 0 - - local lastEasing = self.easings[self.easingCount] - - local cb = self:newCallback() - cb.timestamp = lastEasing.timestamp + lastEasing.duration + timeOffset - cb.fn = fn - - return self -end - -function Sequence:loop() - self.loopType = "loop" - return self -end - -function Sequence:mirror() - self.loopType = "mirror" - return self -end - -function Sequence:newEasing() - self.easingCount = self.easingCount + 1 - return self:getEasingByIndex(self.easingCount) -end - -function Sequence:newCallback() - local newCallback = { - fn = nil, - timestamp = nil, - } - table.insert( self.callbacks, newCallback) - return newCallback -end - -function Sequence:getEasingByIndex( index ) - - local easing = self.easings[index] - if type(easing)=="table" then - easing.params = nil - easing.callback = nil - return easing - end - - local new_easing = { - timestamp = 0, - from = 0, - to = 0, - duration = 0, - params = nil, - fn = _easings.flat - } - - self.easings[index] = new_easing - - return new_easing -end - -function Sequence:getEasingByTime( clampedTime ) - if self:isEmpty() then - print("Sequence warning: empty animation") - return nil - end - - local easingIndex = self.previousUpdateEasingIndex or 1 - - while easingIndex>=1 and easingIndex<=self.easingCount do - local easing = self.easings[easingIndex] - - if clampedTime < easing.timestamp then - easingIndex = easingIndex - 1 - elseif clampedTime > (easing.timestamp+easing.duration) then - easingIndex = easingIndex + 1 - else - self.previousUpdateEasingIndex = easingIndex - return easing, easingIndex - end - end - - -- we didn't the correct part - print("Sequence warning: couldn't find sequence part. clampedTime probably out of bound.", clampedTime, self.duration) - return self.easings[1] -end - -function Sequence:get( time ) - if not self then return nil end - - if self:isEmpty() then - return 0 - end - - time = time or self.time - - -- try to get cached result - if self.cachedResultTimestamp==time then - return self.cachedResult - end - - -- we calculate and cache the result - local clampedTime = self:getClampedTime(time) - local easing = self:getEasingByTime(clampedTime) - local result = easing.fn(clampedTime-easing.timestamp, easing.from, easing.to-easing.from, easing.duration, table.unpack(easing.params or {})) - - -- cache - self.cachedResultTimestamp = clampedTime - self.cachedResult = result - - return result -end - -function Sequence:updateCallbacks( dt ) - if #self.callbacks==0 then - return - end - - local callTimeRange = function( clampedStart, clampedEnd) - if clampedStart>clampedEnd then - clampedStart, clampedEnd = clampedEnd, clampedStart - end - - for index, cbObject in pairs(self.callbacks) do - if cbObject.timestamp>=clampedStart and cbObject.timestamp<=clampedEnd then - if type(cbObject.fn)=="function" then - cbObject.fn() - end - end - end - end - - -- most straightforward case: no loop - if not self.loopType then - local clampedTime = self:getClampedTime( self.time ) - callTimeRange(clampedTime, clampedTime+dt) - return - end - - -- - -- now we handle loops - - -- probably rare case but we have to handle it - if dt>self.duration then - callTimeRange(0, self.duration) - end - - local clampedTime, isForward = self:getClampedTime( self.time ) - local endTime = clampedTime - if isForward then - endTime = endTime + dt - else - endTime = endTime - dt - end - - if endTime<0 then - callTimeRange(0, math.max(clampedTime, self:getClampedTime( endTime ))) - elseif endTime>self.duration then - if self.loopType=="loop" then - callTimeRange(clampedTime, self.duration) - callTimeRange(0, self:getClampedTime( endTime )) - else - callTimeRange(math.min(clampedTime, self:getClampedTime( endTime )), self.duration) - end - else - callTimeRange(clampedTime, endTime) - end -end - --- get the time clamped in the sequence duration --- manage time using loop setting -function Sequence:getClampedTime( time ) - time = time or self.time - - local isForward = true - - -- time is looped - if self.loopType=="loop" then - return time%self.duration, isForward - - -- time is mirrored / yoyo - elseif self.loopType=="mirror" then - time = time%(self.duration*2) - if time>self.duration then - isForward = false - time = self.duration + self.duration - time - end - - return time, isForward - end - - -- time is normally clamped - return math.clamp(time, 0, self.duration), isForward -end - -function Sequence:addRunning() - if self:isEmpty() or self.isRunning then - return - end - - table.insert(_runningSequences, self) - self.isRunning = true -end - -function Sequence:removeRunning() - local indexInRunningTable = table.indexOfElement(_runningSequences, self) - if indexInRunningTable then - table.remove(_runningSequences, indexInRunningTable) - end - self.isRunning = false -end - -function Sequence:start() - self:addRunning() - return self -end - -function Sequence:stop() - self:removeRunning() - self.time = 0 - self.cachedResultTimestamp = nil - self.previousUpdateEasingIndex = nil - return self -end - -function Sequence:pause() - self:removeRunning() - return self -end - -function Sequence:restart() - self.time = 0 - self.cachedResultTimestamp = nil - self.previousUpdateEasingIndex = nil - self:start() - return self -end - -function Sequence:isDone() - return self.time>=self.duration and (not self.loopType) -end - -function Sequence:isEmpty() - return self.easingCount==0 -end - --- new easing function -function _easings.flat(t, b, c, d) - return b -end - -math.clamp = math.clamp or function(a, min, max) - if min > max then - min, max = max, min - end - return math.max(min, math.min(max, a)) -end \ No newline at end of file diff --git a/source/libraries/noble/libraries/Signal.lua b/source/libraries/noble/libraries/Signal.lua deleted file mode 100644 index fbadc5c..0000000 --- a/source/libraries/noble/libraries/Signal.lua +++ /dev/null @@ -1,47 +0,0 @@ --- --- Signal library by Dustin Mierau --- - -import "CoreLibs/object" - -class("Signal").extends() - -function Signal:init() - self.listeners = {} -end - -function Signal:add(key, bind, fn) - local t = self.listeners[key] - local v = {fn = fn, bind = bind} - if not t then - self.listeners[key] = {v} - else - t[#t + 1] = v - end -end - -function Signal:remove(key, fn) - local t = self.listeners[key] - if t then - for i, v in ipairs(t) do - if v.fn == fn then - table.remove(t, i) - break - end - end - if #t == 0 then - self.listeners[key] = nil - end - end -end - -function Signal:dispatch(key, ...) - local t = self.listeners[key] - if t then - for _, v in ipairs(t) do - v.fn(v.bind, key, ...) - end - end -end - -Signal = Signal() \ No newline at end of file diff --git a/source/libraries/noble/modules/Noble.Animation.lua b/source/libraries/noble/modules/Noble.Animation.lua deleted file mode 100644 index 02744ec..0000000 --- a/source/libraries/noble/modules/Noble.Animation.lua +++ /dev/null @@ -1,293 +0,0 @@ ---- Animation states using a spritesheet/imagetable. Ideal for use with `NobleSprite` objects. Suitable for other uses as well. --- @module Noble.Animation --- - -Noble.Animation = {} - ---- Setup --- @section setup - ---- Create a new animation "state machine". This function is called automatically when creating a new `NobleSprite`. --- @string __view This can be: the path to a spritesheet image file or an image table object (`Graphics.imagetable`). See Playdate SDK docs for imagetable file naming conventions. --- @return `animation`, a new animation object. --- @usage --- local myHero = MyHero("path/to/spritesheet") --- @usage --- -- When extending NobleSprite (recommended), you don't call Noble.Animation.new(), --- -- but you do feed its __view argument into MySprite.super.init()... --- MyHero = {} --- class("MyHero").extends(NobleSprite) --- --- function MyHero:init() --- MyHero.super.init(self, "assets/images/Hero") --- -- ... --- -- A new NobleSprite creates a Noble.Animation object named "self.animation" --- self.animation:addState("idle", 1, 30) --- self.animation:addState("jump", 31, 34, "float") --- self.animation:addState("float", 35, 45) --- self.animation:addState("turn", 46, 55, "idle") --- self.animation:addState("walk", 56, 65) --- -- ... --- end --- @usage --- local myAnimation = Noble.Animation.new("path/to/spritesheet") --- @usage --- -- When extending playdate.graphics.Sprite, Noble.Animation.new() must be called manually... --- MyHero = {} --- class("MyHero").extends(Graphics.sprite) --- --- function MyHero:init() --- MyHero.super.init(self) --- -- ... --- self.animation = Noble.Animation.new("assets/images/Hero") --- self.animation:addState("idle", 1, 30) --- self.animation:addState("jump", 31, 34, "float") --- self.animation:addState("float", 35, 45) --- self.animation:addState("turn", 46, 55, "idle") --- self.animation:addState("walk", 56, 65) --- -- ... --- end --- @see NobleSprite:init -function Noble.Animation.new(__view) - local animation = {} - - --- Properties - -- @section properties - - --- The currently set animation state. - -- - -- This is intended as `read-only`. You should not modify this property directly. - -- @see setState - animation.current = nil - - --- The name of the current animation state. Calling this instead of `animation.current.name` is just a little faster. - -- - -- This is intended as `read-only`. You should not modify this property directly. - animation.currentName = nil - - --- The current frame of the animation. This is the index of the imagetable, not the frame of the current state. - -- - -- Most of the time, you should not modify this directly, although you can if you're feeling saucy and are prepared for unpredictable results. - -- @see draw - animation.currentFrame = 1 - - --- This controls the flipping of the image when drawing. DIRECTION_RIGHT is unflipped, DIRECTION_LEFT is flipped on the X axis. - -- @usage - -- function MyHero:goLeft() - -- self.animation.direction = Noble.Animation.DIRECTION_LEFT - -- -- ... - -- end - animation.direction = Noble.Animation.DIRECTION_RIGHT - - --- This animation's spritesheet. You can replace this with another `playdate.graphics.imagetable` object, but generally you would not want to. - -- @see new - if (type(__view) == "userdata") then - animation.imageTable = __view - else - animation.imageTable = Graphics.imagetable.new(__view) - end - -- The current count of frame durations. This is used to determine when to advance to the next frame. - animation.frameDurationCount = 1 - -- The previous number of frame durations in the animation - animation.previousFrameDurationCount = 1 - - local empty = true - - --- Setup - -- @section setup - - --- Add an animation state. The first state added will be the default set for this animation. - -- - -- NOTE: Added states are first-degree member objects of your Noble.Animation object, so do not use names of already existing methods/properties ("current", "draw", etc.). - -- @string __name The name of the animation, this is also used as the key for the animation. - -- @int __startFrame This is the first frame of this animation in the imagetable/spritesheet - -- @int __endFrame This is the final frame of this animation in the imagetable/spritesheet - -- @string[optional] __next By default, animation states will loop, but if you want to sequence an animation, enter the name of the next state here. - -- @bool[opt=true] __loop If you want a state to "freeze" on its final frame, instead of looping, enter `false` here. - -- @param[optional] __onComplete This function will run when this animation is complete. Be careful when using this on a looping animation! - -- @int[opt=1] __frameDuration This is the number of ticks between each frame in this animation. If not specified, it will be set to 1. - -- @usage - -- -- You can reference an animation's state's properties using bog-standard lua syntax: - -- - -- animation.idle.startFrame -- 30 - -- animation.walk.endFrame -- 65 - -- animation.["walk"].endFrame -- 65 - -- animation.jump.name -- "jump" - -- animation.["jump"].next -- "float" - -- animation.idle.next -- nil - function animation:addState(__name, __startFrame, __endFrame, __next, __loop, __onComplete, __frameDuration) - local loop = true - local frameDuration = 1 - if (__loop ~= nil) then loop = __loop end - if (__frameDuration ~= nil) then frameDuration = __frameDuration end - self[__name] = { - name = __name, - startFrame = __startFrame, - endFrame = __endFrame, - next = __next, - loop = loop, - onComplete = __onComplete, - frameDuration = frameDuration, - } - - -- Set this animation state as default if it is the first one added. - if (empty == true) then - empty = false - self.currentFrame = __startFrame - self.current = self[__name] - self.currentName = __name - self.frameDuration = frameDuration - end - end - - --- Methods - -- @section methods - - --- Sets the current animation state. This can be run in a object's `update` method because it only changes the animation state if the new state is different from the current one. - -- @tparam string|Noble.Animation __animationState The name of the animation to set. You can pass the name of the state, or the object itself. - -- @bool[opt=false] __continuous Set to true if your new state's frames line up with the previous one's, i.e.: two walk cycles but one is wearing a cute hat! - -- @tparam string|Noble.Animation __unlessThisState If this state is the current state, do not set the new one. - -- @usage animation:setState("walk") - -- @usage animation:setState(animation.walk) - -- @usage - -- animation:setState(animation.walkNoHat) - -- -- - -- animation:setState(animation.walkYesHat, true) - -- @usage - -- function MyHero:update() - -- -- Input - -- -- ... - -- - -- -- Physics/collisions - -- -- ... - -- - -- -- Animation states - -- if (grounded) then - -- if (turning) then - -- self.animation:setState(self.animation.turn) - -- elseif (math.abs(self.velocity.x) > 15) then - -- self.animation:setState(self.animation.walk, false, self.animation.turn) - -- else - -- self.animation:setState(self.animation.idle, false, self.animation.turn) - -- end - -- else - -- self.animation:setState(self.animation.jump, false, self.animation.float) - -- end - -- - -- groundedLastFrame = grounded - -- end - function animation:setState(__animationState, __continuous, __unlessThisState) - if (__unlessThisState ~= nil) then - if (type(__unlessThisState) == "string") then - if (self.currentName == __unlessThisState) then return end - elseif (type(__unlessThisState) == "table") then - if (self.current == __unlessThisState) then return end - end - end - - local newState = nil - - if (type(__animationState) == "string") then - if (self.currentName == __animationState) then return end - newState = self[__animationState] - self.currentName = __animationState - elseif (type(__animationState) == "table") then - if (self.current == __animationState) then return end - newState = __animationState - self.currentName = __animationState.name - end - - local continuous = Utilities.handleOptionalBoolean(__continuous, false) - - if (continuous) then - local localFrame = self.currentFrame - self.current.startFrame - self.currentFrame = newState.startFrame + localFrame - else - self.currentFrame = newState.startFrame - end - - self.current = newState - end - - --- Draw the current frame. - -- - -- When attached to a NobleSprite, this is called by `NobleSprite:draw()` when added to a scene. For non-NobleSprite sprites, put this method inside your sprite's `draw()` method, or inside @{NobleScene:update|NobleScene:update}. - -- @number[opt=0] __x - -- @number[opt=0] __y - -- @bool[opt=true] __advance Advances to the next frame after drawing this one. Noble.Animation is frame-based, not "delta time"-based, so its speed is dependent on your game's framerate. - -- @usage - -- function MySprite:draw() - -- animation:draw() - -- end - -- @usage - -- function MyScene:update() - -- animation:draw(100,100) - -- end - function animation:draw(__x, __y, __advance) - --print(self.currentName .. " > " .. self.currentFrame .. " >> " .. tostring(self.current.loop)) - - if (__advance == nil) then __advance = true end - - if (self.currentFrame < self.current.startFrame or self.currentFrame > self.current.endFrame + 1) then - self.currentFrame = self.current.startFrame -- Error correction. - elseif (self.currentFrame == self.current.endFrame + 1) then -- End frame behavior. - if (self.current.next ~= nil) then - self.currentFrame = self.current.next.startFrame -- Set to first frame of next animation. - self.frameDurationCount = 1 -- Reset ticks. - self.previousFrameDurationCount = self.frameDuration - self:setState(self.current.next) -- Set next animation state. - elseif (self.current.loop == true) then - self.currentFrame = self.current - .startFrame -- Loop animation state. (TO-DO: account for continuous somehow?) - self.frameDurationCount = 1 -- Reset ticks. - self.previousFrameDurationCount = self.frameDuration - elseif (__advance) then - self.currentFrame = self.currentFrame - - 1 -- Undo advance frame because we want to draw the same frame again. - end - - if (self.current.onComplete ~= nil) then - self.current.onComplete() - end - end - - local x = __x or 0 - local y = __y or 0 - self.imageTable:drawImage(self.currentFrame, x, y, self.direction) - - if (__advance == true) then - self.frameDurationCount += 1 - if ((self.frameDurationCount - self.previousFrameDurationCount) >= self.current.frameDuration) then - self.currentFrame = self.currentFrame + 1 - self.previousFrameDurationCount += self.current.frameDuration - end - end - --previousAnimationName = self.currentName - end - - --- Sometimes, you just want to draw a specific frame. - -- Use this for objects or sprites that you want to control outside of update loops, such as score counters, flipbook-style objects that respond to player input, etc. - -- @int __frameNumber The frame to draw from the current state. This is not an imagetable index. Entering `1` will draw the selected state's `startFrame`. - -- @string[opt=self.currentName] __stateName The specific state to pull the __frameNumber from. - -- @number[opt=0] __x - -- @number[opt=0] __y - -- @param[opt=self.direction] __direction Override the current direction. - function animation:drawFrame(__frameNumber, __stateName, __x, __y, __direction) - local x = __x or 0 - local y = __y or 0 - local stateName = __stateName or self.currentName - local direction = __direction or self.direction - local frameNumber = self[stateName].startFrame - 1 + __frameNumber - self.imageTable:drawImage(frameNumber, x, y, direction) - end - - return animation -end - ---- Constants --- @section constants - ---- A re-contextualized instance of `playdate.graphics.kImageUnflipped` -Noble.Animation.DIRECTION_RIGHT = Graphics.kImageUnflipped ---- A re-contextualized instance of `playdate.graphics.kImageFlippedX` -Noble.Animation.DIRECTION_LEFT = Graphics.kImageFlippedX diff --git a/source/libraries/noble/modules/Noble.Bonk.lua b/source/libraries/noble/modules/Noble.Bonk.lua deleted file mode 100644 index ac0dc6f..0000000 --- a/source/libraries/noble/modules/Noble.Bonk.lua +++ /dev/null @@ -1,108 +0,0 @@ ---- Engine-specific error handling. --- Noble Engine overrides/supersedes some Playdate SDK behavior. A "bonk" is what happens when your game breaks the engine. --- --- Most bonks will throw during normal operation, but others ("debug bonks") introduce some execution overhead so are not --- checked by default. --- --- @module Noble.Bonk --- -Noble.Bonk = {} - -local bonksAreSetup = false - -local checkingForBonks = false - -local debugBonks = {} - --- You cannot run this directly. Run Noble.new() with __enableDebugBonkChecking as true to enable debug bonk checking. -function Noble.Bonk.enableDebugBonkChecking() - if (bonksAreSetup == false) then - if (Noble.engineInitialized() == false) then - debugBonks.update = playdate.update - debugBonks.pause = playdate.gameWillPause - debugBonks.resume = playdate.gameWillResume - debugBonks.crankDocked = playdate.crankDocked - debugBonks.crankUndocked = playdate.crankUndocked - bonksAreSetup = true - else - error("BONK-BONK: You cannot run this directly. Run Noble.new() with __enableDebugBonkChecking as true.") - end - else - print("BONK-BONK: You have already run Noble.new() with __enableDebugBonkChecking as true, you cannot run this directly.") - end -end - - ---- Begin checking for debug bonks, on every frame. This introduces needless overhead, so don't do it in a release build. --- You can only run this if you ran previously `Noble.new()` with `__enableDebugBonkChecking` as true, which you should also not do in a release build. - -- @see Noble.new -function Noble.Bonk.startCheckingDebugBonks() - if (checkingForBonks == false) then - if (bonksAreSetup) then - checkingForBonks = true - else - error("BONK-BONK: You cannot run this unless debug bonk checking is enabled.") - end - end -end - ---- Stop checking for debug bonks on every frame. --- --- NOTE: You can only run this if debug bonk checking is enabled. -function Noble.Bonk.stopCheckingDebugBonks() - if (checkingForBonks) then - if (bonksAreSetup) then - checkingForBonks = false - else - error("BONK-BONK: You cannot run this unless debug bonk checking is enabled.") - end - end -end - ---- Disable the ability to check for debug bonks. It frees up some memory. Once you disable debug bonk checking, you cannot re-enable it. --- --- NOTE: You can only run this if debug bonk checking is enabled. -function Noble.Bonk.disableDebugBonkChecking() - if (bonksAreSetup) then - debugBonks = {} - bonksAreSetup = false - else - error("BONK-BONK: You cannot run this unless debug bonk checking is enabled.") - end -end - ---- Are we debug bonk checking for debug bonks? --- @treturn bool -function Noble.Bonk.checkingDebugBonks() - return checkingForBonks -end - ---- Manually check for debug bonks. --- This method runs every frame when `checkingDebugBonks` is true, but you may call it manually instead. --- --- NOTE: You can only run this if debug bonk checking is enabled. -function Noble.Bonk.checkDebugBonks() - - if (playdate.crankDocked ~= debugBonks.crankDocked) then - error("BONK: Don't manually define playdate.crankDocked(). Create a crankDocked() inside of an inputHandler instead.") - end - if (playdate.crankUndocked ~= debugBonks.crankUndocked) then - error("BONK: Don't manually define playdate.crankUndocked(). Create a crankUndocked() inside of an inputHandler instead.") - end - if (playdate.update ~= debugBonks.update) then - error("BONK: Don't manually define playdate.update(). Put update code in your scenes' update() methods instead.") - end - if (playdate.gameWillPause ~= debugBonks.pause) then - error("BONK: Don't manually define playdate.gameWillPause(). Put pause code in your scenes' pause() methods instead.") - end - if (playdate.gameWillResume ~= debugBonks.resume) then - error("BONK: Don't manually define playdate.gameWillResume(). Put resume code in your scenes' resume() methods instead.") - end - if (Graphics.sprite.getAlwaysRedraw() == false) then - error("BONK: Don't use Graphics.sprite.setAlwaysRedraw(false) unless you know what you're doing...") - end - if (Noble.currentScene.backgroundColor == Graphics.kColorClear) then - error("BONK: Don't set a scene's backgroundColor to Graphics.kColorClear, silly.") - end - -end \ No newline at end of file diff --git a/source/libraries/noble/modules/Noble.GameData.lua b/source/libraries/noble/modules/Noble.GameData.lua deleted file mode 100644 index 3d52431..0000000 --- a/source/libraries/noble/modules/Noble.GameData.lua +++ /dev/null @@ -1,327 +0,0 @@ ---- Operations for game data / save slots. --- @module Noble.GameData --- -Noble.GameData = {} - -local gameDatas = {} -- This is the actual "GameDatas" object, which holds multiple GameData slots. We keep it local to avoid direct tampering. -local gameDataDefault = nil -local numberOfGameDataSlotsAtSetup = 1 -local numberOfSlots = 1 -local currentSlot = 1 -- This is a helper value, so you don't have to specify a save slot with every GameData operation. - -local function keyChange(__dataDefault, __data) - local defaultKeys = {} - local keys = {} - for key, value in pairs(__dataDefault.data) do - table.insert(defaultKeys, key) - end - for key, value in pairs(__data.data) do - table.insert(keys, key) - end - for i = 1, #keys, 1 do - if (defaultKeys[i] ~= keys[i]) then return true end - end - return false -end - -local function exists(__gameDataSlot, __key) - -- Check for valid gameSlot. - if (__gameDataSlot > #gameDatas or __gameDataSlot <= 0 ) then - error("BONK: Game Slot number " .. __gameDataSlot .. " does not exist. Use Noble.GameData.addSlot().", 3) - return false - end - - if (__key ~= nil) then - -- Check for valid data item. - for key, value in pairs(gameDatas[__gameDataSlot].data) do - if __key == key then - return true - end - end - else - return true - end - - error("BONK: Game Datum \"" .. __key .. "\" does not exist. Maybe you spellet it wronlgly.", 3) - return false -end - -local function updateTimestamp(__gameData) - __gameData.timestamp = playdate.getGMTTime() -end - -local gameDataHasBeenSetup = false - ---- Sets up the GameDatas (save slots) for your game, and/or loads any existing GameDatas from disk. --- You can only run this once, ideally in your main.lua before you load your first scene. --- @tparam table __keyValuePairs All the data items for a saved game, and their default values, as key/value pairs. NOTE: Do not use "nil" as a value. --- @int[opt=1] __numberOfSlots If you want multiple save slots, enter an integer here. You can add additional slots later. --- @bool[opt=true] __saveToDisk Saves your default values immediately to disk. --- @bool[opt=true] __modifyExistingOnKeyChange Updates the existing gameData objects on disk if you make changes to your keys (not values) during development or when updating your game. --- @usage --- Noble.GameData.setup( --- { --- name = "", --- checkpointReached = 0, --- score = 0 --- }, --- 3, --- true, --- true --- ) --- Noble.GameData.set("name", "Game A", 1) --- Noble.GameData.set("name", "Game B", 2) --- Noble.GameData.set("name", "Game C", 3) --- @see addSlot --- @see deleteSlot -function Noble.GameData.setup(__keyValuePairs, __numberOfSlots, __saveToDisk, __modifyExistingOnKeyChange) - if (gameDataHasBeenSetup) then - error("BONK: You can only run Noble.GameData.setup() once.") - return - else - gameDataHasBeenSetup = true - end - - numberOfSlots = __numberOfSlots or numberOfSlots - numberOfGameDataSlotsAtSetup = numberOfSlots - - local saveToDisk = Utilities.handleOptionalBoolean(__saveToDisk, true) - local modifyExistingOnKeyChange = Utilities.handleOptionalBoolean(__modifyExistingOnKeyChange, true) - - gameDataDefault = { - data = __keyValuePairs, - timestamp = playdate.getGMTTime() - } - - local createdNewData = false - - -- Noble Engine checks on disk for GameDatas, including ones that were - -- added with addSlot, but it assumes your game will have no greater than 1000 of them. - for i = 1, 1000, 1 do - -- We use a local here to avoid adding a nil item to the gameDatas table. - local gameData = Datastore.read("Game" .. i) - - if (gameData == nil) then - if (i <= numberOfSlots) then - -- No gameData on disk, so we create a new ones using default values - -- up to the numberOfGameDataSlots. - gameDatas[i] = table.deepcopy(gameDataDefault) - createdNewData = true - else - -- We can't find any more GameDatas on disk, so we update the - -- value of numberOfGameDataSlots if necessary and get outta town! - numberOfSlots = i - 1 - print("Total number of game slots: " .. numberOfSlots) - - if (saveToDisk and createdNewData) then - Noble.GameData.saveAll() - end - - return -- This is our only way out! - end - else - -- We found a gameData on disk, so we use it (either as-is or modified by a key change). - if (modifyExistingOnKeyChange and keyChange(gameDataDefault, gameData)) then - -- Found gameData on disk, but key changes have been made... - -- ...so we start with a new one, with default values... - local existingGameData = table.deepcopy(gameData) - gameData = table.deepcopy(gameDataDefault) - for key, _ in pairs(gameData.data) do - -- ...then copy data with unchanged keys to the new object, - -- naturally discarding keys that don't exist anymore. - if (existingGameData.data[key] ~= nil) then gameData.data[key] = existingGameData.data[key] end - end - gameDatas.timestamp = existingGameData.timestamp - createdNewData = true - end - gameDatas[i] = gameData - end - - end - -end - ---- Returns the value of the requested data item. --- @string __dataItemName The name of the data item. --- @int[opt] __gameDataSlot If set, uses a specific GameData slot. If not, uses the most recently touched GameData slot. --- @treturn any --- @usage Noble.GameData.get("equippedItem") --- @usage Noble.GameData.get("equippedItem", 2) -function Noble.GameData.get(__dataItemName, __gameDataSlot) - currentSlot = __gameDataSlot or currentSlot - if (exists(currentSlot, __dataItemName)) then - return gameDatas[currentSlot].data[__dataItemName] - end -end - ---- Set the value of a GameData item. --- @string __dataItemName The name of the data item. --- @tparam any __value The data item's new value --- @int[opt] __gameDataSlot If set, uses a specific GameData slot. If not, uses the most recently touched GameData slot. --- @bool[opt=true] __saveToDisk Saves to disk immediately. Set to false if you prefer to manually save (via a checkpoint or menu). --- @bool[opt=true] __updateTimestamp Sets the timestamp of this GameData to the current time. Leave false to retain existing timestamp. --- @usage Noble.GameData.set("score", 74205) --- @usage Noble.GameData.set("score", Noble.GameData.get("score") + 100) --- @see save -function Noble.GameData.set(__dataItemName, __value, __gameDataSlot, __saveToDisk, __updateTimestamp) - currentSlot = __gameDataSlot or currentSlot - if (exists(currentSlot, __dataItemName)) then - gameDatas[currentSlot].data[__dataItemName] = __value - local setTimestamp = Utilities.handleOptionalBoolean(__updateTimestamp, true) - if (setTimestamp) then updateTimestamp(gameDatas[currentSlot]) end - local saveToDisk = Utilities.handleOptionalBoolean(__saveToDisk, true) - if (saveToDisk) then Noble.GameData.save() end - end -end - ---- Reset a GameData item to its default value, defined in @{setup|setup}. --- @string __dataItemName The name of the data item. --- @int[opt] __gameDataSlot If set, uses a specific GameData slot. If not, uses the most recently touched GameData slot. --- @bool[opt=true] __saveToDisk Saves to disk immediately. Set to false if you prefer to manually save (via a checkpoint or menu). --- @bool[opt=true] __updateTimestamp Resets the timestamp of this GameData to the current time. Leave false to retain existing timestamp. --- @see save -function Noble.GameData.reset(__dataItemName, __gameDataSlot, __saveToDisk, __updateTimestamp) - currentSlot = __gameDataSlot or currentSlot - if (exists(currentSlot, __dataItemName)) then - gameDatas[currentSlot].data[__dataItemName] = gameDataDefault.data[__dataItemName] - local setTimestamp = Utilities.handleOptionalBoolean(__updateTimestamp, true) - if (setTimestamp) then updateTimestamp(gameDatas[currentSlot]) end - local saveToDisk = Utilities.handleOptionalBoolean(__saveToDisk, true) - if (saveToDisk) then Noble.GameData.save(currentSlot) end - end -end - ---- Reset all values in a GameData slot to the default values, defined in @{setup|setup}. --- @int[opt] __gameDataSlot If set, uses a specific GameData slot. If not, uses the most recently touched GameData slot. --- @bool[opt=true] __saveToDisk Saves to disk immediately. Set to false if you prefer to manually save (via a checkpoint or menu). --- @bool[opt=true] __updateTimestamp Resets the timestamp of this GameData to the current time. Leave false to retain existing timestamp. --- @see save -function Noble.GameData.resetAll(__gameDataSlot, __saveToDisk, __updateTimestamp) - currentSlot = __gameDataSlot or currentSlot - for key, _ in pairs(gameDatas[currentSlot].data) do - gameDatas[currentSlot].data[key] = gameDataDefault.data[key] - end - local setTimestamp = Utilities.handleOptionalBoolean(__updateTimestamp, true) - if (setTimestamp) then updateTimestamp(gameDatas[currentSlot]) end - local saveToDisk = Utilities.handleOptionalBoolean(__saveToDisk, true) - if (saveToDisk) then Noble.GameData.save(currentSlot) end -end - ---- Add a save slot to your game. This is useful for games which have arbitrary save slots, or encourage save scumming. --- @int[opt=1] __numberToAdd What it says on the tin. --- @bool[opt=true] __saveToDisk Saves to disk immediately. Set to false if you prefer to manually save (via a checkpoint or menu). --- @usage Noble.GameData.addSlot() --- @usage Noble.GameData.addSlot(10) -function Noble.GameData.addSlot(__numberToAdd, __saveToDisk) - local numberToAdd = __numberToAdd or 1 - local saveToDisk = Utilities.handleOptionalBoolean(__saveToDisk, true) - if (__numberToAdd < 1) then error ("BONK: Don't use a number smaller than 1, silly.", 2) return end - for i = 1, numberToAdd, 1 do - local newGameData = table.deepcopy(gameDataDefault) - updateTimestamp(newGameData) - table.insert(gameDatas, newGameData) - if (saveToDisk) then Noble.GameData.save() end - end - numberOfSlots = numberOfSlots + numberToAdd - print("Added " .. numberToAdd .. " GameData slots. Total GameData slots: " .. numberOfSlots) -end - ---- Deletes a GameData from disk if its save slot is greater than the default number established in `setup`. --- Otherwise, resets all data items to default values using @{resetAll|resetAll}. --- --- Generally, you won't need this unless you've added save slots using @{addSlot|addSlot}. In other cases, use @{resetAll|resetAll}. --- @int __gameDataSlot The slot holding the GameData to delete. Unlike other methods that take this argument, this is not optional. --- @bool[opt=true] __collapseGameDatas Re-sorts the gameDatas table (and renames existing JSON files on disk) to fill the gap left by the deleted GameData. --- @see deleteAllSlots --- @see addSlot --- @see resetAll --- @usage Noble.GameData.deleteSlot(6) --- @usage Noble.GameData.deleteSlot(15, false) -function Noble.GameData.deleteSlot(__gameDataSlot, __collapseGameDatas) - if (__gameDataSlot == nil) then - error("BONK: You must specify a GameData slot to delete.") - end - local collapseGameDatas = Utilities.handleOptionalBoolean(__collapseGameDatas, true) - if (exists(__gameDataSlot)) then - if (__gameDataSlot > numberOfGameDataSlotsAtSetup) then - -- If this GameData is not one of the default ones from setup(), it is removed from disk. - if (playdate.file.exists("Game" .. __gameDataSlot)) then - gameDatas[__gameDataSlot] = nil -- Clear from memory. - Datastore.delete("Game" .. __gameDataSlot) -- Clear from disk. - if (currentSlot == __gameDataSlot) then currentSlot = 1 end -- Safety! - if (collapseGameDatas) then - -- Collapse GameDatas - local newGameDatas = {} - for i = 1, numberOfSlots do - if(gameDatas[i] ~= nil) then - table.insert(newGameDatas, gameDatas[i]) - if (i >= __gameDataSlot) then - playdate.file.rename("Game" .. __gameDataSlot, "Game" .. __gameDataSlot-1) - end - end - end - gameDatas = newGameDatas - numberOfSlots = numberOfSlots - 1 - end - else - error("BONK: This GameData is in memory, but its file doesn't exist on disk, so it can't be deleted.", 2) - end - else - -- If this GameData is one of the default ones from setup(), it is reset to default values. - Noble.GameData.resetAll(__gameDataSlot) - end - end -end - ---- Deletes all GameDatas from disk, except for the number specified in setup, which are reset to default values. --- Use this to clear all data as if you were running setup again. --- Generally, you don't need this unless you've added save slots using @{addSlot|addSlot}. In other cases, use @{resetAll|resetAll} on each slot. --- @see deleteSlot --- @see addSlot -function Noble.GameData.deleteAllSlots() - local numberToDelete = numberOfSlots - for i = numberToDelete, 1, -1 do - Noble.GameData.deleteSlot(i, false) -- Don't need to collapse the table because we're deleting them in reverse order. - end -end - ---- Returns the timestamp of the requested GameData, as a tuple (local time, GMT time). The timestamp is updated --- See Playdate SDK for details on how a time object is formatted. NOTE: Timestamps are stored internally in GMT. --- @int __gameDataSlot The GameData slot to get the timestamp of. Unlike other methods that take this argument, this is not optional. --- @treturn table Local time --- @treturn table GMT time --- @usage Noble.GameData.getTimestamp(1) -function Noble.GameData.getTimestamp(__gameDataSlot) - if (exists(__gameDataSlot)) then - return playdate.timeFromEpoch(playdate.epochFromGMTTime(gameDatas[__gameDataSlot].timestamp)), gameDatas[__gameDataSlot].timestamp - end -end - ---- Returns the current number of GameData slots. --- @treturn int -function Noble.GameData.getNumberOfSlots() return numberOfSlots end - ---- Returns the number of the current GameData slot. --- @treturn int -function Noble.GameData.getCurrentSlot() return currentSlot end - ---- Saves a single GameData to disk. If you want to save all GameDatas, use @{saveAll|saveAll} instead. --- @int[opt] __gameDataSlot If set, uses a specific GameData slot. If not, uses the most recently touched GameData slot. --- @see saveAll --- @usage Noble.GameData.save() --- @usage Noble.GameData.save(3) -function Noble.GameData.save(__gameDataSlot) - local gameDataSlot = __gameDataSlot or currentSlot - if (exists(gameDataSlot)) then - currentSlot = gameDataSlot - Datastore.write(gameDatas[currentSlot], "Game" .. currentSlot) - end -end - ---- Save all GameDatas to disk. If you only have one, or want to save a specific one, use @{save|save} instead. --- @see save -function Noble.GameData.saveAll() - for i = 1, numberOfSlots, 1 do - Datastore.write(gameDatas[i], "Game" .. currentSlot) - end -end diff --git a/source/libraries/noble/modules/Noble.Input.lua b/source/libraries/noble/modules/Noble.Input.lua deleted file mode 100644 index e57e68f..0000000 --- a/source/libraries/noble/modules/Noble.Input.lua +++ /dev/null @@ -1,333 +0,0 @@ ---- A complete encapsulation of the Playdate's input system. The Playdate SDK gives developers multiple ways to manage input. Noble Engine's approach revolves around the SDK's "inputHandlers," extending them to include additional input methods, and pull in other hardware functions that the SDK puts elsewhere. See usage below for the full list of supported methods. ---

By default, Noble Engine assumes each scene will have an inputManager assigned to it. So, for example, you can define one inputManager for menu screens and another for gameplay scenes in your `main.lua`, and then in each scene, set which one that scene uses. You can instead define a unique inputHandler in each scene. ---

You may also create and manage inputManagers within and outside of scenes. When a NobleScene is loaded, its inputHandler will become active, thus, inputHandlers do not carry across scenes, and all input is suspended during scene transitions. An advanced use-case is to leave a scene's inputHandler as nil, and manage it separately. ---

NOTE: While the Playdate SDK allows you to stack as many inputHandlers as you want, Noble Engine assumes only one active inputHandler at a time. You may still manually call `playdate.inputHandlers.push()` and `playdate.inputHandlers.pop()` yourself, but Noble Engine will not know about it and it may cause unexpected behavior. ---

In addition, you may directly query button status using the SDK's methods for that, but it is not advised to use that as the primary way to manage input for Noble Engine projects, because much of Noble.Input's functionality will not apply. --- @module Noble.Input --- @usage --- local myInputHandler = { --- AButtonDown = function() end, -- Fires once when button is pressed down. --- AButtonHold = function() end, -- Fires each frame while a button is held (Noble Engine implementation). --- AButtonHeld = function() end, -- Fires once after button is held for 1 second (available for A and B). --- AButtonUp = function() end, -- Fires once when button is released. --- BButtonDown = function() end, --- BButtonHold = function() end, --- BButtonHeld = function() end, --- BButtonUp = function() end, --- downButtonDown = function() end, --- downButtonHold = function() end, --- downButtonUp = function() end, --- leftButtonDown = function() end, --- leftButtonHold = function() end, --- leftButtonUp = function() end, --- rightButtonDown = function() end, --- rightButtonHold = function() end, --- rightButtonUp = function() end, --- upButtonDown = function() end, --- upButtonHold = function() end --- upButtonUp = function() end, --- --- cranked = function(change, acceleratedChange) end, -- See Playdate SDK. --- crankDocked = function() end, -- Noble Engine implementation. --- crankUndocked = function() end, -- Noble Engine implementation. --- --- orientationChanged = function() end -- Noble Engine implementation. --- } --- @see NobleScene.inputHandler --- -Noble.Input = {} - -local currentHandler = {} - ---- Get the currently active input handler. Returns nil if none are active. --- @treturn table A table of callbacks which handle input events. --- @see NobleScene.inputHandler -function Noble.Input.getHandler() - return currentHandler -end - ---- Use this to change the active inputHandler. ---

Enter `nil` to disable input. Use @{setEnabled} to disable/enable input without losing track of the current inputHandler. --- @tparam[opt=nil] table __inputHandler A table of callbacks which handle input events. --- @see NobleScene.inputHandler --- @see clearHandler --- @see setEnabled -function Noble.Input.setHandler(__inputHandler) - if (currentHandler ~= nil) then - playdate.inputHandlers.pop() - end - - if (__inputHandler == nil) then - currentHandler = nil - else - currentHandler = __inputHandler - playdate.inputHandlers.push(__inputHandler, true) -- The Playdate SDK allows for multiple inputHandlers to mix and match methods. Noble Engine removes this functionality. - end -end - ---- A helper function that calls Noble.Input.setHandler() with no argument. --- @see setHandler -function Noble.Input.clearHandler() - Noble.Input.setHandler() -end - -local cachedInputHandler = nil - ---- Enable and disable user input without dealing with inputHanders. --- The Playdate SDK requires removing all inputHanders to halt user input, so while the currentHandler is cleared when `false` is passed to this method, --- it is cached so it can be later re-enabled by passing `true` it. --- @bool __value Set to false to halt input. Set to true to resume accepting input. --- @see getHandler --- @see clearHandler -function Noble.Input.setEnabled(__value) - local value = Utilities.handleOptionalBoolean(__value, true) - if (value == true) then - Noble.Input.setHandler(cachedInputHandler or currentHandler) - cachedInputHandler = nil - else - cachedInputHandler = currentHandler - Noble.Input.clearHandler() - end -end - ---- Checks to see that there is an active inputHandler --- @treturn bool Returns true if the input system is enabled. Returns false if `setEnabled(false)` was used, or if currentHandler is `nil`. -function Noble.Input.getEnabled() - return cachedInputHandler == nil -end - -local crankIndicatorActive = false -local crankIndicatorForced = false - ---- Enable/disable on-screen system crank indicator. --- --- NOTE: The indicator will only ever show if the crank is docked, unless `__evenWhenUndocked` is true. --- @bool __active Set true to start showing the on-screen crank indicator. Set false to stop showing it. --- @bool[opt=false] __evenWhenUndocked Set true to show the crank indicator even if the crank is already undocked (`__active` must also be true). -function Noble.Input.setCrankIndicatorStatus(__active, __evenWhenUndocked) - if (__active) then - UI.crankIndicator:start() - end - crankIndicatorActive = __active - crankIndicatorForced = Utilities.handleOptionalBoolean(__evenWhenUndocked, false) -end - ---- Checks whether the system crank indicator status. Returns a tuple. --- --- @treturn bool Is the crank indicator active? --- @treturn bool Is the crank indicator being forced when active, even when the crank is undocked? --- @see setCrankIndicatorStatus -function Noble.Input.getCrankIndicatorStatus() - return crankIndicatorActive, crankIndicatorForced -end - --- Noble Engine defines extra "buttonHold" methods that run every frame that a button is held down, but to implement them, we need to do some magic. -local buttonHoldBufferAmount = 3 -- This is how many frames to wait before the engine determines that a button is being held down. Using !buttonJustPressed() provides only 1 frame, which isn't enough. - -local AButtonHoldBufferCount = 0 -local BButtonHoldBufferCount = 0 -local upButtonHoldBufferCount = 0 -local downButtonHoldBufferCount = 0 -local leftButtonHoldBufferCount = 0 -local rightButtonHoldBufferCount = 0 - --- Store the latest orientation in order to know when to run the orientationChanged callback -local orientation = nil -local accelerometerValues = nil - ---- Checks the current display orientation of the device. Returns a tuple. --- If the accelerometer is not currently enabled, this method will turn it on, return current values, and then turn it off. --- If you are trying to get raw accelerometer values rather than the display orientation, you may want to use `playdate.readAccelerometer()` instead. --- @bool[opt=false] __getStoredValues If true, this method will simply return the most recently stored values, rather than use the accelerometer to check for new ones. --- @treturn str The named orientation of the device (a pseudo enum Noble.Input.ORIENTATION_XX) --- @treturn list Accelerometer values, where list[1] is x, list[2] is y and list[3] is z --- @see Noble.Input.ORIENTATION_UP --- @see Noble.Input.ORIENTATION_DOWN --- @see Noble.Input.ORIENTATION_LEFT --- @see Noble.Input.ORIENTATION_RIGHT -function Noble.Input.getOrientation(__getStoredValues) - - local getStoredValues = Utilities.handleOptionalBoolean(__getStoredValues, false) - if (not getStoredValues) then - - local turnOffAfterUse = false - if (not playdate.accelerometerIsRunning()) then - playdate.startAccelerometer() - turnOffAfterUse = true - end - - local x, y, z = playdate.readAccelerometer() - - if (turnOffAfterUse) then - playdate.stopAccelerometer() - end - - local newOrientation = nil - - if (x <= -0.7) then - newOrientation = Noble.Input.ORIENTATION_LEFT - elseif (x >= 0.7) then - newOrientation = Noble.Input.ORIENTATION_RIGHT - elseif (y <= -0.3) then - newOrientation = Noble.Input.ORIENTATION_DOWN - else - newOrientation = Noble.Input.ORIENTATION_UP - end - - accelerometerValues = {x, y, z} - - if (newOrientation ~= orientation) then - if (currentHandler.orientationChanged ~= nil) then - currentHandler.orientationChanged(orientation, accelerometerValues) - end - orientation = newOrientation - end - end - - return orientation, accelerometerValues - -end - --- Do not call this method directly, or modify it, thanks. :-) -function Noble.Input.update() - - if (currentHandler == nil) then return end - - if (currentHandler.AButtonHold ~= nil) then - if (playdate.buttonIsPressed(playdate.kButtonA)) then - if (AButtonHoldBufferCount >= buttonHoldBufferAmount) then currentHandler.AButtonHold(AButtonHoldBufferCount) end -- Execute! - AButtonHoldBufferCount = AButtonHoldBufferCount + 1 -- Wait another frame! - end - if (playdate.buttonJustReleased(playdate.kButtonA)) then AButtonHoldBufferCount = 0 end -- Reset! - end - if (currentHandler.BButtonHold ~= nil) then - if (playdate.buttonIsPressed(playdate.kButtonB)) then - if (BButtonHoldBufferCount >= buttonHoldBufferAmount) then currentHandler.BButtonHold(BButtonHoldBufferCount) end - BButtonHoldBufferCount = BButtonHoldBufferCount + 1 - end - if (playdate.buttonJustReleased(playdate.kButtonB)) then BButtonHoldBufferCount = 0 end - end - if (currentHandler.upButtonHold ~= nil) then - if (playdate.buttonIsPressed(playdate.kButtonUp)) then - if (upButtonHoldBufferCount >= buttonHoldBufferAmount) then currentHandler.upButtonHold(upButtonHoldBufferCount) end - upButtonHoldBufferCount = upButtonHoldBufferCount + 1 - end - if (playdate.buttonJustReleased(playdate.kButtonUp)) then upButtonHoldBufferCount = 0 end - end - if (currentHandler.downButtonHold ~= nil) then - if (playdate.buttonIsPressed(playdate.kButtonDown)) then - if (downButtonHoldBufferCount >= buttonHoldBufferAmount) then currentHandler.downButtonHold(downButtonHoldBufferCount) end - downButtonHoldBufferCount = downButtonHoldBufferCount + 1 - end - if (playdate.buttonJustReleased(playdate.kButtonDown)) then downButtonHoldBufferCount = 0 end - end - if (currentHandler.leftButtonHold ~= nil) then - if (playdate.buttonIsPressed(playdate.kButtonLeft)) then - if (leftButtonHoldBufferCount >= buttonHoldBufferAmount) then currentHandler.leftButtonHold(leftButtonHoldBufferCount) end - leftButtonHoldBufferCount = leftButtonHoldBufferCount + 1 - end - if (playdate.buttonJustReleased(playdate.kButtonLeft)) then leftButtonHoldBufferCount = 0 end - end - if (currentHandler.rightButtonHold ~= nil) then - if (playdate.buttonIsPressed(playdate.kButtonRight)) then - if (rightButtonHoldBufferCount >= buttonHoldBufferAmount) then currentHandler.rightButtonHold(rightButtonHoldBufferCount) end - rightButtonHoldBufferCount = rightButtonHoldBufferCount + 1 - end - if (playdate.buttonJustReleased(playdate.kButtonRight)) then rightButtonHoldBufferCount = 0 end - end - if (playdate.accelerometerIsRunning()) then - Noble.Input.getOrientation() - end -end - --- Do not call this method directly, or modify it, thanks. :-) -function playdate.crankDocked() - if (currentHandler ~= nil and currentHandler.crankDocked ~= nil and Noble.Input.getEnabled() == true) then - currentHandler.crankDocked() - end -end - --- Do not call this method directly, or modify it, thanks. :-) -function playdate.crankUndocked() - if (currentHandler ~= nil and currentHandler.crankUndocked ~= nil and Noble.Input.getEnabled() == true) then - currentHandler.crankUndocked() - end -end - ---- Constants --- . A set of constants referencing device inputs, stored as strings. Can be used for querying button input, --- but are mainly for on-screen prompts or other elements where a string literal is useful, such as a filename, GameData value, or localization key. --- For faster performance, use the ones that exist in the Playdate SDK (i.e.: `playdate.kButtonA`), which are stored as binary numbers. --- @usage --- function newPrompt(__input, __promptString) --- -- ... --- local icon = Graphics.image.new("assets/images/UI/Icon_" .. __input) --- -- ... --- end --- --- promptMove = newPrompt(Noble.Input.DPAD_HORIZONTAL, "Move!") -- assets/images/UI/Icon_dPadHorizontal.png" --- promptJump = newPrompt(Noble.Input.BUTTON_A, "Jump!") -- assets/images/UI/Icon_buttonA.png" --- promptCharge = newPrompt(Noble.Input.CRANK_FORWARD, "Charge the battery!") -- assets/images/UI/Icon_crankForward.png" --- @section constants - ---- `"buttonA"` -Noble.Input.BUTTON_A = "buttonA" ---- `"buttonB"` -Noble.Input.BUTTON_B = "buttonB" ---- The system menu button. --- --- `"buttonMenu"` -Noble.Input.BUTTON_MENU = "buttonMenu" - ---- Referencing the D-pad component itself, rather than an input. --- --- `"dPad"` -Noble.Input.DPAD = "dPad" ---- Referencing the left and right input D-pad inputs. --- --- `"dPadHorizontal"` -Noble.Input.DPAD_HORIZONTAL = "dPadHorizontal" ---- Referencing the up and down input D-pad inputs. --- --- `"dPadVertical"` -Noble.Input.DPAD_VERTICAL = "dPadVertical" ---- `"dPadUp"` -Noble.Input.DPAD_UP = "dPadUp" ---- `"dPadDown"` -Noble.Input.DPAD_DOWN = "dPadDown" ---- `"dPadLeft"` -Noble.Input.DPAD_LEFT = "dPadLeft" ---- `"dPadRight"` -Noble.Input.DPAD_RIGHT = "dPadRight" - ---- Referencing the crank component itself, rather than an input. --- --- `"crank"` -Noble.Input.CRANK = "crank" ---- AKA: Clockwise. See Playdate SDK. --- --- `"crankForward"` -Noble.Input.CRANK_FORWARD = "crankForward" ---- AKA: Anticlockwise. See Playdate SDK. --- --- `"crankReverse"` -Noble.Input.CRANK_REVERSE = "crankReverse" ---- Referencing the action of docking the crank. --- --- `"crankDock"` -Noble.Input.CRANK_DOCK = "crankDock" ---- Referencing the action of undocking the crank. --- --- `"crankUndock"` -Noble.Input.CRANK_UNDOCK = "crankUndock" - ---- Referencing the display orientations. --- --- `"orientationUp"` -Noble.Input.ORIENTATION_UP = "orientationUp" --- `"orientationDown"` -Noble.Input.ORIENTATION_DOWN = "orientationDown" --- `"orientationLeft"` -Noble.Input.ORIENTATION_LEFT = "orientationLeft" --- `"orientationRight"` -Noble.Input.ORIENTATION_RIGHT = "orientationRight" \ No newline at end of file diff --git a/source/libraries/noble/modules/Noble.Menu.lua b/source/libraries/noble/modules/Noble.Menu.lua deleted file mode 100644 index 00781cf..0000000 --- a/source/libraries/noble/modules/Noble.Menu.lua +++ /dev/null @@ -1,570 +0,0 @@ ---- An extended implementation of `playdate.ui.gridview`, meant for 1-dimensional, single-screen text menus. --- @module Noble.Menu --- -Noble.Menu = {} - ---- Setup --- @section setup - ---- Create a new menu object. --- @bool[opt=true] __activate @{activate|Activate} this menu upon creation. --- @param[opt=Noble.Text.ALIGN_LEFT] __alignment The text alignment of menu items. --- @bool[opt=false] __localized If true, menu item names are localization keys rather than display names. --- @param[opt=Graphics.kColorBlack] __color The color of menu item text. The selected highlight will be the inverse color. --- @int[opt=2] __padding Cell padding for menu items. --- @int[opt] __horizontalPadding Use this to override horizontal padding, useful for certain fonts. If nil, uses __padding. --- @int[opt=2] __margin Spacing between menu items. --- @param[opt=Noble.Text.getCurrentFont()] __font If nil, uses current set font. --- @int[opt=__font:getHeight()/4] __selectedCornerRadius Sets rounded corners for a selected menu item. --- @int[opt=1] __selectedOutlineThickness Sets the outline thickness for selected items. --- @return `menu`, a new menu item. --- @usage --- local menu = Noble.Menu.new( --- true, --- Noble.Text.ALIGN_CENTER, --- false, --- Graphics.kColorWhite, --- 4, 6, --- Noble.Text.large, --- nil, 3 --- ) --- menu:addItem("Play Game", function() TitleScreen:playGame() end) --- menu:addItem("Options", function() Noble.transition(OptionsScreen) end) --- menu:addItem("Credits", function() Noble.transition(CreditsScreen) end) --- @see addItem -function Noble.Menu.new(__activate, __alignment, __localized, __color, __padding, __horizontalPadding, __margin, __font, __selectedCornerRadius, __selectedOutlineThickness) - - -- Prep for creating the gridview object - local paddingLocal = __padding or 2 - local fontLocal = __font or Noble.Text.getCurrentFont() - local textHeightLocal = fontLocal:getHeight() - - -- Create gridview object - local menu = UI.gridview.new(0, textHeightLocal + paddingLocal) - - --- Properties - --@section properties - - menu.alignment = __alignment or Noble.Text.ALIGN_LEFT - - --- @bool[opt=false] _ Indicates whether this menu's item names are treated as localization keys. - menu.localized = Utilities.handleOptionalBoolean(__localized, false) - menu.textHeight = textHeightLocal - menu.padding = paddingLocal - menu.horizontalPadding = __horizontalPadding or menu.padding - menu.margin = __margin or 2 - menu.font = fontLocal - menu.selectedCornerRadius = __selectedCornerRadius or textHeightLocal/4 - menu.selectedOutlineThickness = __selectedOutlineThickness or 1 - - -- Local cleanup. We don't need these anymore. - paddingLocal = nil - fontLocal = nil - textHeightLocal = nil - - -- Colors - menu.color = __color or Graphics.kColorBlack -- TO-DO allow for copy fill mode instead of color. - menu.fillMode = Graphics.kDrawModeFillBlack - menu.otherColor = Graphics.kColorWhite - menu.otherFillMode = Graphics.kDrawModeFillWhite - if (menu.color == Graphics.kColorWhite) then - menu.fillMode = Graphics.kDrawModeFillWhite - menu.otherColor = Graphics.kColorBlack - menu.otherFillMode = Graphics.kDrawModeFillBlack - end - - -- Gridview properties - menu:setNumberOfColumns(1) - menu:setCellPadding(0, 0, 0, 0) - menu.changeRowOnColumnWrap = false - - --- Tables - --@section tables - - --- A string "array" of menu item strings/keys. - -- You cannot add or remove menu items by modifying this table. - -- It is meant as a read-only table, provided for convenience when iterating, etc. Modifying its values may break other methods. - -- @usage - -- for i = 1, #menu.itemNames, 1 do - -- menu.clickHandlers[menu.itemNames[i]] = nil -- Clears all click handlers, for some reason. - -- end - -- @see addItem - menu.itemNames = {} - - -- This is an internal table. Modifying its may break other methods. - menu.displayNames = {} - - -- This is an internal table. Modifying its may break other methods. - menu.displayNamesAreLocalized = {} - - --- A table of functions associated with menu items. Items are a defined when calling @{addItem|addItem}, but their associated functions may be modified afterward. - -- - -- You cannot add or remove menu items by modifying this table. - -- @usage - -- local menu = Noble.Menu.new(true) - -- menu.addItem("Play Game") - -- menu.addItem("Options") - -- - -- menu.clickHandlers["Play Game"] = function() TitleScreen:playGame() end - -- menu.clickHandlers["Options"] = function() Noble.transition(OptionsScreen) end - -- @usage - -- local menu = Noble.Menu.new(true) - -- menu.addItem("Play Game") - -- menu.addItem("Options") - -- - -- menu.clickHandlers = { - -- ["Play Game"] = function TitleScreen:playGame() end, - -- ["Options"] = function() Noble.transition(OptionsScreen) end - -- } - -- @see addItem - -- @see removeItem - menu.clickHandlers = {} - - --- A key/value table of menu item indices. - -- - -- This is meant as a read-only table, provided for convenience. Modifying its values will break other methods. - -- @usage - -- menu.itemPositions["Play Game"] -- 1 - -- menu.itemPositions["Options"] -- 2 - menu.itemPositions = {} - - --- A key/value table of pixel widths for each menu item, based on its text. Useful for animation, layout, etc. - -- - -- This is meant as a read-only table, provided for convenience. Modifying its values will break other methods. - -- @usage local playGameMenuItemWidth = menu.itemWidths["Play Game"] - menu.itemWidths = {} - - --- Properties - -- @section properties - - --- @int _ - -- The current menu item's index. - -- - -- This is meant as a read-only value. Do not modify it directly. - -- @see select - menu.currentItemNumber = 1 - - --- @string _ - -- The current menu item's name. - -- - -- This is meant as a read-only value. Do not modify it directly. - -- @see select - menu.currentItemName = menu.itemNames[1] - - - --- @int _ - -- The width of the widest menu item plus the menu's horizontal padding. - -- - -- This is meant as a read-only value. Do not modify it directly. - menu.width = 0 - - --- Setup - -- @section setup - - --- Adds a item to this menu. - -- @string __nameOrKey The name of this menu item. It can be a display name or a localization key. Must be unique. - -- @tparam[opt] function __clickHandler The function that runs when this menu item is "clicked." - -- @int[opt] __position Insert the item at a specific position. If not set, adds to the end of the list. - -- @string[opt] __displayName You can create an optional, separate display name for this item. You can add or change this at runtime via @{setItemDisplayName|setItemDisplayName}. - -- @bool[opt=false] __displayNameIsALocalizationKey If true, will treat the `__displayName` as a localization key. This is separate from this menu's @{localized|localized} value. - -- @see new - -- @see removeItem - -- @see setItemDisplayName - function menu:addItem(__nameOrKey, __clickHandler, __position, __displayName, __displayNameIsALocalizationKey) - local clickHandler = __clickHandler or function () print("Menu item \"" .. __nameOrKey .. "\" clicked!") end - if (__position ~= nil) then - if (__position <= 0 or __position > #self.itemNames) then error("BONK: Menu item out of range.", 3) return end - table.insert(self.itemNames, __position, __nameOrKey) - for key, value in pairs(self.itemPositions) do - if (value >= __position) then - self.itemPositions[key] = self.itemPositions[key] + 1 - end - end - self.itemPositions[__nameOrKey] = __position - else - table.insert(self.itemNames, __nameOrKey) - self.itemPositions[__nameOrKey] = #self.itemNames - end - - self.clickHandlers[__nameOrKey] = clickHandler - - -- Item name - local nameOrKey - if (self.localized) then - nameOrKey = Graphics.getLocalizedText(__nameOrKey) - else - nameOrKey = __nameOrKey - end - - -- Display name - local displayName = nil - if (__displayName ~= nil) then - if (__displayNameIsALocalizationKey == true) then - displayName = Graphics.getLocalizedText(__displayName) - else - displayName = __displayName - end - self.displayNames[__nameOrKey] = displayName - end - - if (displayName == nil) then - self:updateWidths(__nameOrKey, nameOrKey) - else - self:updateWidths(__nameOrKey, displayName) - end - - self:setNumberOfRows(#self.itemNames) - - end - - -- Internal method. - function menu:updateWidths(__nameOrKey, __string) - - if (__string == nil) then - __string = __nameOrKey - end - - -- Item width - self.itemWidths[__nameOrKey] = self.font:getTextWidth(__string) - - -- Menu width - local width = 0 - for _, value in pairs(self.itemWidths) do - if value > width then width = value end - end - self.width = width + (self.horizontalPadding * 2) + (self.selectedOutlineThickness * 2) - end - - --- Removes a item from this menu. - -- @tparam[opt=#menu.itemNames] int|string __menuItem The menu item to remove. You can enter either the item's name/key or it's position. If left blank, removes the last item. - -- @see addItem - function menu:removeItem(__menuItem) - local itemString = nil - local itemPosition = nil - - if (__menuItem == nil) then - __menuItem = #self.itemNames - end - - if (type(__menuItem) == "number") then - if (__menuItem <= 0 or __menuItem > #self.itemNames) then error("BONK: Menu item out of range.", 3) return end - itemString = self.itemNames[__menuItem] - itemPosition = __menuItem - elseif (type(__menuItem) == "string") then - itemString = __menuItem - itemPosition = self.itemPositions[__menuItem] - if (itemPosition == nil) then error("BONK: Menu item not found.", 3) return end - end - - for key, value in pairs(self.itemPositions) do - if (value > itemPosition) then - self.itemPositions[key] = self.itemPositions[key] - 1 - end - end - - table.remove(self.itemNames, itemPosition) - self.itemPositions[itemString] = nil - self.clickHandlers[itemString] = nil - self.itemWidths[itemString] = nil - self.displayNames[itemString] = nil - self.displayNamesAreLocalized[itemString] = nil - - -- In case the current item is selected. - if (self.currentItemNumber == itemPosition and self.currentItemNumber ~= 1) then - self:select(self.currentItemNumber - 1, true) - if (self.isActive() == false) then - self:setSelectedRow(0) - end - end - - self:setNumberOfRows(#self.itemNames) - - -- Update width - local width = 0 - for _, value in pairs(self.itemWidths) do - if value > width then width = value end - end - self.width = width + (self.horizontalPadding * 2) + (self.selectedOutlineThickness * 2) - - end - - -- - - local active = Utilities.handleOptionalBoolean(__activate, true) - if (active) then - menu.currentItemNumber = 1 - menu.currentItemName = menu.itemNames[1] - menu:setSelectedRow(1) - else - menu:setSelectedRow(0) - end - - --- Methods - --@section methods - - --- Activate this menu. - -- This selects the most recently selected menu item (or the first item if none have been previously selected), and enables this menu's @{selectPrevious|selectPrevious}, @{selectNext|selectNext}, and @{click|click} methods. - -- @usage - -- local menu = Noble.Menu.new(false) - -- menu:activate() - function menu:activate() - active = true - self:select(self.currentItemNumber) - end - --- Deactivate this menu. - -- This deselects all menu items, and disables this menu's @{selectPrevious|selectPrevious}, @{selectNext|selectNext}, and @{click|click} methods. - -- @usage - -- local menu = Noble.Menu.new(true) - -- menu:deactivate() - function menu:deactivate() - self:setSelectedRow(0) - active = false - end - --- Check to see if this menu is currently active. - -- @treturn bool - function menu:isActive() - return active - end - - --- Selects the previous item in this menu. This menu must be active. - -- @bool[opt=false] __force Force this method to run, even if this menu is not active. - -- @bool[opt=true] __wrapSelection Selects the final menu item if the first menu item is currently selected. - -- @see activate - -- @usage - -- TitleScreen.inputHandler.upButtonDown = function() - -- menu:selectPrevious() - -- end - function menu:selectPrevious(__force, __wrapSelection) - if (self:isActive() or __force) then - local wrapSelection = Utilities.handleOptionalBoolean(__wrapSelection, true) - self:selectPreviousRow(wrapSelection, false, false) - local _, row, _ = self:getSelection() - self.currentItemNumber = row - self.currentItemName = self.itemNames[row] - end - end - --- Selects the next previous item in this menu. This menu must be active. - -- @bool[opt=false] __force Force this method to run, even if this menu is not active. - -- @bool[opt=true] __wrapSelection Selects the first menu item if the final menu item is currently selected. - -- @see activate - -- @usage - -- TitleScreen.inputHandler.downButtonDown = function() - -- menu:selectNext() - -- end - function menu:selectNext(__force, __wrapSelection) - if (self:isActive() or __force) then - local wrapSelection = Utilities.handleOptionalBoolean(__wrapSelection, true) - self:selectNextRow(wrapSelection, false, false) - local _, row, _ = self:getSelection() - self.currentItemNumber = row - self.currentItemName = self.itemNames[row] - end - end - - --- Selects a specific item in this menu, either by it's index, or it's name. This menu must be active. - -- @tparam int|string __menuItem The menu item to select. You can enter the item's number or it's name/key. - -- @bool[opt=false] __force Force this method to run, even if this menu is not active. - -- @see activate - -- @usage - -- function resetMenu() - -- menu:select(1, true) - -- menu:deactivate() - -- end - -- @usage - -- function resetMenu() - -- menu:select("Play Game", true) - -- menu:deactivate() - -- end - function menu:select(__menuItem, __force) - if (self:isActive() or __force) then - if (type(__menuItem) == 'number') then - if (__menuItem < 1) then - error("BONK: _menuItem must be a number greater than 0 (or a string).") - end - self:setSelectedRow(__menuItem) - elseif (type(__menuItem) == 'string') then - self:setSelectedRow(self.itemPositions[__menuItem]) - else - error("BONK: _menuItem must be a number or string, silly.") - end - local _, row, _ = self:getSelection() - self.currentItemNumber = row - self.currentItemName = self.itemNames[row] - end - end - - --- Runs the function associated with the currently selected menu item. This menu must be active. - -- @bool[opt=false] __force Force this method to run, even if this menu is not active. - -- @see activate - -- @usage - -- TitleScreen.inputHandler.AButtonDown = function() - -- menu:click() - -- end - function menu:click(__force) - if ((self:isActive() or __force) and self.clickHandlers[self.currentItemName] ~= nil) then - self.clickHandlers[self.currentItemName]() - end - end - - --- Gets the display name of a menu item. - -- - -- If a menu item does not have a display name, then the `__nameOrKey` (or its localized string) will be returned instead. This method is used internally when @{draw|draw} is called. - -- - -- If this menu's `localized` value is true, a returned `__nameOrKey` will always be localized, but a returned display name is only localized if the `__displayNameIsALocalizationKey` argument was set to `true` when the display name was added. - -- @string __itemName The menu item you want the display name of. - -- @treturn string - -- @see addItem - -- @see setItemDisplayName - function menu:getItemDisplayName(__itemName) - if (self.displayNames[__itemName] == nil) then - -- No display name. - if (self.localized) then - return Graphics.getLocalizedText(__itemName) - else - return __itemName - end - else - -- Has display name. - if (self.displayNamesAreLocalized[__itemName] == true) then - return Graphics.getLocalizedText(self.displayNames[__itemName]) - else - return self.displayNames[__itemName] - end - end - end - - --- When you add a menu item, you can give it a display name that's different from it's actual name. This method adds or changes the display name of a menu item. - -- @string __itemName The menu item name (or key if this menu uses localization keys). - -- @string __displayName The display name. - -- @bool[opt=false] __displayNameIsALocalizationKey Set to use to indicate that this display name is a localization key. This setting is separate from @{localized|localized} - -- @usage - -- function changeDifficultyLevel(__level) - -- menu:setItemDisplayName("Difficulty", "Difficulty: " .. __level) - -- end - function menu:setItemDisplayName(__itemName, __displayName, __displayNameIsALocalizationKey) - self.displayNames[__itemName] = __displayName - self.displayNamesAreLocalized[__itemName] = Utilities.handleOptionalBoolean(__displayNameIsALocalizationKey, false) - - local displayName - if (__displayNameIsALocalizationKey == true) then - displayName = Graphics.getLocalizedText(__displayName) - else - displayName = __displayName - end - - -- If we're "resetting" the display name by setting it to nil, then use __nameOrKey instead (checking for localization before calling updateWidths) - if (displayName == nil) then - if (self.localized) then - displayName = Graphics.getLocalizedText(__itemName) - else - displayName = __itemName - end - end - - self:updateWidths(__itemName, displayName) - end - - --- Drawing - --@section drawing - - --- Draw's this menu to the screen. You may call this manually, but ideally, you will put it in in your scene's @{NobleScene:update|update} or @{NobleScene:drawBackground|drawBackground} method. - -- @usage - -- function YourScene:update() - -- YourScene.super.update(self) - -- menu:draw(50, 100) - -- end - function menu:draw(__x, __y) - local xAdjustment = 0 - if (self.alignment == Noble.Text.ALIGN_CENTER) then - xAdjustment = self.width/2 - elseif (self.alignment == Noble.Text.ALIGN_RIGHT) then - xAdjustment = self.width - end - self:drawInRect(__x - xAdjustment, __y, self.width, ((self.textHeight + self.padding + self.margin) * #self.itemNames) + (self.selectedOutlineThickness * 2) - self.margin) - end - - --- This method is called for every non-selected item when @{draw|draw} is called. You shouldn't call this directly, but you may re-implement it if you wish. - -- @usage - -- -- This is the default implementation for this method. - -- function menu:drawItem(__x, __y, __itemIndex) - -- Graphics.setImageDrawMode(self.fillMode) - -- local xAdjustment = 0 - -- if (self.alignment == Noble.Text.ALIGN_CENTER) then - -- xAdjustment = self.width/2 - self.horizontalPadding/2 - -- elseif (self.alignment == Noble.Text.ALIGN_RIGHT) then - -- xAdjustment = self.width - self.horizontalPadding - -- end - -- Noble.Text.draw(self.itemNames[__itemIndex], __x + self.horizontalPadding/2 + xAdjustment, __y + self.padding/2, self.alignment, self.localized, self.font) - -- end - -- @see Noble.Text.draw - function menu:drawItem(__x, __y, __itemIndex) - Graphics.setImageDrawMode(self.fillMode) - local xAdjustment = self.selectedOutlineThickness - if (self.alignment == Noble.Text.ALIGN_CENTER) then - xAdjustment = self.width/2 - self.horizontalPadding/2 - elseif (self.alignment == Noble.Text.ALIGN_RIGHT) then - xAdjustment = self.width - self.horizontalPadding - self.selectedOutlineThickness - end - Noble.Text.draw( - self:getItemDisplayName(self.itemNames[__itemIndex]), - __x + self.horizontalPadding/2 + xAdjustment, __y + self.padding/2 + self.selectedOutlineThickness + (self.margin * (__itemIndex -1)), - self.alignment, false, self.font - ) - end - - --- This method is called for every selected item when @{draw|draw} is called. You shouldn't call this directly, but you may re-implement it if you wish. - -- @usage - -- -- This is the default implementation for this method. - -- function menu:drawSelectedItem(__x, __y, __itemIndex) - -- local xAdjustmentText = 0 - -- local xAdjustmentRect = 0 - -- if (self.alignment == Noble.Text.ALIGN_CENTER) then - -- xAdjustmentText = self.width/2 - self.horizontalPadding/2 - -- xAdjustmentRect = self.width/2 - self.itemWidths[self.itemNames[__itemIndex]]/2 - self.horizontalPadding/2 - -- elseif (self.alignment == Noble.Text.ALIGN_RIGHT) then - -- xAdjustmentText = self.width - self.horizontalPadding - -- xAdjustmentRect = self.width - self.itemWidths[self.itemNames[__itemIndex]] - self.horizontalPadding - -- end - -- Graphics.setColor(self.color) - -- Graphics.fillRoundRect(__x + xAdjustmentRect, __y, self.itemWidths[self.itemNames[__itemIndex]]+self.horizontalPadding, self.textHeight+self.padding, self.selectedCornerRadius) - -- Graphics.setColor(self.otherColor) - -- Graphics.setLineWidth(self.selectedOutlineThickness) - -- Graphics.drawRoundRect(__x + xAdjustmentRect, __y, self.itemWidths[self.itemNames[__itemIndex]]+self.horizontalPadding, self.textHeight+self.padding, self.selectedCornerRadius) - -- Graphics.setImageDrawMode(self.otherFillMode) - -- Noble.Text.draw(self.itemNames[__itemIndex], __x + self.horizontalPadding/2 + xAdjustmentText, __y+self.padding/2, self.alignment, self.localized, self.font) - -- end - -- @see Noble.Text.draw - function menu:drawSelectedItem(__x, __y, __itemIndex) - local xAdjustmentText = self.selectedOutlineThickness - local xAdjustmentRect = self.selectedOutlineThickness - if (self.alignment == Noble.Text.ALIGN_CENTER) then - xAdjustmentText = self.width/2 - self.horizontalPadding/2 - xAdjustmentRect = self.width/2 - self.itemWidths[self.itemNames[__itemIndex]]/2 - self.horizontalPadding/2 - elseif (self.alignment == Noble.Text.ALIGN_RIGHT) then - xAdjustmentText = self.width - self.horizontalPadding - self.selectedOutlineThickness - xAdjustmentRect = self.width - self.itemWidths[self.itemNames[__itemIndex]] - self.horizontalPadding - self.selectedOutlineThickness - end - Graphics.setColor(self.color) - Graphics.fillRoundRect(__x + xAdjustmentRect, __y + self.selectedOutlineThickness + (self.margin * (__itemIndex -1)), self.itemWidths[self.itemNames[__itemIndex]]+self.horizontalPadding, self.textHeight+self.padding, self.selectedCornerRadius) - Graphics.setColor(self.otherColor) - Graphics.setLineWidth(self.selectedOutlineThickness) - Graphics.drawRoundRect(__x + xAdjustmentRect, __y + self.selectedOutlineThickness + (self.margin * (__itemIndex -1)), self.itemWidths[self.itemNames[__itemIndex]]+self.horizontalPadding, self.textHeight+self.padding, self.selectedCornerRadius) - Graphics.setImageDrawMode(self.otherFillMode) - Noble.Text.draw( - self:getItemDisplayName(self.itemNames[__itemIndex]), - __x + self.horizontalPadding/2 + xAdjustmentText, __y + self.padding/2 + self.selectedOutlineThickness + (self.margin * (__itemIndex -1)), - self.alignment, false, self.font - ) - end - - -- Don't call or modify this function. - function menu:drawCell(_, row, _, selected, x, y, width, height) - if selected then - self:drawSelectedItem(x, y, row) - else - self:drawItem(x, y, row) - end - end - - return menu -end diff --git a/source/libraries/noble/modules/Noble.Settings.lua b/source/libraries/noble/modules/Noble.Settings.lua deleted file mode 100644 index fa69a91..0000000 --- a/source/libraries/noble/modules/Noble.Settings.lua +++ /dev/null @@ -1,158 +0,0 @@ ---- Operations for game settings / stats. --- @module Noble.Settings --- -Noble.Settings = {} -- This is the "class" that holds methods. -local settings = nil -- This is the actual settings object. We keep it local to avoid direct tampering. -local settingsDefault = nil -- We keep track of default values so they can be reset. - -local function keyChange(__dataDefault, __data) - local defaultKeys = {} - local keys = {} - for key, value in pairs(__dataDefault) do table.insert(defaultKeys, key) end - for key, value in pairs(__data) do table.insert(keys, key) end - for i = 1, #keys, 1 do - if (defaultKeys[i] ~= keys[i]) then return true end - end - return false -end - -local function settingExists(__key) - -- Check for valid data item. - for key, value in pairs(settings) do - if __key == key then - return true - end - end - error("BONK: Setting \'" .. __key .. "\' does not exist. Maybe you spellet ti wronlgly.", 3) - return false -end - -local settingsHaveBeenSetup = false - ---- Sets up the settings for your game. You can only run this once, and you must run it before using other `Noble.Settings` functions. It is recommended to place it in your main.lua, before `Noble.new()`. --- --- NOTE: You will *not* be able to add new keys via the `Noble.Settings.set` method. This means you need to specify the keys and default values of all of the settings in your game at setup. --- If you need to add keys that are not known during setup, it is probably not a setting and you should consider using `Noble.GameData` instead. --- @tparam table __keyValuePairs table. Your game's settings, and thier default values, as key/value pairs. NOTE: Do not use "nil" as a value. --- @bool[opt=true] __saveToDisk Saves your default values immediatly to disk. --- @bool[opt=true] __modifyExistingOnKeyChange Updates the existing settings object on disk if you make changes to your settings keys (not values) during development or when updating your game. --- @usage --- Noble.Settings.setup({ --- difficulty = "normal", --- music = true, --- sfx = true, --- players = 2, --- highScore = 0 -- You can store persistant stats here, too! --- }) -function Noble.Settings.setup(__keyValuePairs, __saveToDisk, __modifyExistingOnKeyChange) - if (settingsHaveBeenSetup) then - error("BONK: You can only run Noble.Settings.setup() once.") - return - else - settingsHaveBeenSetup = true - end - - -- Prevent using the setup() method if there are no settings to register - if (__keyValuePairs == nil or table.getSize(__keyValuePairs) == 0) then - error("BONK: Do not use Noble.Settings.setup if you do not have any settings to register. New settings cannot be added via Noble.Settings.set and must be all declared upfront in the Noble.Settings.setup method.") - return - end - - local saveToDisk = Utilities.handleOptionalBoolean(__saveToDisk, true) - local modifyExistingOnKeyChange = Utilities.handleOptionalBoolean(__modifyExistingOnKeyChange, true) - settingsDefault = __keyValuePairs - - -- Get existing settings from disk, if any. - settings = Datastore.read("Settings") - - if (settings == nil) then - -- No settings on disk, so we create a new settings object using default values. - settings = table.deepcopy(settingsDefault) - elseif (modifyExistingOnKeyChange and keyChange(settingsDefault, settings)) then - -- Found settings on disk, but key changes have been made... - -- ...so we start with a new default settings object... - local existingSettings = table.deepcopy(settings) - settings = table.deepcopy(settingsDefault) - for key, value in pairs(settings) do - -- ...then copy settings with unchanged keys to the new settings object, - -- naturally discarding keys that don't exist anymore. - if (existingSettings[key] ~= nil) then settings[key] = existingSettings[key] end - end - - end - - if (saveToDisk) then - Noble.Settings.save() - end -end - ---- Get the value of a setting. --- @string __settingName The name of the setting. --- @treturn any The value of the requested setting. --- @see set -function Noble.Settings.get(__settingName) - if (settingExists(__settingName)) then - return settings[__settingName] - end -end - ---- Set the value of a setting. --- --- NOTE: If __settingName is not a key in the __keyValuePairs dictionary given to the `setup` method it will not be added to the Settings. --- @string __settingName The name of the setting. --- @tparam any __value The setting's new value --- @bool[opt=true] __saveToDisk Saves to disk immediately. Set to false if you prefer to manually save (via a confirm button, etc). --- @see setup --- @see get --- @see save -function Noble.Settings.set(__settingName, __value, __saveToDisk) - if (settingExists(__settingName)) then - settings[__settingName] = __value - local saveToDisk = Utilities.handleOptionalBoolean(__saveToDisk, true) - if (saveToDisk) then Noble.Settings.save() end - end -end - ---- Resets the value of a setting to its default value defined in `setup()`. --- @string __settingName The name of the setting. --- @bool[opt=true] __saveToDisk Saves to disk immediately. Set to false if you prefer to manually save (via a confirm button, etc). --- @see resetSome --- @see resetAll --- @see save -function Noble.Settings.reset(__settingName, __saveToDisk) - if (settingExists(__settingName)) then - settings[__settingName] = settingsDefault[__settingName] - local saveToDisk = Utilities.handleOptionalBoolean(__saveToDisk, true) - if (saveToDisk) then Noble.Settings.save() end - end -end - ---- Resets the value of multiple settings to thier default value defined in `setup()`. This is useful if you are storing persistant stats like high scores in `Settings` and want the player to be able to reset them seperately. --- @tparam table __settingNames The names of the settings, in an array-style table. --- @bool[opt=true] __saveToDisk Saves to disk immediately. Set to false if you prefer to manually save (via a confirm button, etc). --- @see resetAll --- @see save -function Noble.Settings.resetSome(__settingNames, __saveToDisk) - for i = 1, #__settingNames, 1 do - Noble.Settings.reset(__settingNames[i], __saveToDisk) - end -end - ---- Resets all settings to thier default values defined in `setup()`. --- @bool[opt=true] __saveToDisk Saves to disk immediately. Set to false if you prefer to manually save (via a confirm button, etc). --- @see resetSome --- @see save -function Noble.Settings.resetAll(__saveToDisk) - settings = table.deepcopy(settingsDefault) - local saveToDisk = Utilities.handleOptionalBoolean(__saveToDisk, true) - if (saveToDisk) then Noble.Settings.save() end -end - ---- Saves settings to disk. --- You don't need to call this unless you set `__saveToDisk` as false when setting or resetting a setting (say that five times fast!). --- @see set --- @see reset --- @see resetAll -function Noble.Settings.save() - Datastore.write(settings, "Settings") -end diff --git a/source/libraries/noble/modules/Noble.Text.lua b/source/libraries/noble/modules/Noble.Text.lua deleted file mode 100644 index f910c95..0000000 --- a/source/libraries/noble/modules/Noble.Text.lua +++ /dev/null @@ -1,74 +0,0 @@ ---- Text and font handling. --- @module Noble.Text -Noble.Text = {} - ---- Fonts --- --- You can use these fonts in your project, or override them with your own if you wish. --- @section fonts --- @usage --- Noble.Text.FONT_SMALL = Graphics.font.new("assets/fonts/MySmallFont") --- Noble.Text.setFont(Noble.Text.FONT_SMALL) - ---- The Playdate system font. -Noble.Text.FONT_SYSTEM = Graphics.getSystemFont() ---- Noble Sans: A sans-serif 8×9 font, with English and Japanese-Kana character sets. -Noble.Text.FONT_SMALL = Graphics.font.new("libraries/noble/assets/fonts/NobleSans") ---- Noble Slab: (This font is not ready yet!) -Noble.Text.FONT_MEDIUM = Graphics.font.new("libraries/noble/assets/fonts/NobleSlab") ---- Satchel Roughed: A sans-serif 17×14 rounded font, with an English character set. -Noble.Text.FONT_LARGE = Graphics.font.new("libraries/noble/assets/fonts/SatchelRoughed") - ---- Constants ---@section constants - ---- An alternate way to call Playdate SDK's `kTextAlignment.left` -Noble.Text.ALIGN_LEFT = kTextAlignment.left ---- An alternate way to call Playdate SDK's `kTextAlignment.right` -Noble.Text.ALIGN_RIGHT = kTextAlignment.right ---- An alternate way to call Playdate SDK's `kTextAlignment.center` -Noble.Text.ALIGN_CENTER = kTextAlignment.center - -local currentFont = Noble.Text.FONT_SYSTEM - - ---- Functions ---@section functions - ---- --- @return The currently set font. -function Noble.Text.getCurrentFont() - return currentFont -end - ---- Set the current font --- @param __font any --- @param __variant any -function Noble.Text.setFont(__font, __variant) - currentFont = __font - local variant = __variant or Graphics.font.kVariantNormal - Graphics.setFont(__font, variant) -end - ---- Abstracts multiple `playdate.text` drawing functions into one. --- @string __string Display text or localization key. --- @number __x --- @number __y --- @param[opt=Noble.Text.ALIGN_LEFT] __alignment Left, right, or center! --- @bool[opt=false] __localized If true, `__string` is a localization key rather than display text. --- @param[opt=Noble.Text.getCurrentFont()] __font A font to use. If not set, the `currentFont` is used. If set, the `currentFont` is not updated. -function Noble.Text.draw(__string, __x, __y, __alignment, __localized, __font) - local alignment = __alignment or Noble.Text.ALIGN_LEFT - local localized = Utilities.handleOptionalBoolean(__localized, false) - local string = __string or "" - - if (__font ~= nil) then Graphics.setFont(__font) end -- Temporary font - - if (localized) then - Graphics.drawLocalizedTextAligned(string, __x, __y, alignment) - else - Graphics.drawTextAligned(string, __x, __y, alignment) - end - - if (__font ~= nil) then Graphics.setFont(currentFont) end -- Reset -end diff --git a/source/libraries/noble/modules/Noble.Transition.lua b/source/libraries/noble/modules/Noble.Transition.lua deleted file mode 100644 index 728811e..0000000 --- a/source/libraries/noble/modules/Noble.Transition.lua +++ /dev/null @@ -1,208 +0,0 @@ ---- An abstract class from which transition types are extended. --- @module Noble.Transition - -Noble.Transition = {} -class("Transition", nil, Noble).extends() - -Noble.Transition.Type = {} - ---- A transition type where no time at all passes between scenes. --- @see Noble.Transition.Cut -Noble.Transition.Type.CUT = "Cut" - ---- A transition type that has an "Enter" phase and an "Exit" phase. The new scene does not become active until the Enter phase is complete. A "holdTime" value determines how long to wait after the Enter phase completes before starting the Exit phase. --- @see Noble.Transition.Dip --- @see Noble.Transition.Imagetable --- @see Noble.Transition.Spotlight -Noble.Transition.Type.COVER = "Cover" - ---- A transition type that takes a screenshot of the exiting scene and activates the new scene before beginning the transition, allowing for both scenes to appear to be visible during the transition. --- @see Noble.Transition.CrossDissolve --- @see Noble.Transition.SlideOff --- @see Noble.Transition.ImagetableMask -Noble.Transition.Type.MIX = "Mix" - ---- A transition may have unique properties that can be set by the user when invoked. This table holds the default values for those properties. --- @see setDefaultProperties -Noble.Transition.defaultProperties = {} - -function Noble.Transition:init(__duration, __arguments) - - self.duration = __duration or Noble.getConfig().defaultTransitionDuration - - self.durationEnter = __arguments.durationEnter or self.duration/2 - self.durationExit = __arguments.durationExit or self.duration/2 - - if (__arguments.durationEnter and not __arguments.durationExit) then - warn("Soft-BONK: You've specified 'durationEnter' but not 'durationExit' for this transition. Thus, 'durationExit' will be half the value of 'duration'. Did you intend to do that?") - elseif (__arguments.durationExit and not __arguments.durationEnter) then - warn("Soft-BONK: You've specified 'durationExit' but not 'durationEnter' for this transition. Thus, 'durationEnter' will be half the value of 'duration'. Did you intend to do that?") - end - - self.sequence = nil - - self._captureScreenshotsDuringTransition = self._captureScreenshotsDuringTransition or false - - self.midpointReached = false - self.holdTimeElapsed = false - - self.drawMode = self.drawMode or __arguments.drawMode or Graphics.kDrawModeCopy - - self.holdTime = self.holdTime or __arguments.holdTime or self.defaultProperties.holdTime or 0 - - if (self._type == Noble.Transition.Type.MIX) then - - self._sequenceStartValue = self._sequenceStartValue or 0 - self._sequenceCompleteValue = self._sequenceCompleteValue or 1 - - self.ease = self.ease or __arguments.ease or self.defaultProperties.ease or Ease.linear - if ((__arguments.easeEnter or __arguments.easeExit) ~= nil) then - warn("BONK: You've specified an 'easeEnter' and/or 'easeExit' argument for a transition of type 'Noble.Transition.Type.MIX'. This will have no effect. Use 'ease' instead, or specify a transition of type 'Noble.Transition.Type.COVER'.") - end - - self.oldSceneScreenshot = Utilities.screenshot() - - elseif (self._type == Noble.Transition.Type.COVER) then - - self._sequenceStartValue = self._sequenceStartValue or 0 - self._sequenceMidpointValue = self._sequenceMidpointValue or 1 - self._sequenceResumeValue = self._sequenceResumeValue or 1 - self._sequenceCompleteValue = self._sequenceCompleteValue or 0 - - local ease = self.ease or __arguments.ease or self.defaultProperties.ease or Ease.linear - if (ease) then - self.easeEnter = self.easeEnter or self.defaultProperties.easeEnter or Ease.enter(ease) or ease - self.easeExit = self.easeExit or self.defaultProperties.easeExit or Ease.exit(ease) or ease - if (Ease.enter(ease) == nil or Ease.exit(ease) == nil) then - warn("Soft-BONK: You've specified an 'ease' value for a transition of type 'Noble.Transition.Type.COVER' that isn't in the form of 'Ease.inOutXxxx' or an 'Ease.outInXxxx'. As a result, this value will be used for both 'easeEnter' and 'easeExit'. Did you mean to do that?") - end - else - self.easeEnter = self.easeEnter or __arguments.easeEnter or self.defaultProperties.easeEnter or self.easeEnter or Ease.linear - self.easeExit = self.easeExit or __arguments.easeExit or self.defaultProperties.easeExit or self.easeExit or Ease.linear - end - - end - - self:setProperties(__arguments) - -end - ---- Use this to modify multiple default properties of a transition. Having default properties avoids having to set them every time a transition is called. --- Properties added here are merged with the existing default properties table. Overwrites only happen when a new value is set. --- @usage --- Noble.Transition.setDefaultProperties(Noble.Transition.CrossDissolve, { --- dither = Graphics.image.kDitherTypeDiagonalLine --- ease = Ease.outQuint --- }) --- Noble.Transition.setDefaultProperties(Noble.Transition.SpotlightMask, { --- x = 325, --- y = 95, --- invert = true --- }) --- @see defaultProperties -function Noble.Transition.setDefaultProperties(__transition, __properties) - table.merge(__transition.defaultProperties, __properties) -end - -function Noble.Transition:execute() - - local onStart = function() - Noble.transitionStartHandler() - self:onStart() -- If this transition has any custom code to run here, run it. - end - - local onMidpoint = function() - Noble.transitionMidpointHandler() - self.midpointReached = true - self:onMidpoint() -- If this transition has any custom code to run here, run it. - end - - local onHoldTimeElapsed = function() - self.holdTimeElapsed = true - self:onHoldTimeElapsed() - end - - local onComplete = function() - self:onComplete() -- If this transition has any custom code to run here, run it. - Noble.transitionCompleteHandler() - end - - local type = self._type - local holdTime = self.holdTime - - if (type == Noble.Transition.Type.CUT) then - onStart() - onMidpoint() - onHoldTimeElapsed() - onComplete() - elseif (type == Noble.Transition.Type.COVER) then - onStart() - self.sequence = Sequence.new() - :from(self._sequenceStartValue) - :to(self._sequenceMidpointValue, self.durationEnter-(holdTime/2), self.easeEnter) - :callback(onMidpoint) - :sleep(holdTime) - :callback(onHoldTimeElapsed) - :to(self._sequenceResumeValue, 0) - :to(self._sequenceCompleteValue, self.durationExit-(holdTime/2), self.easeExit) - :callback(onComplete) - :start() - elseif (type == Noble.Transition.Type.MIX) then - onStart() - onMidpoint() - onHoldTimeElapsed() - self.sequence = Sequence.new() - :from(self._sequenceStartValue) - :to(self._sequenceCompleteValue, self.duration, self.ease) - :callback(onComplete) - :start() - end - -end - ---- *Do not call this directly.* Implement this in a custom transition in order to set properties from user arguments given in `Noble.transition()`. See existing transitions for implementation examples. --- @see Noble.transition -function Noble.Transition:setProperties(__arguments) end - ---- *Do not call this directly.* Implement this in a custom transition in order to run custom code when the transition starts. Default transitions in Noble Engine do not use this. -function Noble.Transition:onStart() end - ---- *Do not call this directly.* Implement this in a custom transition in order to run custom code when the transition reaches its midpoint. Default transitions in Noble Engine do not use this. -function Noble.Transition:onMidpoint() end - ---- *Do not call this directly.* Implement this in a custom transition in order to run custom code when the transition's hold time has elapsed. Default transitions in Noble Engine do not use this. -function Noble.Transition:onHoldTimeElapsed() end - ---- *Do not call this directly.* Implement this in a custom transition in order to run custom code when the transition completes. Default transitions in Noble Engine do not use this. -function Noble.Transition:onComplete() end - ---- *Do not call this directly.* Implement this in a custom transition to draw the transition. This runs once per frame while the transition is running. See existing transitions for implementation examples. -function Noble.Transition:draw() end - - --- Noble Engine built-in transitions. -import 'libraries/noble/modules/Noble.Transition/Cut.lua' --- -import 'libraries/noble/modules/Noble.Transition/CrossDissolve.lua' -import 'libraries/noble/modules/Noble.Transition/Dip.lua' -import 'libraries/noble/modules/Noble.Transition/DipToBlack.lua' -import 'libraries/noble/modules/Noble.Transition/DipToWhite.lua' --- -import 'libraries/noble/modules/Noble.Transition/Imagetable.lua' -import 'libraries/noble/modules/Noble.Transition/ImagetableMask.lua' -import 'libraries/noble/modules/Noble.Transition/Spotlight.lua' -import 'libraries/noble/modules/Noble.Transition/SpotlightMask.lua' --- -import 'libraries/noble/modules/Noble.Transition/SlideOff.lua' -import 'libraries/noble/modules/Noble.Transition/SlideOffLeft.lua' -import 'libraries/noble/modules/Noble.Transition/SlideOffRight.lua' -import 'libraries/noble/modules/Noble.Transition/SlideOffUp.lua' -import 'libraries/noble/modules/Noble.Transition/SlideOffDown.lua' -import 'libraries/noble/modules/Noble.Transition/SlideOn.lua' -import 'libraries/noble/modules/Noble.Transition/SlideOnLeft.lua' -import 'libraries/noble/modules/Noble.Transition/SlideOnRight.lua' -import 'libraries/noble/modules/Noble.Transition/SlideOnUp.lua' -import 'libraries/noble/modules/Noble.Transition/SlideOnDown.lua' --- -import 'libraries/noble/modules/Noble.Transition/MetroNexus.lua' -import 'libraries/noble/modules/Noble.Transition/WidgetSatchel.lua' \ No newline at end of file diff --git a/source/libraries/noble/modules/Noble.Transition/CrossDissolve.lua b/source/libraries/noble/modules/Noble.Transition/CrossDissolve.lua deleted file mode 100644 index b89a5c0..0000000 --- a/source/libraries/noble/modules/Noble.Transition/CrossDissolve.lua +++ /dev/null @@ -1,26 +0,0 @@ ---- --- @submodule Noble.Transition - -class("CrossDissolve", nil, Noble.Transition).extends(Noble.Transition) -local transition = Noble.Transition.CrossDissolve -transition.name = "Cross Dissolve" - --- Type -transition._type = Noble.Transition.Type.MIX - ---- A simple cross-fade. --- @table Noble.Transition.CrossDissolve.defaultProperties --- @tparam[opt=Ease.outCubic] Ease ease --- @tparam[opt=Graphics.image.kDitherTypeBayer4x4] Graphics.image.kDither dither -transition.defaultProperties = { - ease = Ease.outCubic, - dither = Graphics.image.kDitherTypeBayer4x4 -} - -function transition:setProperties(__properties) - self.dither = __properties.dither or self.defaultProperties.dither -end - -function transition:draw() - self.oldSceneScreenshot:drawFaded(0, 0, 1 - self.sequence:get(), self.dither) -end \ No newline at end of file diff --git a/source/libraries/noble/modules/Noble.Transition/Cut.lua b/source/libraries/noble/modules/Noble.Transition/Cut.lua deleted file mode 100644 index 0413b81..0000000 --- a/source/libraries/noble/modules/Noble.Transition/Cut.lua +++ /dev/null @@ -1,13 +0,0 @@ ---- --- @submodule Noble.Transition - -class("Cut", nil, Noble.Transition).extends(Noble.Transition) -local transition = Noble.Transition.Cut -transition.name = "Cut" - --- Properties -transition._type = Noble.Transition.Type.CUT - ---- An all-time classic. --- This transition has no properties. --- @table Noble.Transition.Cut.defaultProperties \ No newline at end of file diff --git a/source/libraries/noble/modules/Noble.Transition/Dip.lua b/source/libraries/noble/modules/Noble.Transition/Dip.lua deleted file mode 100644 index 367313b..0000000 --- a/source/libraries/noble/modules/Noble.Transition/Dip.lua +++ /dev/null @@ -1,37 +0,0 @@ ---- --- @submodule Noble.Transition - -class("Dip", nil, Noble.Transition).extends(Noble.Transition) -local transition = Noble.Transition.Dip -transition.name = "Dip" - --- Type -transition._type = Noble.Transition.Type.COVER - ---- Fade to an image, then to the next scene. --- @table Noble.Transition.Dip.defaultProperties --- @number[opt=0.25] holdTime --- @tparam Graphics.image panelImage --- @tparam[opt=Graphics.image.kDitherTypeBayer4x4] Graphics.image.kDither dither --- @tparam[opt=Ease.outInQuad] Ease ease --- @number[opt=0] x --- @number[opt=0] y -transition.defaultProperties = { - holdTime = 0.25, - ease = Ease.outInQuad, - dither = Graphics.image.kDitherTypeBayer4x4, - panelImage = nil, - x = 0, - y = 0 -} - -function transition:setProperties(__arguments) - self.dither = __arguments.dither or self.defaultProperties.dither - self.panelImage = __arguments.panelImage or self.defaultProperties.panelImage - self.x = __arguments.x or self.defaultProperties.x - self.y = __arguments.y or self.defaultProperties.y -end - -function transition:draw() - self.panelImage:drawFaded(self.x, self.y, self.sequence:get(), self.dither) -end \ No newline at end of file diff --git a/source/libraries/noble/modules/Noble.Transition/DipToBlack.lua b/source/libraries/noble/modules/Noble.Transition/DipToBlack.lua deleted file mode 100644 index 9b3d0be..0000000 --- a/source/libraries/noble/modules/Noble.Transition/DipToBlack.lua +++ /dev/null @@ -1,19 +0,0 @@ ---- --- @submodule Noble.Transition - -class("DipToBlack", nil, Noble.Transition).extends(Noble.Transition.Dip) -local transition = Noble.Transition.DipToBlack -transition.name = "Dip to Black" - ---- Fade to black, then to the next scene. --- NOTE: The `panelImage` property is locked. --- @see Noble.Transition.Dip.defaultProperties --- @table Noble.Transition.DipToBlack.defaultProperties - -transition.panelImage = Graphics.image.new(400, 240, Graphics.kColorBlack) - -function transition:setCustomArguments(__arguments) - transition.super.setCustomArguments(self, __arguments) - self.x = 0 - self.y = 0 -end \ No newline at end of file diff --git a/source/libraries/noble/modules/Noble.Transition/DipToWhite.lua b/source/libraries/noble/modules/Noble.Transition/DipToWhite.lua deleted file mode 100644 index fc101ac..0000000 --- a/source/libraries/noble/modules/Noble.Transition/DipToWhite.lua +++ /dev/null @@ -1,19 +0,0 @@ ---- --- @submodule Noble.Transition - -class("DipToWhite", nil, Noble.Transition).extends(Noble.Transition.Dip) -local transition = Noble.Transition.DipToWhite -transition.name = "Dip to White" - ---- Fade to white, then to the next scene. --- NOTE: The `panelImage` property is locked. --- @see Noble.Transition.Dip.defaultProperties --- @table Noble.Transition.DipToWhite.defaultProperties - -transition.panelImage = Graphics.image.new(400, 240, Graphics.kColorWhite) - -function transition:setCustomArguments(__arguments) - transition.super.setCustomArguments(self, __arguments) - self.x = 0 - self.y = 0 -end \ No newline at end of file diff --git a/source/libraries/noble/modules/Noble.Transition/Imagetable.lua b/source/libraries/noble/modules/Noble.Transition/Imagetable.lua deleted file mode 100644 index 64c402a..0000000 --- a/source/libraries/noble/modules/Noble.Transition/Imagetable.lua +++ /dev/null @@ -1,131 +0,0 @@ ---- --- @submodule Noble.Transition - -class("Imagetable", nil, Noble.Transition).extends(Noble.Transition) -local transition = Noble.Transition.Imagetable -transition.name = "Imagetable" - --- Type -transition._type = Noble.Transition.Type.COVER - --- Overrides -transition.easeEnter = Ease.linear -transition.easeExit = Ease.linear - ---- A dip-style transition using one or two imagetables. --- @see Noble.Transition.ImagetableMask.defaultProperties --- @table Noble.Transition.Imagetable.defaultProperties --- @number[opt=0] holdTime --- @tparam Graphics.imagetable imagetable --- @bool[opt=false] reverse --- @bool[opt=false] flipX --- @bool[opt=false] flipY --- @bool[opt=false] rotate --- @tparam Graphics.imagetable imagetableEnter --- @bool[opt=nil] reverseEnter --- @bool[opt=nil] flipXEnter --- @bool[opt=nil] flipYEnter --- @bool[opt=nil] rotateEnter --- @tparam Graphics.imagetable imagetableExit --- @bool[opt=nil] reverseExit --- @bool[opt=nil] flipXExit --- @bool[opt=nil] flipYExit --- @bool[opt=nil] rotateExit -transition.defaultProperties = { - holdTime = 0, - imagetable = nil, - imagetableEnter = Graphics.imagetable.new("libraries/noble/assets/images/BoltTransitionEnter"), - imagetableExit = Graphics.imagetable.new("libraries/noble/assets/images/BoltTransitionExit"), - reverse = false, - reverseEnter = nil, - reverseExit = nil, - flipX = false, - flipY = false, - flipXEnter = nil, - flipYEnter = nil, - flipXExit = nil, - flipYExit = nil, - rotate = false, - rotateEnter = nil, - rotateExit = nil, -} - -function transition:setProperties(__properties) - - self.imagetable = __properties.imagetable or self.defaultProperties.imagetable - self.imagetableEnter = __properties.imagetableEnter or self.defaultProperties.imagetableEnter or self.imagetable - self.imagetableExit = __properties.imagetableExit or self.defaultProperties.imagetableExit or self.imagetable - - self.reverse = __properties.reverse or self.defaultProperties.reverse - self.reverseEnter = __properties.reverseEnter or self.defaultProperties.reverseEnter or self.reverse - self.reverseExit = __properties.reverseExit or self.defaultProperties.reverseExit or self.reverse - - self.flipX = __properties.flipX or self.defaultProperties.flipX - self.flipY = __properties.flipY or self.defaultProperties.flipY - self.flipXEnter = __properties.flipXEnter or self.defaultProperties.flipXEnter or self.flipX - self.flipYEnter = __properties.flipYEnter or self.defaultProperties.flipYEnter or self.flipY - self.flipXExit = __properties.flipXExit or self.defaultProperties.flipXExit or self.flipX - self.flipYExit = __properties.flipYExit or self.defaultProperties.flipYExit or self.flipY - - self.rotate = __properties.rotate or self.defaultProperties.rotate - self.rotateEnter = __properties.rotateEnter or self.defaultProperties.rotateEnter or self.rotate - self.rotateExit = __properties.rotateExit or self.defaultProperties.rotateExit or self.rotate - - -- "Private" variables - self._frameCountEnter = self.imagetableEnter and #self.imagetableEnter or 0 - self._frameCountExit = self.imagetableExit and #self.imagetableExit or 0 - - self._flipValueEnter = Noble.Transition.Imagetable.getFlipValue(self.rotateEnter, self.flipXEnter, self.flipYEnter) - self._flipValueExit = Noble.Transition.Imagetable.getFlipValue(self.rotateExit, self.flipXExit, self.flipYExit) - - local sequence0 = (not self.reverseEnter) and 0 or 1 - local sequence1 = (not self.reverseEnter) and 1 or 0 - local sequenceExit0 = (not self.reverseExit) and 0 or 1 - local sequenceExit1 = (not self.reverseExit) and 1 or 0 - - if (self.imagetableEnter == self.imagetableExit) then - self._sequenceStartValue = sequence0 - self._sequenceMidpointValue = sequence1 - self._sequenceResumeValue = sequence1 - self._sequenceCompleteValue = sequence0 - else - self._sequenceStartValue = sequence0 - self._sequenceMidpointValue = sequence1 - self._sequenceResumeValue = sequenceExit0 - self._sequenceCompleteValue = sequenceExit1 - end - - -- Warnings - if ((__properties.ease or __properties.easeEnter or __properties.easeExit) ~= nil) then - warn("BONK: You've specified an ease value for an Noble.Transition.Imagetable transition. This will have no effect.") - end - -end - -function transition:draw() - local progress = self.sequence:get() - local imagetable - local frameCount - local flipValue - if not self.holdTimeElapsed then - imagetable = self.imagetableEnter - frameCount = self._frameCountEnter - flipValue = self._flipValueEnter - else - imagetable = self.imagetableExit - frameCount = self._frameCountExit - flipValue = self._flipValueExit - end - local index = math.clamp((progress * frameCount) // 1, 1, frameCount) - imagetable[index]:draw(0, 0, flipValue) -end - -function Noble.Transition.Imagetable.getFlipValue(__rotate, __flipX, __flipY) - if(__rotate or (__flipX and __flipY)) then - return Graphics.kImageFlippedXY - else - if(__flipX) then return Graphics.kImageFlippedX - elseif(__flipY) then return Graphics.kImageFlippedY end - end - return Graphics.kImageUnflipped -end \ No newline at end of file diff --git a/source/libraries/noble/modules/Noble.Transition/ImagetableMask.lua b/source/libraries/noble/modules/Noble.Transition/ImagetableMask.lua deleted file mode 100644 index 134d77d..0000000 --- a/source/libraries/noble/modules/Noble.Transition/ImagetableMask.lua +++ /dev/null @@ -1,83 +0,0 @@ ---- --- @submodule Noble.Transition - -class("ImagetableMask", nil, Noble.Transition).extends(Noble.Transition) -local transition = Noble.Transition.ImagetableMask -transition.name = "Imagetable Mask" - --- Type -transition._type = Noble.Transition.Type.MIX - --- Overrides -transition.ease = Ease.linear - ---- A wipe transition using an animated mask in the form of an imagetable. --- @see Noble.Transition.Imagetable.defaultProperties --- @table Noble.Transition.ImagetableMask.defaultProperties --- @tparam Graphics.imagetable imagetable --- @bool[opt=false] reverse Set `true` to play the imagetable's frames in reverse order. --- @bool[opt=false] flipX --- @bool[opt=false] flipY --- @bool[opt=false] rotate Set as `true` to rotate the image 180-degrees --- @bool[opt=true] hasTransparency Set as `true` if the imagetable asset has transparent pixels. Set as `false` if the image uses white pixels for transparency. --- @bool[opt=false] invert Set as `true` to invert the image mask. -transition.defaultProperties = { - imagetable = Graphics.imagetable.new("libraries/noble/assets/images/BoltTransitionEnter"), - reverse = false, - flipX = false, - flipY = false, - rotate = false, - hasTransparency = true, - invert = false -} - -function transition:setProperties(__properties) - - self.imagetable = __properties.imagetable or self.defaultProperties.imagetable - self.reverse = __properties.reverse or self.defaultProperties.reverse - self.flipX = __properties.flipX or self.defaultProperties.flipX - self.flipY = __properties.flipY or self.defaultProperties.flipY - self.rotate = __properties.rotate or self.defaultProperties.rotate - self.hasTransparency = __properties.hasTransparency or self.defaultProperties.hasTransparency - self.invert = __properties.invert or self.defaultProperties.invert - - -- "Private" variables - self._flipValue = Noble.Transition.Imagetable.getFlipValue(self.rotate, self.flipX, self.flipY) - self._imagetableLength = self.imagetable and #self.imagetable or 0 - self._maskBackground = nil - self._maskForegroundDrawMode = nil - if (self.invert ~= true) then - self._maskBackground = Graphics.image.new(400, 240, Graphics.kColorWhite) - self._maskForegroundDrawMode = Graphics.kDrawModeFillBlack - else - self._maskBackground = Graphics.image.new(400, 240, Graphics.kColorBlack) - self._maskForegroundDrawMode = Graphics.kDrawModeFillWhite - end - - -- Warnings - if (__properties.imagetableExit ~= nil) then - warn("BONK: You've specified an 'imagetableExit' for an Noble.Transition.ImagetableMask transition. This will have no effect. ") - end - if ((__properties.ease or __properties.easeEnter or __properties.easeExit) ~= nil) then - warn("BONK: You've specified an ease value for an Noble.Transition.ImagetableMask transition. This will have no effect.") - end - -end - -function transition:draw() - local progress = self.sequence:get() - local length = self._imagetableLength - local index = math.clamp((progress * length) // 1, 1, length) - local mask = Graphics.image.new(400, 240) - - Graphics.pushContext(mask) - Graphics.setImageDrawMode(Graphics.kDrawModeCopy) - self._maskBackground:draw(0,0) - if (self.hasTransparency) then Graphics.setImageDrawMode(self._maskForegroundDrawMode) end - self.imagetable[index]:draw(0,0, self._flipValue) - Graphics.popContext() - - self.oldSceneScreenshot:setMaskImage(mask) - self.oldSceneScreenshot:draw(0,0) - -end \ No newline at end of file diff --git a/source/libraries/noble/modules/Noble.Transition/MetroNexus.lua b/source/libraries/noble/modules/Noble.Transition/MetroNexus.lua deleted file mode 100644 index bfb46a7..0000000 --- a/source/libraries/noble/modules/Noble.Transition/MetroNexus.lua +++ /dev/null @@ -1,58 +0,0 @@ ---- --- @submodule Noble.Transition - -class("MetroNexus", nil, Noble.Transition).extends(Noble.Transition) -local transition = Noble.Transition.MetroNexus -transition.name = "Metro Nexus" - --- Type -transition._type = Noble.Transition.Type.COVER - --- Overrides -transition._sequenceResumeValue = 0 -transition._sequenceCompleteValue = 1 -transition.easeEnter = Ease.linear -transition.easeExit = Ease.linear - ---- A "cascade" wipe transition, taken from "Metro Nexus" by Noble Robot. --- This transition has no properties. --- @table Noble.Transition.MetroNexus.defaultProperties - --- "Static" variables -local panels - -function transition:setProperties(__arguments) - - if (panels == nil) then - panels = { - Graphics.image.new(80,240, Graphics.kColorWhite), - Graphics.image.new(80,240, Graphics.kColorWhite), - Graphics.image.new(80,240, Graphics.kColorWhite), - Graphics.image.new(80,240, Graphics.kColorWhite), - Graphics.image.new(80,240, Graphics.kColorWhite) - } - end - - -- Warnings - if (__arguments.easeEnter or __arguments.easeEnter or __arguments.ease) then - warn("BONK: 'Noble.Transition.MetroNexus' does not support custom ease values.") - end - -end - -function transition:draw() - local progress = self.sequence:get() - if (not self.holdTimeElapsed) then - panels[1]:draw(000, (-1 + Ease.outQuint(progress, 0, 1, 1)) * 240) - panels[2]:draw(080, (-1 + Ease.outQuart(progress, 0, 1, 1)) * 240) - panels[3]:draw(160, (-1 + Ease.outQuart(progress, 0, 1, 1)) * 240) - panels[4]:draw(240, (-1 + Ease.outCubic(progress, 0, 1, 1)) * 240) - panels[5]:draw(320, (-1 + Ease.outSine (progress, 0, 1, 1)) * 240) - else - panels[1]:draw(000, (1 - Ease.inQuint(progress, 0, 1, 1)) * -240 + 240) - panels[2]:draw(080, (1 - Ease.inQuart(progress, 0, 1, 1)) * -240 + 240) - panels[3]:draw(160, (1 - Ease.inQuart(progress, 0, 1, 1)) * -240 + 240) - panels[4]:draw(240, (1 - Ease.inCubic(progress, 0, 1, 1)) * -240 + 240) - panels[5]:draw(320, (1 - Ease.inSine (progress, 0, 1, 1)) * -240 + 240) - end -end diff --git a/source/libraries/noble/modules/Noble.Transition/SlideOff.lua b/source/libraries/noble/modules/Noble.Transition/SlideOff.lua deleted file mode 100644 index ecfa2e4..0000000 --- a/source/libraries/noble/modules/Noble.Transition/SlideOff.lua +++ /dev/null @@ -1,38 +0,0 @@ ---- --- @submodule Noble.Transition - -class("SlideOff", nil, Noble.Transition).extends(Noble.Transition) -local transition = Noble.Transition.SlideOff -transition.name = "Slide Off" - --- Type -transition._type = Noble.Transition.Type.MIX - ---- The previous scene slides off the screen, revealing the next scene. --- @table Noble.Transition.SlideOff.defaultProperties --- @tparam[opt=Ease.outInQuad] Ease ease --- @number[opt=0] x --- @number[opt=0] y --- @number[opt=0] rotation -transition.defaultProperties = { - ease = Ease.inQuart, - x = 0, - y = 0, - rotation = 0 -} - -function transition:setProperties(__arguments) - self.x = __arguments.x or self.defaultProperties.x - self.y = __arguments.y or self.defaultProperties.y - self.rotation = __arguments.rotation or self.defaultProperties.rotation -end - -function transition:draw() - transition.super.draw(self) - local progress = self.sequence:get() - self.oldSceneScreenshot:drawRotated( - self.x * progress + 200, - self.y * progress + 120, - self.rotation * progress - ) -end \ No newline at end of file diff --git a/source/libraries/noble/modules/Noble.Transition/SlideOffDown.lua b/source/libraries/noble/modules/Noble.Transition/SlideOffDown.lua deleted file mode 100644 index 5a003b5..0000000 --- a/source/libraries/noble/modules/Noble.Transition/SlideOffDown.lua +++ /dev/null @@ -1,18 +0,0 @@ ---- --- @submodule Noble.Transition - -class("SlideOffDown", nil, Noble.Transition).extends(Noble.Transition.SlideOff) -local transition = Noble.Transition.SlideOffDown -transition.name = "Slide Off (Down)" - ---- The previous scene slides off the bottom of the screen, revealing the next scene. --- NOTE: The `x`, `y`, and `rotation` properties are locked. --- @see Noble.Transition.SlideOff.defaultProperties --- @table Noble.Transition.SlideOffDown.defaultProperties - -function transition:setProperties(__arguments) - transition.super.setProperties(self, __arguments) - self.x = 0 - self.y = 240 - self.rotation = 0 -end \ No newline at end of file diff --git a/source/libraries/noble/modules/Noble.Transition/SlideOffLeft.lua b/source/libraries/noble/modules/Noble.Transition/SlideOffLeft.lua deleted file mode 100644 index 732fec6..0000000 --- a/source/libraries/noble/modules/Noble.Transition/SlideOffLeft.lua +++ /dev/null @@ -1,18 +0,0 @@ ---- --- @submodule Noble.Transition - -class("SlideOffLeft", nil, Noble.Transition).extends(Noble.Transition.SlideOff) -local transition = Noble.Transition.SlideOffLeft -transition.name = "Slide Off (Left)" - ---- The previous scene slides off the left side of the screen, revealing the next scene. --- NOTE: The `x`, `y`, and `rotation` properties are locked. --- @see Noble.Transition.SlideOff.defaultProperties --- @table Noble.Transition.SlideOffLeft.defaultProperties - -function transition:setProperties(__arguments) - transition.super.setProperties(self, __arguments) - self.x = -400 - self.y = 0 - self.rotation = 0 -end \ No newline at end of file diff --git a/source/libraries/noble/modules/Noble.Transition/SlideOffRight.lua b/source/libraries/noble/modules/Noble.Transition/SlideOffRight.lua deleted file mode 100644 index 4dc3bd9..0000000 --- a/source/libraries/noble/modules/Noble.Transition/SlideOffRight.lua +++ /dev/null @@ -1,18 +0,0 @@ ---- --- @submodule Noble.Transition - -class("SlideOffRight", nil, Noble.Transition).extends(Noble.Transition.SlideOff) -local transition = Noble.Transition.SlideOffRight -transition.name = "Slide Off (Right)" - ---- The previous scene slides off the right side of the screen, revealing the next scene. --- NOTE: The `x`, `y`, and `rotation` properties are locked. --- @see Noble.Transition.SlideOff.defaultProperties --- @table Noble.Transition.SlideOffRight.defaultProperties - -function transition:setProperties(__arguments) - transition.super.setProperties(self, __arguments) - self.x = 400 - self.y = 0 - self.rotation = 0 -end \ No newline at end of file diff --git a/source/libraries/noble/modules/Noble.Transition/SlideOffUp.lua b/source/libraries/noble/modules/Noble.Transition/SlideOffUp.lua deleted file mode 100644 index 68a06a4..0000000 --- a/source/libraries/noble/modules/Noble.Transition/SlideOffUp.lua +++ /dev/null @@ -1,18 +0,0 @@ ---- --- @submodule Noble.Transition - -class("SlideOffUp", nil, Noble.Transition).extends(Noble.Transition.SlideOff) -local transition = Noble.Transition.SlideOffUp -transition.name = "Slide Off (Up)" - ---- The previous scene slides off the top of the screen, revealing the next scene. --- NOTE: The `x`, `y`, and `rotation` properties are locked. --- @see Noble.Transition.SlideOff.defaultProperties --- @table Noble.Transition.SlideOffUp.defaultProperties - -function transition:setProperties(__arguments) - transition.super.setProperties(self, __arguments) - self.x = 0 - self.y = -240 - self.rotation = 0 -end \ No newline at end of file diff --git a/source/libraries/noble/modules/Noble.Transition/SlideOn.lua b/source/libraries/noble/modules/Noble.Transition/SlideOn.lua deleted file mode 100644 index 202c17d..0000000 --- a/source/libraries/noble/modules/Noble.Transition/SlideOn.lua +++ /dev/null @@ -1,44 +0,0 @@ ---- --- @submodule Noble.Transition - -class("SlideOn", nil, Noble.Transition).extends(Noble.Transition) -local transition = Noble.Transition.SlideOn -transition.name = "Slide On" - --- Type -transition._type = Noble.Transition.Type.MIX - --- Overrides -transition._sequenceStartValue = 1 -transition._sequenceCompleteValue = 0 -transition._captureScreenshotsDuringTransition = true - ---- The next scene slides on the screen, covering up the previous scene. --- @table Noble.Transition.SlideOn.defaultProperties --- @tparam[opt=Ease.outInQuad] Ease ease --- @number[opt=0] x --- @number[opt=0] y --- @number[opt=0] rotation -transition.defaultProperties = { - ease = Ease.outQuart, - x = 0, - y = 0, - rotation = 0 -} - -function transition:setProperties(__arguments) - self.x = __arguments.x or self.defaultProperties.x - self.y = __arguments.y or self.defaultProperties.y - self.rotation = __arguments.rotation or self.defaultProperties.rotation -end - -function transition:draw() - transition.super.draw(self) - local progress = self.sequence:get() - self.oldSceneScreenshot:draw(0,0) - self.newSceneScreenshot:drawRotated( - self.x * progress + 200, - self.y * progress + 120, - self.rotation * progress - ) -end \ No newline at end of file diff --git a/source/libraries/noble/modules/Noble.Transition/SlideOnDown.lua b/source/libraries/noble/modules/Noble.Transition/SlideOnDown.lua deleted file mode 100644 index ff7e1ad..0000000 --- a/source/libraries/noble/modules/Noble.Transition/SlideOnDown.lua +++ /dev/null @@ -1,18 +0,0 @@ ---- --- @submodule Noble.Transition - -class("SlideOnDown", nil, Noble.Transition).extends(Noble.Transition.SlideOn) -local transition = Noble.Transition.SlideOnDown -transition.name = "Slide On (Down)" - ---- The next scene slides onto the screen from the top, covering up the previous scene. --- NOTE: The `x`, `y`, and `rotation` properties are locked. --- @see Noble.Transition.SlideOn.defaultProperties --- @table Noble.Transition.SlideOnDown.defaultProperties - -function transition:setProperties(__arguments) - transition.super.setProperties(self, __arguments) - self.x = 0 - self.y = -240 - self.rotation = 0 -end \ No newline at end of file diff --git a/source/libraries/noble/modules/Noble.Transition/SlideOnLeft.lua b/source/libraries/noble/modules/Noble.Transition/SlideOnLeft.lua deleted file mode 100644 index df0ac13..0000000 --- a/source/libraries/noble/modules/Noble.Transition/SlideOnLeft.lua +++ /dev/null @@ -1,18 +0,0 @@ ---- --- @submodule Noble.Transition - -class("SlideOnLeft", nil, Noble.Transition).extends(Noble.Transition.SlideOn) -local transition = Noble.Transition.SlideOnLeft -transition.name = "Slide On (Left)" - ---- The next scene slides onto the screen right-to-left, covering up the previous scene. --- NOTE: The `x`, `y`, and `rotation` properties are locked. --- @see Noble.Transition.SlideOn.defaultProperties --- @table Noble.Transition.SlideOnLeft.defaultProperties - -function transition:setProperties(__arguments) - transition.super.setProperties(self, __arguments) - self.x = 400 - self.y = 0 - self.rotation = 0 -end \ No newline at end of file diff --git a/source/libraries/noble/modules/Noble.Transition/SlideOnRight.lua b/source/libraries/noble/modules/Noble.Transition/SlideOnRight.lua deleted file mode 100644 index dbbe2c7..0000000 --- a/source/libraries/noble/modules/Noble.Transition/SlideOnRight.lua +++ /dev/null @@ -1,18 +0,0 @@ ---- --- @submodule Noble.Transition - -class("SlideOnRight", nil, Noble.Transition).extends(Noble.Transition.SlideOn) -local transition = Noble.Transition.SlideOnRight -transition.name = "Slide On (Right)" - ---- The next scene slides onto the screen left-to-right, covering up the previous scene. --- NOTE: The `x`, `y`, and `rotation` properties are locked. --- @see Noble.Transition.SlideOn.defaultProperties --- @table Noble.Transition.SlideOnRight.defaultProperties - -function transition:setProperties(__arguments) - transition.super.setProperties(self, __arguments) - self.x = -400 - self.y = 0 - self.rotation = 0 -end \ No newline at end of file diff --git a/source/libraries/noble/modules/Noble.Transition/SlideOnUp.lua b/source/libraries/noble/modules/Noble.Transition/SlideOnUp.lua deleted file mode 100644 index 701a94a..0000000 --- a/source/libraries/noble/modules/Noble.Transition/SlideOnUp.lua +++ /dev/null @@ -1,18 +0,0 @@ ---- --- @submodule Noble.Transition - -class("SlideOnUp", nil, Noble.Transition).extends(Noble.Transition.SlideOn) -local transition = Noble.Transition.SlideOnUp -transition.name = "Slide On (Up)" - ---- The next scene slides onto the screen from the bottom, covering up the previous scene. --- NOTE: The `x`, `y`, and `rotation` properties are locked. --- @see Noble.Transition.SlideOn.defaultProperties --- @table Noble.Transition.SlideOnUp.defaultProperties - -function transition:setProperties(__arguments) - transition.super.setProperties(self, __arguments) - self.x = 0 - self.y = 240 - self.rotation = 0 -end \ No newline at end of file diff --git a/source/libraries/noble/modules/Noble.Transition/Spotlight.lua b/source/libraries/noble/modules/Noble.Transition/Spotlight.lua deleted file mode 100644 index 745ecee..0000000 --- a/source/libraries/noble/modules/Noble.Transition/Spotlight.lua +++ /dev/null @@ -1,100 +0,0 @@ ---- --- @submodule Noble.Transition - -class("Spotlight", nil, Noble.Transition).extends(Noble.Transition) -local transition = Noble.Transition.Spotlight -transition.name = "Spotlight" - --- Type -transition._type = Noble.Transition.Type.COVER - ---- A spotlight in-out transition. --- @see Noble.Transition.SpotlightMask.defaultProperties --- @table Noble.Transition.Spotlight.defaultProperties --- @number[opt=0.25] holdTime --- @tparam Graphics.image panelImage --- @tparam[opt=Graphics.image.kDitherTypeBayer4x4] Graphics.image.kDither dither --- @tparam[opt=Ease.outInQuad] Ease ease --- @number[opt=200] x --- @number[opt=120] y --- @tparam[opt=nil] Ease easeEnter --- @number[opt=nil] xEnter --- @number[opt=nil] yEnter --- @number[opt=nil] xEnterStart --- @number[opt=nil] yEnterStart --- @number[opt=nil] xEnterEnd --- @number[opt=nil] yEnterEnd --- @tparam[opt=nil] Ease easeEnter --- @number[opt=nil] xExit --- @number[opt=nil] yExit --- @number[opt=nil] xExitStart --- @number[opt=nil] yExitStart --- @number[opt=nil] xExitEnd --- @number[opt=nil] yExitEnd -transition.defaultProperties = { - holdTime = 0.25, - panelImage = nil, - dither = Graphics.image.kDitherTypeBayer4x4, - ease = Ease.outInQuad, - x = 200, - y = 120, - easeEnter = nil, - xEnter = nil, - yEnter = nil, - xEnterStart = nil, - yEnterStart = nil, - xEnterEnd = nil, - yEnterEnd = nil, - easeExit = nil, - xExit = nil, - yExit = nil, - xExitStart = nil, - yExitStart = nil, - xExitEnd = nil, - yExitEnd = nil -} - --- "Static" variables -local defaultPanelImage - -function transition:setProperties(__arguments) - if (defaultPanelImage == nil) then defaultPanelImage = Graphics.image.new(400,240, Graphics.kColorBlack) end - self.panelImage = __arguments.panelImage or self.defaultProperties.panelImage or defaultPanelImage - self.dither = __arguments.dither or self.defaultProperties.dither - self.x = __arguments.x or self.defaultProperties.x - self.y = __arguments.y or self.defaultProperties.y - - self.xEnter = __arguments.xEnter or self.defaultProperties.xEnter or self.x - self.yEnter = __arguments.yEnter or self.defaultProperties.yEnter or self.y - self.xEnterStart = __arguments.xEnterStart or self.defaultProperties.xEnterStart or self.xEnter - self.yEnterStart = __arguments.yEnterStart or self.defaultProperties.yEnterStart or self.yEnter - self.xEnterEnd = __arguments.xEnterEnd or self.defaultProperties.xEnterEnd or self.xEnter - self.yEnterEnd = __arguments.yEnterEnd or self.defaultProperties.yEnterEnd or self.yEnter - - self.xExit = __arguments.xExit or self.defaultProperties.xExit or self.x - self.yExit = __arguments.yExit or self.defaultProperties.yExit or self.y - self.xExitStart = __arguments.xExitStart or self.defaultProperties.xExitStart or self.xExit - self.yExitStart = __arguments.yExitStart or self.defaultProperties.yExitStart or self.yExit - self.xExitEnd = __arguments.xExitEnd or self.defaultProperties.xExitEnd or self.xExit - self.yExitEnd = __arguments.yExitEnd or self.defaultProperties.yExitEnd or self.yExit -end - -function transition:draw() - local progress = self.sequence:get() - self.panelImage:drawFaded(0, 0, progress, self.dither) - Graphics.setColor(Graphics.kColorClear) - if (not self.midpointReached) then - Graphics.fillCircleAtPoint( - math.lerp(self.xEnterStart, self.xEnterEnd, progress), - math.lerp(self.yEnterStart, self.yEnterEnd, progress), - (1 - progress) * 233 - ) - else - Graphics.fillCircleAtPoint( - math.lerp(self.xExitStart, self.xExitEnd, progress), - math.lerp(self.yExitStart, self.yExitEnd, progress), - (1 - progress) * 233 - ) - end - Graphics.setColor(Graphics.kColorBlack) -end \ No newline at end of file diff --git a/source/libraries/noble/modules/Noble.Transition/SpotlightMask.lua b/source/libraries/noble/modules/Noble.Transition/SpotlightMask.lua deleted file mode 100644 index 11b16f0..0000000 --- a/source/libraries/noble/modules/Noble.Transition/SpotlightMask.lua +++ /dev/null @@ -1,99 +0,0 @@ ---- --- @submodule Noble.Transition - -class("SpotlightMask", nil, Noble.Transition).extends(Noble.Transition) -local transition = Noble.Transition.SpotlightMask -transition.name = "Spotlight Mask" - --- Type -transition._type = Noble.Transition.Type.MIX - ---- A circle wipe transition. --- @see Noble.Transition.Spotlight.defaultProperties --- @table Noble.Transition.SpotlightMask.defaultProperties --- @tparam[opt=Ease.outQuad] Ease ease --- @number[opt=200] x --- @number[opt=120] y --- @number[opt=nil] xStart --- @number[opt=nil] yStart --- @number[opt=nil] xEnd --- @number[opt=nil] yEnd --- @bool[opt=false] invert -transition.defaultProperties = { - ease = Ease.outQuad, - x = 200, - y = 120, - xStart = nil, - yStart = nil, - xEnd = nil, - yEnd = nil, - invert = false -} - -function transition:setProperties(__arguments) - self.x = __arguments.x or self.defaultProperties.x - self.y = __arguments.y or self.defaultProperties.y - self.xStart = __arguments.xStart or self.defaultProperties.xStart or self.x - self.yStart = __arguments.yStart or self.defaultProperties.yStart or self.y - self.xEnd = __arguments.xEnd or self.defaultProperties.xEnd or self.x - self.yEnd = __arguments.yEnd or self.defaultProperties.yEnd or self.y - - self.invert = __arguments.invert or self.defaultProperties.invert - - if (self.invert) then - self.ease = Ease.reverse(self.ease) - end - - -- "Private" variables - self._maskBackground = nil - self._maskForegroundDrawMode = nil - if (self.invert ~= true) then - self._maskBackground = Graphics.image.new(400, 240, Graphics.kColorWhite) - self._maskForegroundDrawMode = Graphics.kDrawModeFillBlack - else - self._maskBackground = Graphics.image.new(400, 240, Graphics.kColorBlack) - self._maskForegroundDrawMode = Graphics.kDrawModeFillWhite - end - - self._startRadius = math.max( - Geometry.distanceToPoint(self.xStart, self.yStart, 0, 0), - Geometry.distanceToPoint(self.xStart, self.yStart, 400, 0), - Geometry.distanceToPoint(self.xStart, self.yStart, 400, 240), - Geometry.distanceToPoint(self.xStart, self.yStart, 0, 240) - ) - self._endRadius = math.max( - Geometry.distanceToPoint(self.xEnd, self.yEnd, 0, 0), - Geometry.distanceToPoint(self.xEnd, self.yEnd, 400, 0), - Geometry.distanceToPoint(self.xEnd, self.yEnd, 400, 240), - Geometry.distanceToPoint(self.xEnd, self.yEnd, 0, 240) - ) - -end - -function transition:draw() - local progress = self.sequence:get() - - if (not self.invert) then - self.oldSceneScreenshot:draw(0, 0) - Graphics.setColor(Graphics.kColorClear) - Graphics.fillCircleAtPoint( - math.lerp(self.xStart, self.xEnd, progress), - math.lerp(self.yStart, self.yEnd, progress), - progress * self._endRadius - ) - Graphics.setColor(Graphics.kColorBlack) - else - local mask = Graphics.image.new(400, 240, Graphics.kColorBlack) - Graphics.pushContext(mask) - Graphics.setColor(Graphics.kColorWhite) - Graphics.fillCircleAtPoint( - math.lerp(self.xStart, self.xEnd, progress), - math.lerp(self.yStart, self.yEnd, progress), - (1 - progress) * self._startRadius - ) - Graphics.popContext() - self.oldSceneScreenshot:setMaskImage(mask) - self.oldSceneScreenshot:draw(0, 0) - end - -end \ No newline at end of file diff --git a/source/libraries/noble/modules/Noble.Transition/WidgetSatchel.lua b/source/libraries/noble/modules/Noble.Transition/WidgetSatchel.lua deleted file mode 100644 index 66f8795..0000000 --- a/source/libraries/noble/modules/Noble.Transition/WidgetSatchel.lua +++ /dev/null @@ -1,73 +0,0 @@ ---- --- @submodule Noble.Transition - -class("WidgetSatchel", nil, Noble.Transition).extends(Noble.Transition) -local transition = Noble.Transition.WidgetSatchel -transition.name = "Widget Satchel" - --- Type -transition._type = Noble.Transition.Type.COVER - --- Overrides -transition._sequenceCompleteValue = 2 -transition.easeEnter = Ease.outCubic -transition.easeExit = Ease.inCubic - ---- An "accordion" transition, taken from "Widget Satchel" by Noble Robot. --- This transition has no properties. --- @table Noble.Transition.MetroNexus.defaultProperties - --- "Static" variables -local panels - -function transition:setProperties(__arguments) - - if (panels == nil) then - panels = { - Graphics.image.new(400,48, Graphics.kColorWhite), - Graphics.image.new(400,48, Graphics.kColorWhite), - Graphics.image.new(400,48, Graphics.kColorWhite), - Graphics.image.new(400,48, Graphics.kColorWhite), - Graphics.image.new(400,48, Graphics.kColorWhite) - } - Graphics.lockFocus(panels[1]) - Graphics.setDitherPattern(0.4, Graphics.image.kDitherTypeScreen) - Graphics.fillRect(0,0,400,48) - Graphics.lockFocus(panels[2]) - Graphics.setDitherPattern(0.7, Graphics.image.kDitherTypeScreen) - Graphics.fillRect(0,0,400,48) - Graphics.lockFocus(panels[3]) - Graphics.setDitherPattern(0.25, Graphics.image.kDitherTypeBayer8x8) - Graphics.fillRect(0,0,400,48) - Graphics.lockFocus(panels[4]) - Graphics.setDitherPattern(0.5, Graphics.image.kDitherTypeDiagonalLine) - Graphics.fillRect(0,0,400,48) - Graphics.lockFocus(panels[5]) - Graphics.setDitherPattern(0.8, Graphics.image.kDitherTypeHorizontalLine) - Graphics.fillRect(0,0,400,48) - Graphics.unlockFocus() - end - - -- Warnings - if (__arguments.easeEnter or __arguments.easeEnter or __arguments.ease) then - warn("BONK: 'Noble.Transition.WidgetSatchel' does not support custom ease values.") - end - -end - -function transition:draw() - local progress = self.sequence:get() - if (not self.midpointReached ) then - panels[1]:draw(0, -48 + (progress * (48*1)) ) - panels[2]:draw(0, -48 + (progress * (48*2)) ) - panels[3]:draw(0, -48 + (progress * (48*3)) ) - panels[4]:draw(0, -48 + (progress * (48*4)) ) - panels[5]:draw(0, -48 + (progress * (48*5)) ) - else - panels[1]:draw(0, 48*0 + (progress - 1) * 48*5) - panels[2]:draw(0, 48*1 + (progress - 1) * 48*4) - panels[3]:draw(0, 48*2 + (progress - 1) * 48*3) - panels[4]:draw(0, 48*3 + (progress - 1) * 48*2) - panels[5]:draw(0, 48*4 + (progress - 1) * 48*1) - end -end \ No newline at end of file diff --git a/source/libraries/noble/modules/NobleScene.lua b/source/libraries/noble/modules/NobleScene.lua deleted file mode 100644 index 48536de..0000000 --- a/source/libraries/noble/modules/NobleScene.lua +++ /dev/null @@ -1,242 +0,0 @@ ---- --- An abstract scene class. --- Do not copy this file as a template for your scenes. Instead, your scenes will extend this class. --- See templates/SceneTemplate.lua for a blank scene that you can copy and modify for your own scenes. --- If you are using NobleEngine-ProjectTemplate, --- see `scenes/ExampleScene.lua` for an implementation example. --- @usage --- YourSceneName = {} --- class("YourSceneName").extends(NobleScene) --- local scene = YourSceneName --- --- @classmod NobleScene --- - -NobleScene = {} -class("NobleScene").extends(Object) - ---- Properties --- @section properties - ---- The name of this scene. Optional. --- If you do not set this value, it will take on the scene's `className`. -NobleScene.name = "" - ---- This is the background color of this scene. --- -NobleScene.backgroundColor = Graphics.kColorWhite - ---- Tables --- @section tables - ---- All scenes have a default inputHandler which is made active when the scene starts. --- If you do not define your scene's `inputHandler`, it is `nil` and input is disabled when this scene --- starts. --- @see Noble.Input.setHandler --- --- @usage --- YourSceneName.inputHandler = { --- AButtonDown = function() --- // Your code here --- end, --- AButtonHold = function() --- // Your code here --- end, --- -- ... --- -- ... --- } --- -- OR... --- -- Use a non-scene-specific inputHandler, defined elsewhere. --- YourSceneName.inputHandler = somePreviouslyDefinedInputHandler --- -- OR... --- -- Reuse another scene's inputHandler. --- YourSceneName.inputHandler = SomeOtherSceneName.inputHandler -NobleScene.inputHandler = {} - ---- When you add a sprite to your scene, it is put in this table so the scene can keep track of it. --- --- This is intended as `read-only`. You should not modify this table directly. --- @see addSprite -NobleScene.sprites = {} - ---- Methods --- @section Methods - ---- Use this to add sprites to your scene instead of `playdate.graphics.sprite:add()`. --- --- If your sprite is a `NobleSprite`, using `NobleSprite:add()` will also call this method. --- --- Sprites added with this method that are tracked by the scene. Any not manually removed before transitioning to another scene are automatically removed in @{finish|finish}. --- @tparam playdate.graphics.sprite __sprite The sprite to add to the scene. --- @see NobleSprite:add --- @see removeSprite -function NobleScene:addSprite(__sprite) - if (__sprite.isNobleSprite == true) then - __sprite:superAdd() - else - __sprite:add() - end - - if (table.indexOfElement(self.sprites, __sprite) == nil) then - table.insert(self.sprites, __sprite) - end -end - ---- Use this to remove sprites from your scene instead of `playdate.graphics.sprite:remove()`. --- --- If your sprite is a `NobleSprite`, using `NobleSprite:remove()` will also call this method. --- --- Sprites not manually removed before transitioning to another scene are automatically removed in @{finish|finish}. --- @tparam playdate.graphics.sprite __sprite The sprite to add to the scene. --- @see NobleSprite:remove --- @see addSprite -function NobleScene:removeSprite(__sprite) - if (__sprite.isNobleSprite == true) then - __sprite:superRemove() - else - __sprite:remove() - end - - if (table.indexOfElement(self.sprites, __sprite) ~= nil) then - table.remove(self.sprites, table.indexOfElement(self.sprites, __sprite)) - end -end - ---- Callbacks --- @section callbacks - ---- Implement this in your scene if you have code to run when your scene's object is created. --- --- @usage --- function YourSceneName:init() --- YourSceneName.super.init(self) --- --[Your code here]-- --- end --- -function NobleScene:init() - self.name = self.className - self.sprites = {} -end - ---- Implement if you want to run code as the transition to this scene begins, such as UI animation, triggers, etc. --- --- @usage --- function YourSceneName:enter() --- YourSceneName.super.enter(self) --- --[Your code here]-- --- end --- -function NobleScene:enter() end - ---- Implement if you have code to run once the transition to this scene is complete. This method signifies the full activation of a scene. If this scene's `inputHandler` is defined, it is enabled now. --- @see inputHandler --- @usage --- function YourSceneName:start() --- YourSceneName.super.start(self) --- --[Your code here]-- --- end --- -function NobleScene:start() - Noble.Input.setHandler(self.inputHandler) -end - ---- Implement to run scene-specific code on every frame while this scene is active. --- NOTE: you may use coroutine.yield() here, because it only runs inside of playdate.update(), which is a coroutine. --- --- @usage --- function YourSceneName:update() --- YourSceneName.super.update(self) --- --[Your code here]-- --- end --- -function NobleScene:update() end - ---- Implement this function to draw background visual elements in your scene. ---- This runs when the engine need to redraw a background area. ---- By default it runs every frame and fills the background with self.backgroundColor. All arguments are optional. ---- Use `Graphics.sprite.setAlwaysRedraw(false)` after `Noble.new()` to optimize partial redraw. --- --- @usage --- function YourSceneName:drawBackground(__x, __y, __width, __height) --- YourSceneName.super.drawBackground(self) -- optional, invokes default behavior. --- --[Your code here]-- --- end --- -function NobleScene:drawBackground(__x, __y, __width, __height) - __x = __x or 0 - __y = __y or 0 - __width = __width or Display.getWidth() - __height = __height or Display.getHeight() - - -- Cache the currently set color/pattern. - local color = Graphics.getColor() - local color_type = type(color) - - -- Draw background. - Graphics.setColor(self.backgroundColor) - Graphics.fillRect(__x, __y, __width, __height) - - -- Reset color/pattern from cache. - if color_type == 'number' then - Graphics.setColor(color) - elseif color_type == 'table' then - Graphics.setPattern(color) - end -end - ---- Implement this in your scene if you have "goodbye" code to run when a transition to another scene --- begins, such as UI animation, saving to disk, etc. --- --- @usage --- function YourSceneName:exit() --- YourSceneName.super.exit(self) --- --[Your code here]-- --- end --- -function NobleScene:exit() - for _, sprite in ipairs(self.sprites) do - sprite:setUpdatesEnabled(false) - sprite:setCollisionsEnabled(false) - end -end - ---- Implement this in your scene if you have code to run when a transition to another scene --- is complete, such as resetting variables. --- --- @usage --- function YourSceneName:finish() --- YourSceneName.super.finish(self) --- --[Your code here]-- --- end --- -function NobleScene:finish() - for _, sprite in ipairs(self.sprites) do - if (sprite.isNobleSprite) then - sprite:superRemove() - else - sprite:remove() - end - end -end - ---- `pause()` / `resume()` --- --- Implement one or both of these in your scene if you want something to happen when the game is paused/unpaused --- by the system. The Playdate SDK does not require you to write pause logic, but these are useful if you want a --- custom menu image (see Playdate SDK for more details), want to obscure game elements to prevent players from --- cheating in a time-sensitive game, want to count the number of times the player pauses the game, etc. --- --- @usage --- function YourSceneName:pause() --- YourSceneName.super.pause(self) --- --[Your code here]-- --- end -function NobleScene:pause() end - ---- --- @usage --- function YourSceneName:resume() --- YourSceneName.super.resume(self) --- --[Your code here]-- --- end -function NobleScene:resume() end \ No newline at end of file diff --git a/source/libraries/noble/modules/NobleSprite.lua b/source/libraries/noble/modules/NobleSprite.lua deleted file mode 100644 index aad6d31..0000000 --- a/source/libraries/noble/modules/NobleSprite.lua +++ /dev/null @@ -1,149 +0,0 @@ ---- --- An extension of Playdate's sprite object, incorporating `Noble.Animation` and other Noble Engine features. --- Use this in place of `playdate.graphics.sprite` in most cases. --- --- `NobleSprite` is a child class of `playdate.graphics.sprite`, so see the Playdate SDK documentation for additional methods and properties. --- --- @classmod NobleSprite --- - -NobleSprite = {} -class("NobleSprite").extends(Graphics.sprite) - ---- Do not call an "init" method directly. Use `NobleSprite()` (see usage examples). --- @string[opt] __view This can be: the path to an image or spritesheet image file, an image object (`Graphics.image`) or an animation object (`Noble.Animation`) --- @bool[opt=false] __viewIsSpritesheet Set this to `true` to indicate that `__view` is a spritesheet. Will only be considered if `__view` is a string path to an image. --- @bool[opt=false] __singleState If this sprite has just one animation, set this to true. It saves you from having to use Noble.Animation.addState() --- @bool[opt=true] __singleStateLoop If using a single state animation, should it loop? --- --- @usage --- -- Provide a spritesheet image file to create a new `Noble.Animation` for a NobleSprite's view. --- myNobleSprite = NobleSprite("path/to/spritesheet", true) --- --- @usage --- -- Provide an image file to create a new `Graphics.image` for a NobleSprite's view. --- myNobleSprite = NobleSprite("path/to/image") --- --- @usage --- -- Use an existing `Noble.Animation` for a NobleSprite's view. --- local myAnimation = Noble.Animation.new("path/to/spritesheet") --- myAnimation:addState("default", 1, animation.imageTable:getLength(), nil, true) --- myNobleSprite = NobleSprite(myAnimation) --- --- @usage --- -- Use an existing `Graphics.image` object for a NobleSprite's view. --- local myImage = Graphics.image.new("path/to/image") --- myNobleSprite = NobleSprite(myImage) --- --- @usage --- -- Extending NobleSprite. --- --- -- MyCustomSprite.lua --- MyCustomSprite = {} --- class("MyCustomSprite").extends(NobleSprite) --- --- function MyCustomSprite:init(__x, __y, __anotherFunArgument) --- MyCustomSprite.super.init(self, "path/to/spritesheet", true) --- -- Etc. etc. --- end --- --- -- MyNobleScene.lua --- myNobleSprite = MyCustomSprite(100, 100, "Fun!") --- --- @see Noble.Animation:addState --- @see Noble.Animation.new --- -function NobleSprite:init(__view, __viewIsSpritesheet, __singleState, __singleStateLoop) - NobleSprite.super.init(self) - self.isNobleSprite = true -- This is important so other methods don't confuse this for a playdate.graphics.sprite. DO NOT modify this value at runtime. - if (__view ~= nil) then - -- __view is the path to an image or spritesheet file. - if (type(__view) == "string") then - self.animated = __viewIsSpritesheet -- NO NOT modify self.animated at runtime. - - if (__viewIsSpritesheet == true) then - -- Create a new Noble.Animation object. - - --- The animation for this NobleSprite. - -- @see Noble.Animation.new - self.animation = Noble.Animation.new(__view) - - local singleStateLoop = true - if (__singleStateLoop ~= nil) then singleStateLoop = __singleStateLoop end - - if (__singleState == true) then - self.animation:addState("default", 1, self.animation.imageTable:getLength(), nil, singleStateLoop) - end - else - -- Create a new Graphics.image object. - self:setImage(Graphics.image.new(__view)) - end - - -- __view is an existing Graphics.image object. - elseif (type(__view) == "userdata") then - self.animated = false - self:setImage(__view) - - -- __view is an existing Noble.Animation object. - elseif (type(__view) == "table") then - self.animated = true - self.animation = __view - end - end -end - -function NobleSprite:draw() - if (self.animation ~= nil) then - self.animation:draw() - self:markDirty() - end -end - ---- This will enable the update loop for this NobleSprite, which also causes its Noble.Animation to play. -function NobleSprite:play() - self:setUpdatesEnabled(true) -end - ---- This will disable the update loop for this NobleSprite, which also causes its Noble.Animation to pause. -function NobleSprite:pause() - self:setUpdatesEnabled(false) -end - ---- This will disable the update loop for this NobleSprite, and also reset its Noble.Animation (if it exists) to the first frame of its current state. -function NobleSprite:stop() - self:setUpdatesEnabled(false) - if (self.animation ~= nil) then - self.animation.currentFrame = self.animation.current.startFrame - end -end - ---- Use this to add this NobleSprite to your scene. This replaces `playdate.graphics.sprite:add()` to allow NobleSprites to be tracked by the current NobleScene. --- --- To add a `playdate.graphics.sprite` to a scene, use `NobleScene:addSprite(__sprite)`. --- @see NobleScene:addSprite -function NobleSprite:add(__x, __y) - local x = __x or 0 - local y = __y or 0 - self:moveTo(x, y) - Noble.currentScene():addSprite(self) -end - -function NobleSprite:superAdd() - NobleSprite.super.add(self) -end - ---- Use this to remove this NobleSprite from your scene. This replaces `playdate.graphics.sprite:remove()` to allow NobleSprites to be tracked by the current NobleScene. --- --- To remove a `playdate.graphics.sprite` from a scene, use `NobleScene:removeSprite(__sprite)`. --- @see NobleScene:removeSprite -function NobleSprite:remove() - if (self.animation ~= nil) then - self:stop() - self:setUpdatesEnabled(true) -- reset! - end - Noble.currentScene():removeSprite(self) -end - -function NobleSprite:superRemove() - NobleSprite.super.remove(self) -end diff --git a/source/libraries/noble/templates/SceneTemplate.lua b/source/libraries/noble/templates/SceneTemplate.lua deleted file mode 100644 index 5bb25c8..0000000 --- a/source/libraries/noble/templates/SceneTemplate.lua +++ /dev/null @@ -1,185 +0,0 @@ --- --- SceneTemplate.lua --- --- Use this as a starting point for your game's scenes. --- Copy this file to your root "scenes" directory, --- and rename it. --- - --- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --- !!! Rename "SceneTemplate" to your scene's name in these first three lines. !!! --- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - -SceneTemplate = {} -class("SceneTemplate").extends(NobleScene) -local scene = SceneTemplate - --- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - --- It is recommended that you declare, but don't yet define, --- your scene-specific varibles and methods here. Use "local" where possible. --- --- local variable1 = nil -- local variable --- scene.variable2 = nil -- Scene variable. --- When accessed outside this file use `SceneTemplate.variable2`. --- ... --- - --- This is the background color of this scene. -scene.backgroundColor = Graphics.kColorWhite - --- This runs when your scene's object is created, which is the --- first thing that happens when transitining away from another scene. -function scene:init() - scene.super.init(self) - - -- variable1 = 100 - -- SceneTemplate.variable2 = "string" - -- ... - - -- Your code here -end - --- When transitioning from another scene, this runs as soon as this --- scene needs to be visible (this moment depends on which transition type is used). -function scene:enter() - scene.super.enter(self) - -- Your code here -end - --- This runs once a transition from another scene is complete. -function scene:start() - scene.super.start(self) - -- Your code here -end - --- This runs once per frame. -function scene:update() - scene.super.update(self) - -- Your code here -end - --- This runs once per frame, and is meant for drawing code. -function scene:drawBackground() - scene.super.drawBackground(self) - -- Your code here -end - --- This runs as as soon as a transition to another scene begins. -function scene:exit() - scene.super.exit(self) - -- Your code here -end - --- This runs once a transition to another scene completes. -function scene:finish() - scene.super.finish(self) - -- Your code here -end - -function scene:pause() - scene.super.pause(self) - -- Your code here -end -function scene:resume() - scene.super.resume(self) - -- Your code here -end - --- Define the inputHander for this scene here, or use a previously defined inputHandler. - --- scene.inputHandler = someOtherInputHandler --- OR -scene.inputHandler = { - - -- A button - -- - AButtonDown = function() -- Runs once when button is pressed. - -- Your code here - end, - AButtonHold = function() -- Runs every frame while the player is holding button down. - -- Your code here - end, - AButtonHeld = function() -- Runs after button is held for 1 second. - -- Your code here - end, - AButtonUp = function() -- Runs once when button is released. - -- Your code here - end, - - -- B button - -- - BButtonDown = function() - -- Your code here - end, - BButtonHeld = function() - -- Your code here - end, - BButtonHold = function() - -- Your code here - end, - BButtonUp = function() - -- Your code here - end, - - -- D-pad left - -- - leftButtonDown = function() - -- Your code here - end, - leftButtonHold = function() - -- Your code here - end, - leftButtonUp = function() - -- Your code here - end, - - -- D-pad right - -- - rightButtonDown = function() - -- Your code here - end, - rightButtonHold = function() - -- Your code here - end, - rightButtonUp = function() - -- Your code here - end, - - -- D-pad up - -- - upButtonDown = function() - -- Your code here - end, - upButtonHold = function() - -- Your code here - end, - upButtonUp = function() - -- Your code here - end, - - -- D-pad down - -- - downButtonDown = function() - -- Your code here - end, - downButtonHold = function() - -- Your code here - end, - downButtonUp = function() - -- Your code here - end, - - -- Crank - -- - cranked = function(change, acceleratedChange) -- Runs when the crank is rotated. See Playdate SDK documentation for details. - -- Your code here - end, - crankDocked = function() -- Runs once when when crank is docked. - -- Your code here - end, - crankUndocked = function() -- Runs once when when crank is undocked. - -- Your code here - end -} diff --git a/source/libraries/noble/utilities/Ease.lua b/source/libraries/noble/utilities/Ease.lua deleted file mode 100644 index b256893..0000000 --- a/source/libraries/noble/utilities/Ease.lua +++ /dev/null @@ -1,81 +0,0 @@ ---- Extensions to `playdate.easingFunctions`, aliased as `Ease` in Noble Engine. --- See the Playdate SDK for a list of easing functions. --- @module Ease - -local componentFunctions = { - [Ease.inOutQuad] = { enter = Ease.inQuad, exit = Ease.outQuad }, - [Ease.inOutCubic] = { enter = Ease.inCubic, exit = Ease.outCubic }, - [Ease.inOutQuart] = { enter = Ease.inQuart, exit = Ease.outQuart }, - [Ease.inOutQuint] = { enter = Ease.inQuint, exit = Ease.outQuint }, - [Ease.inOutSine] = { enter = Ease.inSine, exit = Ease.outSine }, - [Ease.inOutExpo] = { enter = Ease.inExpo, exit = Ease.outExpo }, - [Ease.inOutCirc] = { enter = Ease.inCirc, exit = Ease.outCirc }, - [Ease.inOutElastic] = { enter = Ease.inElastic, exit = Ease.outElastic }, - [Ease.inOutBack] = { enter = Ease.inBack, exit = Ease.outBack }, - [Ease.inOutBounce] = { enter = Ease.inBounce, exit = Ease.outBounce }, - [Ease.outInQuad] = { enter = Ease.outQuad, exit = Ease.inQuad }, - [Ease.outInCubic] = { enter = Ease.outCubic, exit = Ease.inCubic }, - [Ease.outInQuart] = { enter = Ease.outQuart, exit = Ease.inQuart }, - [Ease.outInQuint] = { enter = Ease.outQuint, exit = Ease.inQuint }, - [Ease.outInSine] = { enter = Ease.outSine, exit = Ease.inSine }, - [Ease.outInExpo] = { enter = Ease.outExpo, exit = Ease.inExpo }, - [Ease.outInCirc] = { enter = Ease.outCirc, exit = Ease.inCirc }, - [Ease.outInElastic] = { enter = Ease.outElastic, exit = Ease.inElastic }, - [Ease.outInBack] = { enter = Ease.outBack, exit = Ease.inBack }, - [Ease.outInBounce] = { enter = Ease.outBounce, exit = Ease.inBounce }, - [Ease.linear] = { enter = Ease.linear, exit = Ease.linear } -} - -local reverseFunctions = { - [Ease.inQuad] = Ease.outQuad, - [Ease.inCubic] = Ease.outCubic, - [Ease.inQuart] = Ease.outQuart, - [Ease.inQuint] = Ease.outQuint, - [Ease.inSine] = Ease.outSine, - [Ease.inExpo] = Ease.outExpo, - [Ease.inCirc] = Ease.outCirc, - [Ease.inElastic] = Ease.outElastic, - [Ease.inBack] = Ease.outBack, - [Ease.inBounce] = Ease.outBounce, - [Ease.outQuad] = Ease.inQuad, - [Ease.outCubic] = Ease.inCubic, - [Ease.outQuart] = Ease.inQuart, - [Ease.outQuint] = Ease.inQuint, - [Ease.outSine] = Ease.inSine, - [Ease.outExpo] = Ease.inExpo, - [Ease.outCirc] = Ease.inCirc, - [Ease.outElastic] = Ease.inElastic, - [Ease.outBack] = Ease.inBack, - [Ease.outBounce] = Ease.inBounce, - [Ease.linear] = Ease.linear -} - ---- Returns the first half of an "inOut" or "outIn" easing function. --- Returns `nil` for any easing function that isn't in the form of `Ease.inOutXxxx` or `Ease.outInXxxx`. `Ease.linear` returns itself. --- @usage --- local ease = Ease.outInQuad --- local easeEnter = Ease.enter(ease) -- Returns "Ease.outQuad" -function Ease.enter(__easingFunction) - if (componentFunctions[__easingFunction] == nil) then return nil end - return componentFunctions[__easingFunction].enter -end - ---- Returns the second half of an "inOut" or "outIn" easing function. --- Returns `nil` for any easing function that isn't in the form of `Ease.inOutXxxx` or `Ease.outInXxxx`. `Ease.linear` returns itself. --- @usage --- local ease = Ease.outInQuad --- local easeExit = Ease.exit(ease) -- Returns "Ease.inQuad" -function Ease.exit(__easingFunction) - if (componentFunctions[__easingFunction] == nil) then return nil end - return componentFunctions[__easingFunction].exit -end - ---- Returns the reverse function of the provided function. --- Returns `nil` for any easing function that isn't in the form of `Ease.inXxxx` or `Ease.outXxxx`. `Ease.linear` returns itself. --- @usage --- local ease = Ease.inQuad --- local reverseEase = Ease.reverse(ease) -- Returns "Ease.outQuad" -function Ease.reverse(__easingFunction) - if (reverseFunctions[__easingFunction] == nil) then return nil end - return reverseFunctions[__easingFunction] -end \ No newline at end of file diff --git a/source/libraries/noble/utilities/Utilities.lua b/source/libraries/noble/utilities/Utilities.lua deleted file mode 100644 index 1fc871d..0000000 --- a/source/libraries/noble/utilities/Utilities.lua +++ /dev/null @@ -1,197 +0,0 @@ --- --- Utilities.lua --- --- Useful helper functions and API extensions. --- Place your own utilities in "utilities/Utilities.lua" --- - -Utilities = {} - -function Utilities.copy(obj, seen) - if type(obj) ~= 'table' then return obj end - if seen and seen[obj] then return seen[obj] end - local s = seen or {} - local res = setmetatable({}, getmetatable(obj)) - s[obj] = res - for k, v in pairs(obj) do res[Utilities.copy(k, s)] = Utilities.copy(v, s) end - return res -end - -function Utilities.isNull(__object) - return __object == nil or __object == '' -end -function Utilities.isNotNull(__object) - return __object ~= nil and __object ~= '' -end - -function Utilities.startsWith(__string, __start) - return __string:sub(1, #__start) == __start -end - -function Utilities.endsWith(__string, __ending) - return __ending == "" or __string:sub(-#__ending) == __ending -end - -function Utilities.handleOptionalBoolean(__argument, __default) - if (__argument == nil) then - return __default - elseif (__argument == true or __argument == false) then - return __argument - else - error("BONK: You shouldn’t pass non-boolean value as a boolean parameter.") - return __argument - end -end - -Utilities.varName = {} -setmetatable( - Utilities.varName, - { - __index = function(self, __key, __value) - return string.format('%s', __key) - end - } -) - - -function Utilities.getHypotenuse(__x,__y) - return math.sqrt((__x*__x)+(__y*__y)) -end - -function Utilities.average(__a, __b) - return (__a + __b) / 2 -end - -function Utilities.screenshot() - return Graphics.getDisplayImage() -end - -function Utilities.autoTable(__numberOfDimensions) - local metatable = {}; - for i = 1, __numberOfDimensions do - metatable[i] = { - __index = function(__table, __key) - if i < __numberOfDimensions then - __table[__key] = setmetatable({}, metatable[i+1]) - return __table[__key]; - end - end - } - end - return setmetatable({}, metatable[1]); -end - -function Utilities.newUUID() - local func = function(x) - local random = math.random(16) - 1 - random = (x == "x") and (random + 1) or (random % 4) + 9 - return ("0123456789abcdef"):sub(random, random) - end - return (("xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx"):gsub("[xy]", func)) -end - - --- New math methods --- - -function math.clamp(__value, __min, __max) - if (__min > __max) then - __min, __max = __max, __min - end - return math.max(__min, math.min(__max, __value)) -end - -function math.ring(__value, __min, __max) - if (__min > __max) then - __min, __max = __max, __min - end - return __min + (__value - __min) % (__max - __min) -end - -function math.ringInt(__value, __min, __max) - return math.ring(__value, __min, __max + 1) -end - -function math.approach(_value, __target, __step) - if (_value == __target) then - return _value, true - end - local d = __target - _value - if (d > 0) then - _value = _value + __step - if (_value >= __target) then - return __target, true - else - return _value, false - end - elseif (d < 0) then - _value = _value - __step - if (_value <= __target) then - return __target, true - else - return _value, false - end - else - return _value, true - end -end - -function math.infiniteApproach(at_zero, at_infinite, x_halfway, x) - return at_infinite - (at_infinite - at_zero) * 0.5 ^ (x / x_halfway) -end - -function math.round(__value, __bracket) - local bracket = __bracket or 1 - return math.floor(__value/bracket + math.sign(__value) * 0.5) * bracket -end - -function math.sign(__value) - return (__value >= 0 and 1) or -1 -end - -function math.lerp(a, b, t) - return a + (b - a) * t -end - --- New array/table methods --- - -function table.merge(__table1, __table2) - local mergedTable = {} - for k,v in pairs(__table1) do - mergedTable[k] = v - end - for k,v in pairs(__table2) do - mergedTable[k] = v - end - return mergedTable -end - -function table.random(__table) - if (type(__table) ~= "table") then return nil end - return __table[math.ceil(math.random(#__table))] -end -function table.each(__table, __function) - if (type(__function) ~= "function") then return end - for _, e in pairs(__table) do - __function(e) - end -end - -function table.filter(__table, __filter) - local out = {} - for _, value in pairs(__table) do - --if filterIter(v, k, table) then out[k] = v end - if (__filter(value)) then - __table.insert (out,value) - end - end - - return out -end - -function table.getSize(__table) - local count = 0 - for _, _ in pairs(__table) do count += 1 end - return count -end diff --git a/source/main.lua b/source/main.lua index 77eb6b9..eb05d82 100644 --- a/source/main.lua +++ b/source/main.lua @@ -100,19 +100,20 @@ Difficulty = { DifficultySettings = { [Difficulty.Easy] = { - assebleTime = 2500, + assebleTime = 1700, }, [Difficulty.Medium] = { - assebleTime = 1500, + assebleTime = 1000, }, [Difficulty.Hard] = { - assebleTime = 800, + assebleTime = 500, } } Noble.Settings.setup({ difficulty = Difficulty.Medium, - music = true + music = true, + debug = true }) Noble.GameData.setup({ diff --git a/source/scenes/Menu.lua b/source/scenes/Menu.lua index bbfa40e..d99b8ee 100644 --- a/source/scenes/Menu.lua +++ b/source/scenes/Menu.lua @@ -113,7 +113,15 @@ end function scene:setupMenu(__menu) __menu:addItem("Start", function() Noble.transition(DroneCardSelector, nil, Noble.Transition.DipToWhite) end) - __menu:addItem("Tutorial", function() return end) + __menu:addItem("Tutorial", function() + local debug = Noble.Settings.get("debug") + if debug then + Noble.Settings.set("debug", false) + else + Noble.Settings.set("debug", true) + end + return + end) __menu:addItem("Credits", function() return end) __menu:select("Start") end diff --git a/source/scripts/player.lua b/source/scripts/player.lua index 3c8ba37..5ed7e62 100644 --- a/source/scripts/player.lua +++ b/source/scripts/player.lua @@ -53,8 +53,12 @@ function Player:init(x, y) Player.bat = Player.fullBat Player.dischargeRate = 1 Player.moveRight = false + Player.moveLeft = false -- TODO: refactor to use a single variable self.lastDirection = nil self.targetDone = false + + + self.debug = Noble.Settings.get("debug") end function Player:handleInput() @@ -68,6 +72,7 @@ function Player:handleInput() if not playdate.buttonIsPressed(playdate.kButtonLeft) and not playdate.buttonIsPressed(playdate.kButtonRight) then self.xVelocity = self.xVelocity * self.friction Player.moveRight = false + Player.moveLeft = false self.animation:setState("down") end @@ -78,6 +83,8 @@ function Player:handleInput() end self:changeToRunState("left") self.lastDirection = "left" + Player.moveLeft = true + Player.moveRight = false self.xVelocity = self.xVelocity - self.acceleration elseif playdate.buttonIsPressed(playdate.kButtonRight) then if self.lastDirection == "left" then @@ -85,6 +92,7 @@ function Player:handleInput() end self:changeToRunState("right") Player.moveRight = true + Player.moveLeft = false self.lastDirection = "right" self.xVelocity = self.xVelocity + self.acceleration end @@ -95,10 +103,12 @@ function Player:handleInput() -- Y velocity if crankChange ~= 0 then - if crankChange > 0 then - self.animation:setState("up") - else - self.animation:setState("down") + if Player.moveRight == false and Player.moveLeft == false then + if crankChange > 0 then + self.animation:setState("up") + else + self.animation:setState("down") + end end self.yInertia = self.yInertia - (acceleratedChange * 0.007) else @@ -173,6 +183,9 @@ function Player:handleMovementAndCollisions() self:boom() return elseif collisionTag == 154 then -- Baleba + if self.debug then + return + end self:boom(collisionObject) return elseif collisionTag == 2 then -- Tank