summaryrefslogtreecommitdiff
path: root/src/digit-node.c
blob: a5e279555269c4a222f62d48a635a26dca4232c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*
 *  Copyright (C) 2020 - Vito Caputo - <vcaputo@pengaru.com>
 *
 *  This program is free software: you can redistribute it and/or modify it
 *  under the terms of the GNU General Public License version 3 as published
 *  by the Free Software Foundation.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#include <assert.h>
#include <stage.h>

#include "tex.h"
#include "tex-node.h"

#include "gfx/gfx-zero.h"
#include "gfx/gfx-one.h"
#include "gfx/gfx-two.h"
#include "gfx/gfx-three.h"
#include "gfx/gfx-four.h"
#include "gfx/gfx-five.h"
#include "gfx/gfx-six.h"
#include "gfx/gfx-seven.h"
#include "gfx/gfx-eight.h"
#include "gfx/gfx-nine.h"

static const unsigned char	*digits_pixels[10] = {
	gfx_zero.pixel_data,
	gfx_one.pixel_data,
	gfx_two.pixel_data,
	gfx_three.pixel_data,
	gfx_four.pixel_data,
	gfx_five.pixel_data,
	gfx_six.pixel_data,
	gfx_seven.pixel_data,
	gfx_eight.pixel_data,
	gfx_nine.pixel_data,
};

static tex_t		*digits_tex[10];

#define DIGIT_WIDTH	184
#define DIGIT_HEIGHT	288

stage_t * digit_node_new(stage_conf_t *conf, unsigned digit, m4f_t *model_x)
{
	assert(digit < 10);

	if (!digits_tex[digit])
		digits_tex[digit] = tex_new(DIGIT_WIDTH, DIGIT_HEIGHT, digits_pixels[digit]);

	return tex_node_new_tex(conf, digits_tex[digit], model_x);
}
© All Rights Reserved