コード例 #1
0
ファイル: load_den.c プロジェクト: adsr/agar
/* Read a den header and its mappings. */
static int
ReadDenHeader(AG_Den *den)
{
    Uint32 i;

    AG_CopyString(den->hint, den->buf, sizeof(den->hint));
    AG_CopyString(den->name, den->buf, sizeof(den->name));

    den->author = AG_ReadString(den->buf);
    den->copyright = AG_ReadString(den->buf);
    den->descr = AG_ReadString(den->buf);
    den->keywords = AG_ReadString(den->buf);

    den->nmembers = AG_ReadUint32(den->buf);
    den->members = Malloc(den->nmembers*sizeof(AG_DenMember));

    for (i = 0; i < den->nmembers; i++) {
        AG_DenMember *memb = &den->members[i];

        AG_CopyNulString(memb->name, den->buf, sizeof(memb->name));
        AG_CopyNulString(memb->lang, den->buf, sizeof(memb->lang));
        den->members[i].offs = (off_t)AG_ReadUint32(den->buf);
        den->members[i].size = (size_t)AG_ReadUint32(den->buf);
    }
    return (0);
}
コード例 #2
0
ファイル: vg_text.c プロジェクト: varialus/agar
static int
Load(void *p, AG_DataSource *ds, const AG_Version *ver)
{
	VG_Text *vt = p;

	if ((vt->p1 = VG_ReadRef(ds, vt, "Point")) == NULL ||
	    (vt->p2 = VG_ReadRef(ds, vt, "Point")) == NULL)
		return (-1);

	vt->align = (enum vg_alignment)AG_ReadUint8(ds);
	AG_CopyString(vt->fontFace, ds, sizeof(vt->fontFace));
	vt->fontSize = (int)AG_ReadUint8(ds);
	vt->fontFlags = (Uint)AG_ReadUint16(ds);
	AG_CopyString(vt->text, ds, sizeof(vt->text));
	return (0);
}