Skip to content

Commit

Permalink
small changes of function names
Browse files Browse the repository at this point in the history
  • Loading branch information
BrunoLevy committed Jan 19, 2024
1 parent a5a8703 commit 06e8210
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions GL_tty.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ static inline void GL_end_frame(int delay) {
#endif
}

typedef void (*GL_pixelfunc)(int x, int y, uint8_t* r, uint8_t* g, uint8_t* b);
typedef void (*GL_fpixelfunc)(int x, int y, float* r, float* g, float* b);
typedef void (*GL_pixelfunc_RGB)(int x, int y, uint8_t* r, uint8_t* g, uint8_t* b);
typedef void (*GL_pixelfunc_RGBf)(int x, int y, float* r, float* g, float* b);

/**
* \brief Draws an image by calling a user-specified function for each pixel.
Expand All @@ -171,8 +171,8 @@ typedef void (*GL_fpixelfunc)(int x, int y, float* r, float* g, float* b);
* the pixel's color.
* \details Uses half-charater pixels.
*/
static inline void GL_scan(
int width, int height, GL_pixelfunc do_pixel
static inline void GL_scan_RGB(
int width, int height, GL_pixelfunc_RGB do_pixel
) {
uint8_t r1, g1, b1;
uint8_t r2, g2, b2;
Expand Down Expand Up @@ -209,8 +209,8 @@ static inline uint8_t GL_ftoi(float f) {
* fr,fg,fb of the pixel's color.
* \details Uses half-charater pixels.
*/
static inline void GL_fscan(
int width, int height, GL_fpixelfunc do_pixel
static inline void GL_scan_RGBf(
int width, int height, GL_pixelfunc_RGBf do_pixel
) {
float fr1, fg1, fb1;
float fr2, fg2, fb2;
Expand Down
2 changes: 1 addition & 1 deletion hello_graphics.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ int main() {
int r = (24-i)*5;
int g = i*5;
int b = j*3;
GL_setpixel(j,i,r,g,b);
GL_setpixelRGB(j,i,r,g,b);
}
}
GL_terminate();
Expand Down
4 changes: 2 additions & 2 deletions tinyraytracer.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <math.h>


// It is 80x50 (rather than 80x25) because GL_scan() and GL_fscan()
// It is 80x50 (rather than 80x25) because GL_scan_RGB() and GL_scan_RGBf()
// use "double resolution" "pixels".
//
// Default 80x50 may feel to small, you can use larger value (and enlarge
Expand Down Expand Up @@ -322,7 +322,7 @@ void render(int x, int y, float* r, float* g, float* b) {
int main() {
init_scene();
GL_init();
GL_fscan(GL_width, GL_height, render);
GL_scan_RGBf(GL_width, GL_height, render);
GL_terminate();
return 0;
}

0 comments on commit 06e8210

Please sign in to comment.