aliens

Author Topic: Interactive programing  (Read 4937 times)

Online Yankes

  • Commander
  • *****
  • Posts: 3208
    • View Profile
Interactive programing
« on: March 31, 2012, 05:29:16 pm »
I saw recently interesting idea: and some implementation of this: https://gabrielflor.it/water
Its have some flaws (hard to archive in languages like C/C++) but still this can be useful.
Many times I had to recompile code couple of times to get for some variable right value. Editing it in debugger is pain in a%$ because you need  stop program and edit it every time it get changed.

My idea is to create function that will allow you to inject new value to program using key press.
some example:
we have some variable that need be change and you dont know what is correct one.
Code: [Select]
int var = 1;https://is it 42 correct??now we have new function that will do it for us.
Code: [Select]
int var = spec_func<key_inc, key_dec>(Def_value, Min_value, Max_value);after compiling and ruining OpenXcom you can press key `key_inc` to increase this value or `key_dec` to reduce.
(this is simplest possible function, I can create more function that have more complex effects)
You will not be forced to change any thing else in code to get it working.
Additional to get some feedback, you will get this value printed under fps counter.
After finding correct value you will simply replace this code with it:
Code: [Select]
int var = 42;https://is it!
With this system you can test every value you want only recompiling 2 times one `.cpp` file.
This function will be fast, cost of using it will be near cost of calling normal function that do some simple operations.