MCPcopy Create free account
hub / github.com/deathkiller/jazz2-native / PrintVersion

Function PrintVersion

Sources/Main.cpp:2196–2224  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2194#else
2195#if defined(DEATH_TARGET_APPLE) || defined(DEATH_TARGET_UNIX)
2196int PrintVersion(bool logoVisible)
2197{
2198 if (logoVisible) {
2199 static const char Copyright[] = "© 2016-" NCINE_BUILD_YEAR " Dan R.";
2200 static const char Reset[] = "\033[0m";
2201 static const char Bold[] = "\033[1m";
2202 static const char Faint[] = "\033[2m";
2203
2204 constexpr std::size_t LogoWidth = 58;
2205
2206 char padding[(LogoWidth / 2) + 2];
2207 std::size_t paddingLength = (LogoWidth - (arraySize(NCINE_APP_NAME) - 1) - 1 - (arraySize(NCINE_VERSION) - 1) + 1) / 2;
2208 for (std::size_t j = 0; j < paddingLength; j++) {
2209 padding[j] = ' ';
2210 }
2211 padding[paddingLength] = '\0';
2212 fprintf(stdout, "%s%s%s %s%s%s\n", padding, Reset, NCINE_APP_NAME, Bold, NCINE_VERSION, Reset);
2213
2214 paddingLength = (LogoWidth - (arraySize(Copyright) - 1) + 1) / 2;
2215 for (std::size_t j = 0; j < paddingLength; j++) {
2216 padding[j] = ' ';
2217 }
2218 padding[paddingLength] = '\0';
2219 fprintf(stdout, "%s%s%s%s%s\n\n", padding, Reset, Faint, Copyright, Reset);
2220 } else {
2221 fputs(NCINE_APP_NAME " " NCINE_VERSION "\n", stdout);
2222 }
2223 return 0;
2224}
2225#endif
2226
2227int main(int argc, char** argv)

Callers 1

mainFunction · 0.85

Calls 1

arraySizeFunction · 0.50

Tested by

no test coverage detected