-
-
Notifications
You must be signed in to change notification settings - Fork 502
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tic 0.47.0 #340
Tic 0.47.0 #340
Conversation
…ile, but also reload it on window gained focus sdl event
src/console.c
Outdated
@@ -2317,7 +2317,8 @@ static void tryReloadCode(Console* console, char* codeBuffer) | |||
|
|||
static void cmdInjectCode(Console* console, const char* param, const char* name) | |||
{ | |||
if(strcmp(param, "-code") == 0) | |||
bool watch = strcmp(param, "-code-watch") == 0; | |||
if(strcmp(param, "-code") == 0 || watch) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Micro-optimization: format as if(watch || strcmp(param, "-code") == 0)
to prevent doing 2 strcmp
s when only 1 is needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough!
Pls don't forget to update the Wiki https://github.com/nesbox/TIC-80/wiki#command-line-arguments |
@matheuslessarodrigues |
noted. should fix latter today! |
Beside things described in issue299 (link), I've moved the
memset(buffer, 0, TIC_CODE_SIZE);
to inside theif(contents)
.Also, in order to implement the "-watch" option, I decided to do it as one single command "-code-watch".
So in order to invoke TIC injecting external code, one would still use
And if you also want to watch for file modifications on window focus (sdl event)
I found this to be simpler as I didn't have to change this bit of code in
console.c
I belive that once we need to code more complex command line options, we'd be better with some command line arg parsing lib.
Is it cool? :)