commit 389a8405b6be7e93ed789b9e6d05fb11cd75b378
parent 4cc456a9201852ccea067431753434884854f575
Author: Frederic Cambus <fred@statdns.com>
Date: Mon, 16 Jul 2018 20:06:48 +0200
Add an ansilove_init() function to set default context values
Diffstat:
2 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/include/ansilove.h b/include/ansilove.h
@@ -39,6 +39,7 @@ struct ansilove_options {
uint32_t retinaScaleFactor;
};
+void ansilove_init(struct ansilove_ctx *, struct ansilove_options *);
int ansilove_ansi(struct ansilove_ctx *, struct ansilove_options *);
int ansilove_artworx(struct ansilove_ctx *, struct ansilove_options *);
int ansilove_binary(struct ansilove_ctx *, struct ansilove_options *);
diff --git a/src/init.c b/src/init.c
@@ -0,0 +1,24 @@
+//
+// init.c
+// AnsiLove/C
+//
+// Copyright (c) 2011-2018 Stefan Vogt, Brian Cassidy, and Frederic Cambus.
+// All rights reserved.
+//
+// This source code is licensed under the BSD 2-Clause License.
+// See the LICENSE file for details.
+//
+
+#include "ansilove.h"
+
+void
+ansilove_init(struct ansilove_ctx *ctx, struct ansilove_options *options) {
+ // default to 8 if bits option is not specified
+ options->bits = 8;
+
+ // default to 160 if columns option is not specified
+ options->columns = 160;
+
+ // default to 0 if retinaScaleFactor option is not specified
+ options->retinaScaleFactor = 0;
+}