istereo2

view src/assman.c @ 7:a3c4fcc9f8f3

- started a goatkit UI theme - font rendering with drawtext and shaders - asset manager (only used by drawtext for now, will replace respath eventually)
author John Tsiombikas <nuclear@member.fsf.org>
date Thu, 24 Sep 2015 06:49:25 +0300
parents
children
line source
1 #include <stdio.h>
2 #include "assman.h"
4 int ass_fgetc(ass_file *fp)
5 {
6 unsigned char c;
8 if(ass_fread(&c, 1, 1, fp) < 1) {
9 return -1;
10 }
11 return (int)c;
12 }
14 char *ass_fgets(char *s, int size, ass_file *fp)
15 {
16 int i, c;
17 char *ptr = s;
19 if(!size) return 0;
21 for(i=0; i<size - 1; i++) {
22 if((c = ass_fgetc(fp)) == -1) {
23 break;
24 }
25 *ptr++ = c;
27 if(c == '\n') break;
28 }
29 *ptr = 0;
30 return ptr == s ? 0 : s;
31 }