line function prototype

This commit is contained in:
fotonmoton 2017-02-13 20:40:04 +02:00
parent e53ec01f97
commit d4e933162e
4 changed files with 45 additions and 52 deletions

3
.gitignore vendored
View file

@ -1 +1,4 @@
*.swp *.swp
.idea
CMakeLists.txt
cmake-build-debug

View file

@ -28,7 +28,9 @@ SRC = $(addprefix $(SRCDIR), $(SRC_FILES))
OBJ = $(addprefix $(OBJDIR), $(OBJ_FILES)) OBJ = $(addprefix $(OBJDIR), $(OBJ_FILES))
INC = -I ./inc -I $(LIBFT_FOLDER)/includes/ -I $(MLX_FOLDER) INC = -I $(LIBFT_FOLDER)includes/ \
-I $(MLX_FOLDER) \
-I ./inc
LIBFT = libft.a LIBFT = libft.a

25
inc/fdf.h Normal file
View file

@ -0,0 +1,25 @@
// C/C++ File
// AUTHOR: fotonmootn
// FILE: inc/fdf.h
// ROLE: to rule them all
// CREATED: 2017-02-13 20:07:04
// MODIFIED: 2017-02-13 20:28:14
#ifndef FDF_H
# define FDF_H
#include "libft.h"
#include "mlx.h"
#include <stdio.h> // warning!!
typedef struct s_point
{
int x;
int y;
int z;
} t_point;
void line(t_point *p1, t_point *p2, void *mlx, void *win);
#endif

View file

@ -3,67 +3,30 @@
// FILE: main.c // FILE: main.c
// ROLE: to rule them all // ROLE: to rule them all
// CREATED: 2017-01-30 21:51:28 // CREATED: 2017-01-30 21:51:28
// MODIFIED: 2017-01-30 23:25:14 // MODIFIED: 2017-02-13 20:30:48
#include "fdf.h"
#include <stdio.h> void line(t_point *p1, t_point *p2, void *mlx, void *win)
#include "libft.h"
#include "mlx.h"
#include <time.h>
void put_square(int side, int init_x, int init_y, void *mlx, void *mlx_w, int hex_rgb)
{ {
//struct timespec tw = {0,10}; p2->x = 0;
//struct timespec tr; p2->y = 0;
mlx_pixel_put(mlx, win, p1->x, p1->y, 0xFFFFFFFF);
int temp_y;
temp_y = init_y;
while(init_x < side)
{
init_y = temp_y;
while(init_y < side)
{
mlx_pixel_put(mlx, mlx_w, init_x, init_y, hex_rgb);
//nanosleep(&tw, &tr);
init_y++;
}
init_x++;
}
} }
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
void *mlx; void *mlx;
void *mlx_window; void *mlx_window;
void *image; t_point p1;
int y; t_point p2;
int x;
//int hex;
p1.x = 10;
p1.y = 10;
argc = argc + 1;
argv = argv;
mlx = mlx_init(); mlx = mlx_init();
mlx_window = mlx_new_window(mlx, 2400, 1600, "CATT!!!11"); mlx_window = mlx_new_window(mlx, 500, 500, "fdf");
// y= 50; line(&p1, &p2, mlx, mlx_window);
// hex = 0xFFA6FB;
// while (y < 100)
// {
// x = 50;
// while (x < 100)
// {
// put_square(100, x, y, mlx, mlx_window, hex);
// //mlx_clear_window(mlx, mlx_window);
// printf("y = %d\n", y);
// hex += 0xFFA6FB;
// x++;
// }
// y++;
// }
y = 1600;
x = 2400;
if (argc != 2)
return (1);
image = mlx_xpm_file_to_image(mlx, argv[1], &x, &y);
mlx_put_image_to_window (mlx, mlx_window, image, 0, 0);
mlx_loop(mlx); mlx_loop(mlx);
return (0); return (0);
} }