Skip to content
Snippets Groups Projects
Commit 4ce958c9 authored by Younes Oubkis's avatar Younes Oubkis
Browse files

Fixed Build

parent ae38ece7
No related branches found
No related tags found
No related merge requests found
......@@ -4,6 +4,7 @@
"typeinfo": "c",
"gtk.h": "c",
"stdarg.h": "c",
"stdlib.h": "c"
"stdlib.h": "c",
"lib.h": "c"
}
}
\ No newline at end of file
No preview for this file type
......@@ -8,4 +8,4 @@ LOCAL_FILTERED := $(filter-out app.c,$(LOCAL))
app: app.c lib/shapes.c lib/ui.c lib/lib.h
$(shell unset GTK_PATH)
echo $(LINKS) are linked to executable
gcc $(CFLAGS) app.c -o ../bin/app $(LIBS) $(LINKS) $(LOCAL_FILTERED) -lm
\ No newline at end of file
gcc $(CFLAGS) app.c -o ../bin/app $(LINKS) $(LOCAL_FILTERED) $(LIBS) -lm
\ No newline at end of file
#include <stdio.h>
#include <gtk-3.0/gtk/gtk.h>
#include <lib/lib.h>
#include "app.h"
GtkWidget *window;
GtkWidget *drawing_area;
enum INPUTTYPE current_input;
t_shape shapes[MAX_SHAPES + 1];
int shape_type;
int click_count;
t_vertex click_positions[4];
t_custom_toolbar *toolbar;
int width = 800;
int height = 600;
void handle_freehand_click(float x, float y)
{
}
gboolean on_button_clicked(GtkWidget *button, gpointer user_data)
{
g_print("Button clicked!\n");
......
#include <lib/lib.h>
#ifndef APP
#define APP
#include <gtk-3.0/gtk/gtk.h>
#include "./lib/lib.h"
#define MAX_SHAPES 10
#define set_source_color gdk_cairo_set_source_rgba
GdkRGBA red = {1.0, 0.0, 0.0, 0.8};
GdkRGBA yellow = {1.0, 1.0, 0.0, 0.6};
GdkRGBA blue = {0.0, 0.5, 1.0, 0.4};
GdkRGBA black = {0.0, 0.0, 0.0, 1.0};
GtkWidget *window;
GtkWidget *drawing_area;
extern GtkWidget *window;
extern GtkWidget *drawing_area;
extern enum INPUTTYPE current_input;
extern int shape_type;
extern int click_count;
extern t_vertex click_positions[4];
extern t_shape shapes[MAX_SHAPES + 1];
gboolean on_clear(GtkWidget *button, gpointer user_data);
t_shape shapes[MAX_SHAPES + 1];
gboolean drawing_area_click(GtkWidget *widget, GdkEventButton *event, gpointer data);
void add_shape(t_shape new_shape);
gboolean draw(GtkWidget *widget, cairo_t *c, gpointer data);
void handle_shape_click(float x, float y);
void handle_freehand_click(float x, float y);
#endif
\ No newline at end of file
#include "./lib/lib.h"
#include "app.h"
#include "./lib/lib.h"
GdkRGBA red = {1.0, 0.0, 0.0, 0.8};
GdkRGBA yellow = {1.0, 1.0, 0.0, 0.6};
GdkRGBA blue = {0.0, 0.5, 1.0, 0.4};
GdkRGBA black = {0.0, 0.0, 0.0, 1.0};
gboolean drawing_area_click(GtkWidget *widget, GdkEventButton *event, gpointer data)
{
......@@ -68,7 +73,10 @@ void handle_shape_click(float x, float y)
break;
}
}
void handle_freehand_click(float x, float y)
{
}
void add_shape(t_shape new_shape)
{
t_shape null = NULL_SHAPE();
......@@ -131,6 +139,7 @@ gboolean draw(GtkWidget *widget, cairo_t *c, gpointer data)
{
set_source_color(c, &black);
cairo_arc(c, click_positions[i].X, click_positions[i].Y, 2.0, 0, G_PI * 2);
cairo_fill(c);
}
/*set_source_color(c, &yellow);
......
......@@ -4,13 +4,6 @@
#define UNDEFINED 0
#include <gtk-3.0/gtk/gtk.h>
enum INPUTTYPE current_input;
int shape_type;
int click_count = 0;
t_vertex click_positions[4];
enum SHAPETYPE { TRIANGLE,CIRCLE,RECTANGLE };
enum INPUTTYPE { SELECTION, CREATE_SHAPE, FREEHAND };
......@@ -50,5 +43,4 @@ float hypotenuse(t_vertex a, t_vertex b);
t_shape create_circle(t_vertex start, t_vertex end);
#endif
\ No newline at end of file
......@@ -4,7 +4,6 @@
#include <stdarg.h>
t_custom_toolbar *create_toolbar(int length)
{
t_custom_toolbar* ct = malloc(sizeof(t_custom_toolbar));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment