The project I'm working on requires me to write a lot of repetitive code. For example, if I want to load an image file named "logo.png" into my code, I would write something like this: Bitmap logoImage;
...
logoImage = load("logo.png")
...
logoImage.draw(0, 0);
..
logoImage.release();
Having this code to use every new image is a pain, including the need to indicate that logoImage should load the file "logo.png".
Since I am working on a Java Android game, and images are used in internal loops, I really want to avoid slow actions like making virtual function calls, etc. access to arrays / maps / fields of objects when I can avoid this. Copying an idea from the Android API (generated class R), I thought I could run the utility before compiling to generate part of this repeating code for it. For example, the actual code in the project file will be reduced to this:
logoImage.draw(0, 0);
(, grep, sed), "Image.draw(..." ), , .. / .png "Bitmap logoImage" -. , , , .
, , , . . , , int- , .
? , , , , , . - (.. )? - , ?