summaryrefslogtreecommitdiff
path: root/PIPET-1/pipet_view.h
blob: 1685ac171e1fdd2e44df81c00c0bedf83243f3e8 (plain) (blame)
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
//
//  pipet_view.h
//  PIPET-1
//
//  Created by dianshi on 3/28/20.
//  Copyright © 2020 dianshi. All rights reserved.
//

#ifndef pipet_view_h
#define pipet_view_h

#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>

#include <SDL2/SDL.h>

typedef struct pipet_view {
    int32_t width;
    int32_t height;
    int32_t delay;
    int32_t color; //rgb
    int64_t max_dot_value;
    int64_t last_max_dot;
    float   *dots_relative; //buf of dots values relative
    uint64_t *dots;
    int32_t cur_dot;
    int32_t dots_size;
} pipet_view;

int pv_init(pipet_view *pv, int32_t max_dots, int32_t w, int32_t h);
int pv_set_color(pipet_view *pv, int32_t color);
int pv_add_dot(pipet_view *pv, uint64_t val);
int pv_destroy(pipet_view *pv);


int pv_draw_texture(pipet_view *pv, SDL_Renderer *renderer, int x, int y);
int pv_render(pipet_view *pv, SDL_Renderer *renderer);



#endif /* pipet_view_h */