goat3d
annotate exporters/maxgoat/src/logger.cc @ 103:45a9d493e98c
fixed the input latency issue by calling QWidget::update() instead of QGLWidget::updateGL()
update schedules an update instead of redrawing immediately.
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sat, 12 Sep 2015 17:40:02 +0300 |
parents | fdece14403ff |
children |
rev | line source |
---|---|
nuclear@73 | 1 #include <stdio.h> |
nuclear@73 | 2 #include <stdarg.h> |
nuclear@73 | 3 #include "logger.h" |
nuclear@73 | 4 |
nuclear@73 | 5 static FILE *logfile; |
nuclear@73 | 6 |
nuclear@73 | 7 bool maxlog_open(const char *fname) |
nuclear@73 | 8 { |
nuclear@73 | 9 if(!(logfile = fopen(fname, "wb"))) { |
nuclear@73 | 10 return false; |
nuclear@73 | 11 } |
nuclear@73 | 12 setvbuf(logfile, 0, _IONBF, 0); |
nuclear@73 | 13 return true; |
nuclear@73 | 14 } |
nuclear@73 | 15 |
nuclear@73 | 16 void maxlog_close() |
nuclear@73 | 17 { |
nuclear@73 | 18 if(logfile) { |
nuclear@73 | 19 fclose(logfile); |
nuclear@73 | 20 } |
nuclear@73 | 21 } |
nuclear@73 | 22 |
nuclear@73 | 23 void maxlog(const char *fmt, ...) |
nuclear@73 | 24 { |
nuclear@73 | 25 if(!logfile) return; |
nuclear@73 | 26 |
nuclear@73 | 27 va_list ap; |
nuclear@73 | 28 va_start(ap, fmt); |
nuclear@73 | 29 vfprintf(logfile, fmt, ap); |
nuclear@73 | 30 va_end(ap); |
nuclear@73 | 31 } |