Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Centre adjustment for some effects and quickinstall modification. #403

Open
wants to merge 3 commits into
base: testing
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion quickinstall
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,13 @@ if [[ -d $SRCDIR ]]; then
echo "Compiling binaries..."
echo "(This can take a while, please be patient)"
newtmp
make -j 24 "$@" 2>$TMPFILE
# Find out how many cores the system has, for make
JOBS=$(getconf _NPROCESSORS_ONLN 2>/dev/null)
# Default to 2 jobs if something went wrong earlier
if [[ -z "$JOBS" ]]; then
JOBS=2
fi
make -j "$JOBS" "$@" 2>$TMPFILE
checkfail $?
echo ""
echo "Finished!"
Expand Down
17 changes: 11 additions & 6 deletions src/ckb-pinwheel/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ void ckb_info(){
// Effect parameters
CKB_PARAM_AGRADIENT("color", "Wheel color:", "", "ffffffff");
CKB_PARAM_DOUBLE("length", "Wheel size:", "%", 100, 1., 100.);
CKB_PARAM_DOUBLE("x_offset", "X offset:", "%", 0, -100, 100);
CKB_PARAM_DOUBLE("y_offset", "Y offset:", "%", 0, -100, 100);
CKB_PARAM_BOOL("counter_clock", "Counter Clockwise", 0);
CKB_PARAM_BOOL("symmetric", "Symmetric", 0);

Expand All @@ -38,6 +40,7 @@ ckb_gradient animcolor = { 0 };
double animlength = 0.;
int symmetric = 0;
int counter_clock = 0;
double x_offset = 0, y_offset = 0;

void ckb_parameter(ckb_runctx* context, const char* name, const char* value){
CKB_PARSE_AGRADIENT("color", &animcolor){}
Expand All @@ -47,6 +50,8 @@ void ckb_parameter(ckb_runctx* context, const char* name, const char* value){
}
CKB_PARSE_BOOL("symmetric", &symmetric){}
CKB_PARSE_BOOL("counter_clock", &counter_clock){}
CKB_PARSE_DOUBLE("x_offset", &x_offset) {}
CKB_PARSE_DOUBLE("y_offset", &y_offset) {}
}

void ckb_init(ckb_runctx* context){
Expand All @@ -65,8 +70,8 @@ float x, y;
void ckb_start(ckb_runctx* context, int state){
// Begin or end animation
frame = state ? 0. : -1.;
x = context->width / 2.f;
y = context->height / 2.f;
x = (context->width + (context->width * x_offset * 0.01)) / 2.f;
y = (context->height - (context->height * y_offset * 0.01)) / 2.f;
}

void ckb_time(ckb_runctx* context, double delta){
Expand All @@ -83,11 +88,11 @@ int ckb_frame(ckb_runctx* context){
if(frame < 0.)
return 0;
// Color each key according to its angle from the center
float position;
if(counter_clock)
float position;
if(counter_clock)
position = ANGLE(frame * M_PI * 2.);
else
position = ANGLE(-frame * M_PI * 2.);
else
position = ANGLE(-frame * M_PI * 2.);
unsigned count = context->keycount;
ckb_key* keys = context->keys;
for(ckb_key* key = keys; key < keys + count; key++){
Expand Down
7 changes: 6 additions & 1 deletion src/ckb-ripple/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ void ckb_info(){
// Effect parameters
CKB_PARAM_AGRADIENT("color", "Ripple color:", "", "ffffffff");
CKB_PARAM_DOUBLE("length", "Ring length:", "%", 100, 1, 100);
CKB_PARAM_DOUBLE("x_offset", "X offset:", "%", 0, -100, 100);
CKB_PARAM_DOUBLE("y_offset", "Y offset:", "%", 0, -100, 100);
CKB_PARAM_BOOL("symmetric", "Symmetric", 0);
CKB_PARAM_BOOL("randomize", "Randomly select from gradient", 0);

Expand Down Expand Up @@ -48,6 +50,7 @@ float kbsize = 0.f;
ckb_gradient animcolor = { 0 };
int symmetric = 0, kprelease = 0, randomize = 0;
double animlength = 0.;
double x_offset = 0, y_offset = 0;

void ckb_init(ckb_runctx* context){
kbsize = sqrt(context->width * context->width / 4.f + context->height * context->height / 4.f);
Expand All @@ -65,6 +68,8 @@ void ckb_parameter(ckb_runctx* context, const char* name, const char* value){
CKB_PARSE_BOOL("symmetric", &symmetric){}
CKB_PARSE_BOOL("kprelease", &kprelease){}
CKB_PARSE_BOOL("randomize", &randomize){}
CKB_PARSE_DOUBLE("x_offset", &x_offset) {}
CKB_PARSE_DOUBLE("y_offset", &y_offset) {}
}

#define ANIM_MAX (144 * 2)
Expand Down Expand Up @@ -110,7 +115,7 @@ void ckb_keypress(ckb_runctx* context, ckb_key* key, int x, int y, int state){
void ckb_start(ckb_runctx* context, int state){
// Add or remove a ring in the center of the keyboard
if(state)
anim_add(context->width / 2.f, context->height / 2.f, context->width, context->height);
anim_add((context->width + (context->width * x_offset * 0.01)) / 2.f, (context->height - (context->height * y_offset * 0.01)) / 2.f, context->width, context->height);
else
anim_remove(context->width / 2.f, context->height / 2.f);
}
Expand Down