work on network encoding and documenting eventual component interfaces

This commit is contained in:
2026-04-05 01:04:24 +02:00
parent e3959a24da
commit dad8e34cca
6 changed files with 467 additions and 33 deletions

View File

@@ -3186,6 +3186,20 @@ const char *ncl_getKeyboard(ncl_ScreenState *state,
return state->keyboards[idx];
}
double ncl_getScreenEnergyUsage(ncl_ScreenState *state) {
double sum = 0;
for(int y = 1; y <= state->viewportHeight; y++) {
for(int x = 1; x <= state->viewportWidth; x++) {
ncl_Pixel p = ncl_getScreenPixel(state, x, y);
sum += state->conf.energyPerPixel * nn_colorLuminance(p.bgColor);
if(p.codepoint != 0 && p.codepoint != ' ') {
sum += state->conf.energyPerPixel * nn_colorLuminance(p.fgColor);
}
}
}
return sum;
}
// general stuff
bool ncl_isNCLID(const char *type) {