Premiers tests - BUG : Récuprération des paramètres

This commit is contained in:
Jérôme Henry-Barnaudière - GeeHB / JHB 2023-11-09 22:10:39 +01:00
parent a35ce37c74
commit db4c748dee
6 changed files with 62 additions and 12 deletions

View File

@ -9,7 +9,7 @@ include(Fxconv)
find_package(Gint 2.9 REQUIRED)
set(SOURCES
src/jTetris.cpp
src/geeTetris.cpp
src/tabs.cpp
src/tetrisTabs.cpp
src/tetrisGame.cpp
@ -35,6 +35,6 @@ if("${FXSDK_PLATFORM_LONG}" STREQUAL fx9860G)
generate_g1a(TARGET myaddin OUTPUT "MyAddin.g1a"
NAME "MyAddin" ICON assets-fx/icon.png)
elseif("${FXSDK_PLATFORM_LONG}" STREQUAL fxCG50)
generate_g3a(TARGET myaddin OUTPUT "jtetris.g3a"
NAME "jTetris" ICONS assets-cg/icon-uns.png assets-cg/icon-sel.png)
generate_g3a(TARGET myaddin OUTPUT "geeTetris.g3a"
NAME "geeTetris" ICONS assets-cg/icon-uns.png assets-cg/icon-sel.png)
endif()

33
LICENCE.md Normal file
View File

@ -0,0 +1,33 @@
MIT License
Copyright (c) 2023 Jérôme Henry-Barnaudière
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.

View File

@ -41,7 +41,7 @@ extern "C" {
// App. infos
#define APP_NAME "geeTetris"
#define APP_VERSION "0.1 - beta"
#define APP_VERSION "0.1 - beta 2"
#define APP_AUTHOR "GeeHB"
// Playfield's dimensions (in box units)
@ -174,7 +174,7 @@ enum GAME_KEY{
// Comments for tabs
#define TAB_LEVEL_STR "Choose starting level"
#define TAB_DIRTY_LINES_STR "Number of 'dirty' lines when starting game"
#define TAB_DIRTY_LINES_STR "Number of 'dirty' lines when starting the game"
#define TAB_SHADOW_OFF_STR "No shadows"
#define TAB_SHADOW_ON_STR "Shadows will be drawn"

View File

@ -41,8 +41,8 @@ int main(){
// # of dirty lines
tabRangedValue tabLines(TAB_LINES, MIN_DIRTY_LINES, MAX_DIRTY_LINES);
value.uVal = params.dirtyLines_;
tabLevel.setValue(value);
tabLevel.setComment(TAB_DIRTY_LINES_STR);
tabLines.setValue(value);
tabLines.setComment(TAB_DIRTY_LINES_STR);
// display shadows ?
value.bVal = params.shadow_;
@ -58,6 +58,7 @@ int main(){
// Add tabs ...
//
tabManager tmanager;
TAB_STATUS tStatus;
tab::clearScreen();
tmanager.add(&tabAbout, 0);
@ -67,12 +68,14 @@ int main(){
tmanager.add(&tabTetris, 4);
tmanager.add(&tabExit, 5);
// Select the first
tmanager.select(0)->select(tStatus);
// Handle options
bool quitApp(false), getNextKey(true);
uint car(0);
int8_t sel(0);
tab* currentTab;
TAB_STATUS tStatus;
#ifdef DEST_CASIO_FXCG50
key_event_t evt;

View File

@ -173,9 +173,9 @@ void tabRangedValue::setRange(uint8_t minVal, uint8_t maxVal){
// Position
xPos_ = (CASIO_WIDTH - TAB_RANGE_WIDTH * (maxVal_ - minVal_ + 1)) / 2;
yPos_ = TAB_RANGE_POS_Y;
yPos_ = int((CASIO_HEIGHT - TAB_HEIGHT) / 2);
// Current val must be in the range
// Current value must be in the range
value_.uVal = (uint8_t)_inRange(value_.iVal);
}
@ -189,6 +189,10 @@ void tabRangedValue::select(TAB_STATUS& status){
int8_t newVal = value_.uVal;
bool stay(true);
#ifdef DEST_CASIO_FXCG50
clearScreen();
#endif // #ifdef DEST_CASIO_FXCG50
// Draw all possible numbers
_drawRange();
@ -262,6 +266,10 @@ void tabRangedValue::_drawRange(){
}
#ifdef DEST_CASIO_FXCG50
if (comment_){
dtext(5, yPos_ - 15, COLOUR_BLACK, comment_);
}
dupdate();
#endif // #ifdef DEST_CASIO_FXCG50
}
@ -273,6 +281,7 @@ void tabRangedValue::_selectValue(int8_t value, bool select){
uint16_t x(xPos_ + (value - minVal_) * TAB_RANGE_WIDTH + 1);
#ifdef DEST_CASIO_FXCG50
clearScreen();
drect(x, yPos_ + 1 , x + TAB_RANGE_WIDTH - 1, yPos_ + TAB_RANGE_WIDTH - 1 , select?COLOUR_BK_HILITE:COLOUR_WHITE);
dprint(x + 3, yPos_ + 2, select?COLOUR_WHITE:COLOUR_BLACK, "%d", value);
#else
@ -343,8 +352,8 @@ tab* tabManager::select(int8_t ID){
return tabs_[ID];
}
// Not a valid tab
return NULL;
// Not a valid tab ?
return (ID == active_ && active_ != -1?tabs_[ID]:NULL);
}
// Redraw all tabs

View File

@ -31,6 +31,7 @@ extern bopti_image_t img_geeTetris;
void aboutTab::select(TAB_STATUS& status){
// Draw the image and text
#ifdef DEST_CASIO_FXCG50
clearScreen();
dimage(0, 0, &img_geeTetris);
char copyright[255]; // Should be enough !
@ -61,6 +62,10 @@ void aboutTab::select(TAB_STATUS& status){
void tetrisTab::select(TAB_STATUS& status){
if (params_){
#ifdef DEST_CASIO_FXCG50
clearScreen();
#endif // #ifdef DEST_CASIO_FXCG50
tetrisGame game(params_);
if (game.start()){
_showScores(game.score()); // Show final score