FPS Counter + Basic ctrlCreate Tutorial
So I made this a while back with a view to releasing it one day and since I don't really use it, I see no harm in it being public.
I also haven't released anything here in a while and I wanted to change that.
So I proudly present, my FPS Counter.
I added some stupid comments in a hope that it will encourage people to start using ctrlCreate.
It's a great command and it gives me a giant boner as you may already know.
I included the .sqf below for convenience.
Enjoy!
Thanks to @Lystic for his Executor, it helped smooth the learning curve!
Code:
/*
Jme FPS Counter
*/
//Settings
font = "PuristaBold"; //define your font
text_colour = [1,0.1,0.66,1]; //define your text colour
background_colour = [0,0,0,0.1]; //define your background colour
fps_position = 0.35; //choose X position, choose a value between 0.35 - 1.8 (approx)
//End Settings
[] spawn { //spawn that shit for optimum speed
disableSerialization; //disable that shit
_display = (findDisplay 46) ctrlCreate ["RscEdit", -1]; //create that shit
_display ctrlSetFont font; //set the font
_display ctrlSetTextColor text_colour; //set the colour
_display ctrlSetPosition [safeZoneX + fps_position, safeZoneY, 0.17, 0.06]; //set the mother fucking position
_background = (findDisplay 46) ctrlCreate ["RscBackgroundGUI", -2]; //and maybe a sexy little background
_background ctrlSetPosition [safeZoneX + fps_position, safeZoneY, 0.17, 0.06]; //you get the idea by now...
_background ctrlSetBackgroundColor background_colour; //...
_background ctrlCommit 0; //since its static, commit this shit now!
while {true} do { //do this shit all the time
fps_text = (format ["JME FPS: %1", str round (diag_fpsmin)]); //take out my name like pro
_display ctrlSetText fps_text; //display the fps
_display ctrlCommit 0; //need to commit this shit here otherwise your shit wont actually do shit more than once
sleep 1; //how often to refresh? or simply delete this mother fucker for the fastest refresh rate
}; //don't do anything else all the time
};

