more construct(char* args) for kaos constructors
This commit is contained in:
parent
ffde2dc832
commit
a99cabc018
2 changed files with 13 additions and 2 deletions
13
Kaos.c
13
Kaos.c
|
@ -60,11 +60,22 @@ void deleteConversation(Kaos* target)
|
||||||
free(target);
|
free(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
Kaos* newChoice(char* q, char* a1, char* a2, HyperKaos* p1, HyperKaos* p2)
|
Kaos* newChoice(char* args)
|
||||||
{
|
{
|
||||||
|
char q[32], a1[32], a2[32];
|
||||||
|
int p1, p2;
|
||||||
Kaos* core = rawKaos();
|
Kaos* core = rawKaos();
|
||||||
Choice* self = malloc(sizeof(Choice));
|
Choice* self = malloc(sizeof(Choice));
|
||||||
|
|
||||||
|
if (sscanf(args, "q %[^,], a1 %[^,], a2 %[^,], p1 %d, p2 %d", q, a1, a2, &p1, &p2) != 5)
|
||||||
|
{
|
||||||
|
free(core);
|
||||||
|
free(self);
|
||||||
|
self = NULL;
|
||||||
|
core = NULL;
|
||||||
|
return core;
|
||||||
|
}
|
||||||
|
|
||||||
self->question = TTF_RenderText_Solid(font, q, textColor);
|
self->question = TTF_RenderText_Solid(font, q, textColor);
|
||||||
self->answ1 = TTF_RenderText_Solid(font, a1, textColor);
|
self->answ1 = TTF_RenderText_Solid(font, a1, textColor);
|
||||||
self->answ2 = TTF_RenderText_Solid(font, a2, textColor);
|
self->answ2 = TTF_RenderText_Solid(font, a2, textColor);
|
||||||
|
|
2
Kaos.h
2
Kaos.h
|
@ -95,7 +95,7 @@ Kaos* newConversation(char* args);
|
||||||
void runConversation(Kaos* self);
|
void runConversation(Kaos* self);
|
||||||
void deleteConversation(Kaos* target);
|
void deleteConversation(Kaos* target);
|
||||||
|
|
||||||
Kaos* newChoice(char* q, char* a1, char* a2, HyperKaos* p1, HyperKaos* p2);
|
Kaos* newChoice(char* args);
|
||||||
void runChoice(Kaos* self);
|
void runChoice(Kaos* self);
|
||||||
void deleteChoice(Kaos* target);
|
void deleteChoice(Kaos* target);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue