mirror of
https://github.com/NeoFlock/neonucleus.git
synced 2025-09-24 09:03:32 +02:00
small changes
This commit is contained in:
parent
9df8512716
commit
72abd56b4e
@ -156,6 +156,7 @@ void nn_setPixel(nn_screen *screen, int x, int y, nn_scrchr_t pixel) {
|
||||
if(x >= screen->width) return;
|
||||
if(y >= screen->height) return;
|
||||
screen->buffer[x + y * screen->maxWidth] = pixel;
|
||||
screen->isDirty = true; // stuff changed
|
||||
}
|
||||
|
||||
nn_scrchr_t nn_getPixel(nn_screen *screen, int x, int y) {
|
||||
|
@ -24,7 +24,7 @@ typedef struct nn_screen {
|
||||
bool isOn;
|
||||
bool isTouchModeInverted;
|
||||
bool isPrecise;
|
||||
bool isDirty; // ooh la laa
|
||||
bool isDirty;
|
||||
nn_address keyboards[NN_MAX_SCREEN_KEYBOARDS];
|
||||
size_t keyboardCount;
|
||||
} nn_screen;
|
||||
|
@ -691,12 +691,27 @@ int main() {
|
||||
|
||||
SetExitKey(KEY_NULL);
|
||||
|
||||
SetTargetFPS(20); // match MC TPS
|
||||
double idleTime = 0;
|
||||
int tps = 20; // mc TPS
|
||||
double interval = 1.0/tps;
|
||||
|
||||
while(true) {
|
||||
if(WindowShouldClose()) break;
|
||||
nn_setEnergyInfo(computer, 5000, 5000);
|
||||
|
||||
double dt = GetFrameTime();
|
||||
|
||||
double heat = nn_getTemperature(computer);
|
||||
double roomHeat = nn_getRoomTemperature(computer);
|
||||
|
||||
double tx = 0.1;
|
||||
|
||||
// remove some heat per second
|
||||
nn_removeHeat(computer, dt * (rand() % 3) * tx * (heat - roomHeat));
|
||||
if(nn_isOverheating(computer)) {
|
||||
goto render;
|
||||
}
|
||||
|
||||
while (true) { // TODO: find out if we can check if the keycode and unicode are for the same key event or not
|
||||
int keycode = GetKeyPressed();
|
||||
int unicode = GetCharPressed();
|
||||
@ -730,22 +745,6 @@ int main() {
|
||||
for (int i = 0; i < 256; i++) {
|
||||
ne_pressedKey *key = release_check_list + i;
|
||||
if (key->keycode != 0) {
|
||||
if (IsKeyPressedRepeat(key->keycode)) {
|
||||
// omg
|
||||
nn_value values[5];
|
||||
values[0] = nn_values_cstring("key_down");
|
||||
values[1] = nn_values_cstring("shitty keyboard");
|
||||
values[2] = nn_values_integer(key->charcode);
|
||||
values[3] = nn_values_integer(keycode_to_oc(key->keycode));
|
||||
values[4] = nn_values_cstring("USER");
|
||||
|
||||
const char* error = nn_pushSignal(computer, values, 5);
|
||||
|
||||
if (error != NULL) {
|
||||
// well fuck
|
||||
printf("error happened when eventing the keyboarding: %s\n", error);;;;;;
|
||||
}
|
||||
}
|
||||
if (IsKeyReleased(key->keycode)) {
|
||||
// omg
|
||||
nn_value values[5];
|
||||
@ -766,17 +765,31 @@ int main() {
|
||||
}
|
||||
}
|
||||
|
||||
double dt = GetFrameTime();
|
||||
idleTime += dt;
|
||||
|
||||
double heat = nn_getTemperature(computer);
|
||||
double roomHeat = nn_getRoomTemperature(computer);
|
||||
if(idleTime >= interval) {
|
||||
idleTime -= interval;
|
||||
|
||||
double tx = 0.1;
|
||||
for (int i = 0; i < 256; i++) {
|
||||
ne_pressedKey *key = release_check_list + i;
|
||||
if (key->keycode != 0) {
|
||||
if (IsKeyPressedRepeat(key->keycode)) {
|
||||
// omg
|
||||
nn_value values[5];
|
||||
values[0] = nn_values_cstring("key_down");
|
||||
values[1] = nn_values_cstring("shitty keyboard");
|
||||
values[2] = nn_values_integer(key->charcode);
|
||||
values[3] = nn_values_integer(keycode_to_oc(key->keycode));
|
||||
values[4] = nn_values_cstring("USER");
|
||||
|
||||
// remove some heat per second
|
||||
nn_removeHeat(computer, dt * (rand() % 3) * tx * (heat - roomHeat));
|
||||
if(nn_isOverheating(computer)) {
|
||||
goto render;
|
||||
const char* error = nn_pushSignal(computer, values, 5);
|
||||
|
||||
if (error != NULL) {
|
||||
// well fuck
|
||||
printf("error happened when eventing the keyboarding: %s\n", error);;;;;;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int state = nn_tickComputer(computer);
|
||||
@ -795,6 +808,7 @@ int main() {
|
||||
printf("Error: %s\n", e);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
render:
|
||||
BeginDrawing();
|
||||
|
Loading…
x
Reference in New Issue
Block a user