int lt_update_lights(lua_State *L) { const char *universe = lua_tostring(L, -1); lua_pop(L, 1); return update_lights(L, universe, dmx); }
void SceneObject_Impl::create_lights(Scene &scene_base) { std::vector<ModelDataLight> &model_lights = instance.get_renderer()->get_model_data()->lights; for (size_t i = 0; i < model_lights.size(); i++) lights.push_back(SceneLight(scene_base)); update_lights(); }
int main(int argc, char** argv) { char * hostname = "localhost"; if(argc > 1) { hostname = argv[1]; } if(argc == 3) { lo_send(lo_address_new("18.224.0.163", ELMO_UDP_PORT), ELMO_COMMAND, "fff", 0.0f, 0.0f, 0.0f); lo_send(lo_address_new("18.224.0.168", ELMO_UDP_PORT), ELMO_COMMAND, "fff", 0.0f, 0.0f, 0.0f); return; } sqlights_light_initialize(hostname); initialize_elmo_light("18.224.0.163", "elmo0"); initialize_elmo_light("18.224.0.168", "elmo1"); struct timeval tv, tv2; gettimeofday(&tv, NULL); while(1) { while(0 == sqlights_lights_handle(0)); gettimeofday(&tv2, NULL); if(tv2.tv_sec>tv.tv_sec || tv2.tv_usec-tv.tv_usec >= 33000) { update_lights(); tv = tv2; } } }
void lights_init() { BYTE i; set_port_d(0x00); OED = 0xff; // port D[0:7] = out #if 0 printf(" MR OE DS ST SH\n"); #endif // Master reset set_port_d(PIN_MR_N); set_port_d(0x00); // Clock is low set_port_d(PIN_MR_N); shift_out_byte(1 << 0); delay(200); shift_out_byte(1 << 1); delay(200); shift_out_byte(1 << 2); delay(200); shift_out_byte(1 << 3); delay(200); shift_out_byte(1 << 4); delay(200); shift_out_byte(1 << 5); delay(200); shift_out_byte(1 << 6); delay(200); shift_out_byte(1 << 7); delay(200); // Start with lights off shift_out_byte(0x00); for(i = 0; i < LIGHT_COUNT; i++) { light_state[i] = FALSE; } light_state[0] = TRUE; update_lights(); }
// ZZZ: split out from update_world()'s loop. static int update_world_elements_one_tick() { if (m1_solo_player_in_terminal()) { update_m1_solo_player_in_terminal(GameQueue); } else { L_Call_Idle(); update_lights(); update_medias(); update_platforms(); update_control_panels(); // don't put after update_players update_players(GameQueue, false); move_projectiles(); move_monsters(); update_effects(); recreate_objects(); handle_random_sound_image(); animate_scenery(); // LP additions: if (film_profile.animate_items) { animate_items(); } AnimTxtr_Update(); ChaseCam_Update(); motion_sensor_scan(); check_m1_exploration(); #if !defined(DISABLE_NETWORKING) update_net_game(); #endif // !defined(DISABLE_NETWORKING) } if(check_level_change()) { return kUpdateChangeLevel; } #if !defined(DISABLE_NETWORKING) if(game_is_over()) { return kUpdateGameOver; } #endif // !defined(DISABLE_NETWORKING) dynamic_world->tick_count+= 1; dynamic_world->game_information.game_time_remaining-= 1; return kUpdateNormalCompletion; }
int main() { int dev_fd = open(DEVICE_NAME, O_RDONLY); if (dev_fd >= 0) { if (!get_status(dev_fd)) enable_sensor(dev_fd, 1); } else { printf("Light sensor swith has not found.\n"); } double sum_light = 0; int count_light = 0; char * device = get_device("lightsensor-level"); if (device) { printf("devices: %s\n", device); char one_dev[128] = "/dev/input/"; char * read_pos = device; while (read_pos < (device + strlen(device))) { char * end_pos = read_pos; while ( *end_pos != 0 && *end_pos != ' ') end_pos ++; strncpy(one_dev + strlen("/dev/input/"), read_pos, min_value(127, end_pos - read_pos)); one_dev[strlen("/dev/input/") + min_value(127, end_pos - read_pos) - 1] = 0; read_pos = end_pos + 1; int input_fd = open(one_dev, O_RDONLY); if (input_fd >= 0) { printf("Try use:'%s'\n", one_dev); sum_light += get_abs_value(input_fd); count_light ++; } else { printf("Cant access to '%s'\n", one_dev); } } free(device); } else { printf("Light sensor has not found.\n"); } int cam_value = v4l_cam_value("/dev/video0"); if (cam_value >= 0) { printf("v4l value = %d\n", cam_value); sum_light += cam_value; count_light ++; } if (count_light) { sum_light = sum_light / count_light; } printf("Light value = %d lux\n", cam_value); update_lights(sum_light); // flashlight // /sys/class/leds/flashlight/brightness // 0 - none // 1 - bottom // 2 - top // 3 - both }
/* ==================================== */ static gboolean item_event (GooCanvasItem *item, GooCanvasItem *target, GdkEventButton *event, gpointer data) { if(board_paused) return FALSE; /* If there is already an animation do nothing */ if(animation) return FALSE; if(item == lock_left_item) { if(lock_water_low && canallock_right_up) toggle_lock(item); else gc_sound_play_ogg ("sounds/crash.ogg", NULL); } else if(item == lock_right_item) { if(!lock_water_low && canallock_left_up) toggle_lock(item); else gc_sound_play_ogg ("sounds/crash.ogg", NULL); } else if(item == canallock_left_item && canallock_right_up) { if(lock_right_up) toggle_lock(item); else gc_sound_play_ogg ("sounds/crash.ogg", NULL); } else if(item == canallock_right_item && canallock_left_up) { if(lock_left_up) toggle_lock(item); else gc_sound_play_ogg ("sounds/crash.ogg", NULL); } else if(item == tuxboat_item) { move_boat(); } else { gc_sound_play_ogg ("sounds/crash.ogg", NULL); } update_lights(); return FALSE; }
BOOL light_set_light(BYTE light_index, BOOL on) { if(light_index >= light_set_descriptor.count) { return FALSE; } light_state[light_index] = on; update_lights(); return TRUE; }
/* set initial values for the next level */ static void canal_lock_next_level() { gc_bar_set_level(gcomprisBoard); gamewon = FALSE; from = 0; /* Original state of the lock */ boat_position = BOAT_POS_LEFT; right_way = TRUE; lock_left_up = TRUE; lock_right_up = TRUE; lock_water_low = TRUE; canallock_left_up = TRUE; canallock_right_up = TRUE; update_lights(); }
int main(int argc, char** argv) { char * hostname = "localhost"; if(argc > 1) { hostname = argv[1]; } sqlights_light_initialize(hostname); initialize_elmo_light("18.224.0.163", "elmo0"); initialize_elmo_light("18.224.0.168", "elmo1"); struct timeval tv, tv2; gettimeofday(&tv, NULL); while(1) { while(0 == sqlights_lights_handle(0)); gettimeofday(&tv2, NULL); if(tv2.tv_sec>tv.tv_sec || tv2.tv_usec-tv.tv_usec >= 33000) { update_lights(); tv = tv2; } } }