add repetitions
This commit is contained in:
parent
e2013f94df
commit
f6da60fd6a
3 changed files with 23 additions and 3 deletions
|
@ -10,7 +10,7 @@ extern "C" {
|
||||||
#include "ui.h"
|
#include "ui.h"
|
||||||
}
|
}
|
||||||
|
|
||||||
#define WIDTH 400
|
#define WIDTH 425
|
||||||
#define HEIGHT 200
|
#define HEIGHT 200
|
||||||
|
|
||||||
void glfw_logger(int error, const char *desc)
|
void glfw_logger(int error, const char *desc)
|
||||||
|
|
20
src/ui.c
20
src/ui.c
|
@ -3,6 +3,7 @@
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "read_events.h"
|
#include "read_events.h"
|
||||||
#include "read_file.h"
|
#include "read_file.h"
|
||||||
|
@ -18,6 +19,8 @@ ui_infos * init_ui(const char *name)
|
||||||
ret->file = fopen(name, "w+");
|
ret->file = fopen(name, "w+");
|
||||||
ret->is_recording = 0;
|
ret->is_recording = 0;
|
||||||
ret->args_rf = args_rf_init(ret->file, 1);
|
ret->args_rf = args_rf_init(ret->file, 1);
|
||||||
|
ret->nb_loop = 0;
|
||||||
|
ret->sleep_loop = 0;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,10 +82,23 @@ int draw_ui(ui_infos *ptr)
|
||||||
igInputInt("Temps de repos entre chaque clic (s)", &ptr->args_rf->time_sleep, 1, 10, 0);
|
igInputInt("Temps de repos entre chaque clic (s)", &ptr->args_rf->time_sleep, 1, 10, 0);
|
||||||
if (ptr->args_rf->time_sleep <= 0) ptr->args_rf->time_sleep = 1;
|
if (ptr->args_rf->time_sleep <= 0) ptr->args_rf->time_sleep = 1;
|
||||||
|
|
||||||
|
igSetNextItemWidth(100.0);
|
||||||
|
igInputInt("Nombre de répétitions du fichier", &ptr->nb_loop, 1, 10, 0);
|
||||||
|
if (ptr->nb_loop < 0) ptr->nb_loop = 0;
|
||||||
|
|
||||||
|
igSetNextItemWidth(100.0);
|
||||||
|
igInputInt("Temps de repos entre chaque répétition (s)", &ptr->sleep_loop, 1, 10, 0);
|
||||||
|
if (ptr->sleep_loop < 0) ptr->sleep_loop = 0;
|
||||||
|
|
||||||
if (igButton("Replay", zero_vec2))
|
if (igButton("Replay", zero_vec2))
|
||||||
{
|
{
|
||||||
rewind(ptr->file);
|
int i;
|
||||||
readfile(ptr->args_rf);
|
for (i = 0; i <= ptr->nb_loop; i++)
|
||||||
|
{
|
||||||
|
rewind(ptr->file);
|
||||||
|
readfile(ptr->args_rf);
|
||||||
|
sleep(ptr->sleep_loop);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
4
src/ui.h
4
src/ui.h
|
@ -9,6 +9,10 @@ typedef struct {
|
||||||
char is_recording;
|
char is_recording;
|
||||||
pthread_t pid;
|
pthread_t pid;
|
||||||
args_readfile *args_rf;
|
args_readfile *args_rf;
|
||||||
|
/* Number of repetition */
|
||||||
|
int nb_loop;
|
||||||
|
/* Sleep in s between each repetition */
|
||||||
|
int sleep_loop;
|
||||||
} ui_infos;
|
} ui_infos;
|
||||||
|
|
||||||
ui_infos * init_ui(const char *name);
|
ui_infos * init_ui(const char *name);
|
||||||
|
|
Loading…
Reference in a new issue