Dans SceneCheatCode.cpp, dans le constructeur, ajouter les infos sur la fonction:
{"log", { // nom de la fonction
"<type> <message>", // prototype
"Log a message (/log list to get the list of logs types).\n" // description
CHEATCODE_TAB"/log info \"info message\"", // description
&SceneCheatCode::_execLog, // fonction a executer
}},
Dans SceneCheatCode_exec.cpp, ajouter la fonction a executer pour la commande.
Cette fonction DOIT avoir le prototype suivant:
// le nom doit etre `_exec<nomCommande>`
int SceneCheatCode::_execHelp(std::vector<std::string> const & args);
args contient les arguments (comme en shell -> args[0] = nom commande, args[1-n] = arguments)
un argument est soit un mot soit une chaine entre guillemet
La return value d'une fonction exec defini ce qui se passe apres
namespace CheatcodeAction {
// open or close cheatcode
int const KEEP_OPEN = 0b00000000001; // keep command line open
int const CLOSE = 0b00000000010; // close command line
// setup txt in cheatcode
int const TXT_RESET = 0b00000000100; // reset commadn line text
int const TXT_DEF = 0b00000001000; // set command line text to default
int const TXT_KEEP = 0b00000010000; // keep the same command line text
// if close, open text only mode
int const CHEAT_NO_TXT_ONLY = 0b00000100000; // don't open text only mode
int const CHEAT_TXT_ONLY = 0b00001000000; // open text only mode (only if CLOSE)
// result of a command
int const RESULT_SUCCESS = 0b00001000000; // result of the command: success
int const RESULT_ERROR = 0b00010000000; // result of the command: error
}; // namespace CheatcodeAction
// pour quiter la commande line mais afficher les messages 3 sec
return CheatcodeAction::CLOSE | CheatcodeAction::SUCCESS | CheatcodeAction::CHEAT_TXT_ONLY;
// il faut toujours return au minimum:
// KEEP_OPEN ou CLOSE et RESULT_SUCCESS ou RESULT_ERROR
code couleur
β -> c'est fait !
π -> c'est a faire
β -> finalement je fait pas (pas utile)
liste des commandes
β π /unlock <level> pour unlock un level
β /getbonus <bonus> pour avoir un bonus
β /loop <iter> <commands ...> pour exec plusieurs fois
π /get <var> get info about a variable
π /set <token> <value> modifier des variables (son, musique, var de debug, β¦)
cheatcode
comment ajouter une commande
Dans
SceneCheatCode.cpp
, dans le constructeur, ajouter les infos sur la fonction:Dans
SceneCheatCode_exec.cpp
, ajouter la fonction a executer pour la commande.Cette fonction DOIT avoir le prototype suivant:
args
contient les arguments (comme en shell ->args[0] = nom commande
,args[1-n] = arguments
)un argument est soit un mot soit une chaine entre guillemet
La return value d'une fonction exec defini ce qui se passe apres
code couleur
β -> c'est fait ! π -> c'est a faire β -> finalement je fait pas (pas utile)
liste des commandes
/unlock <level>
pour unlock un level/getbonus <bonus>
pour avoir un bonus/loop <iter> <commands ...>
pour exec plusieurs fois/get <var>
get info about a variable/set <token> <value>
modifier des variables (son, musique, var de debug, β¦)/tp <X> <Y>
pour se teleporter/summon <type> <x> <y>
faire apparaitre une entitΓ©, un mur, une bombe, ... a une position/invincible
pour etre invincible PAS BESOIN (/loop 100 "/getbonus shield"
)/clear [history] [all]
clear all lines/help [command]
pour avoir l'aide (aide globale ou sur une commande)/log <type> message
pour log des truc/exec
executer plusieurs commandes/rmbonus <bonus>
pour desactiver des bonus (ou decrementer/rmbonus life
pour perdre un pt de vie)/restart
restart levelautres ajouts
<C-v>
ajouter le ctrl c/v<C-a>
<C-e>
home
end
)logScreenDebug
,logScreenSuccess
, ...) ->#include "SceneCheatCode.hpp
pour les utiliser~
bugs