modified: Makefile
modified: color.c
This commit is contained in:
parent
5077643bf8
commit
54b4a94f20
@ -1,4 +1,4 @@
|
|||||||
make:
|
make:
|
||||||
gcc color.c -lX11 -o ../bin/color
|
gcc color.c -lX11 -lm -o ../bin/color
|
||||||
debug:
|
debug:
|
||||||
gcc color.c -lX11 -Wall -o ../bin/color -ggdb
|
gcc color.c -lX11 -lm -Wall -o ../bin/color -ggdb
|
||||||
|
13
src/color.c
13
src/color.c
@ -4,6 +4,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
#define PROMPT_BUFSIZE 32
|
#define PROMPT_BUFSIZE 32
|
||||||
|
|
||||||
@ -36,7 +37,7 @@ int main(void) {
|
|||||||
GC text_prompt_gc;
|
GC text_prompt_gc;
|
||||||
|
|
||||||
int text_buffer_space;
|
int text_buffer_space;
|
||||||
|
unsigned int channel_step;
|
||||||
int is_prompt = 0;
|
int is_prompt = 0;
|
||||||
|
|
||||||
unsigned int winsize_x;
|
unsigned int winsize_x;
|
||||||
@ -82,6 +83,8 @@ int main(void) {
|
|||||||
|
|
||||||
XMapWindow(display, window);
|
XMapWindow(display, window);
|
||||||
XSelectInput(display, window, KeyPressMask | ExposureMask);
|
XSelectInput(display, window, KeyPressMask | ExposureMask);
|
||||||
|
XGetWindowAttributes(display, window, &win_info);
|
||||||
|
channel_step = 0xffff / pow((win_info.depth / 3), 2) ;
|
||||||
|
|
||||||
|
|
||||||
//text struct
|
//text struct
|
||||||
@ -121,14 +124,16 @@ int main(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
printf("%i\n", win_info.depth);
|
||||||
switch(event.xkey.keycode) {
|
switch(event.xkey.keycode) {
|
||||||
case X_ENTER_KEY:
|
case X_ENTER_KEY:
|
||||||
break;
|
break;
|
||||||
case X_Q_KEY:
|
case X_Q_KEY:
|
||||||
printf("%i\n", background_color.red);
|
printf("Before: %i\n", background_color.red);
|
||||||
XFreeColors(display, colormap, &background_color.pixel, 1, NULL);
|
XFreeColors(display, colormap, &background_color.pixel, 1, NULL);
|
||||||
background_color.red += 1000;
|
printf("Step: %i\n", channel_step);
|
||||||
printf("%i\n", background_color.red);
|
background_color.red += channel_step; //TODO: change me to depth
|
||||||
|
printf("After: %i\n", background_color.red);
|
||||||
XAllocColor(display, colormap, &background_color);
|
XAllocColor(display, colormap, &background_color);
|
||||||
break;
|
break;
|
||||||
case X_W_KEY:
|
case X_W_KEY:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user