Compare commits
3 Commits
archive/sq
...
4.12
| Author | SHA1 | Date | |
|---|---|---|---|
| 10cc70994a | |||
| 7dba84c5d9 | |||
| 78396c4c6e |
12
appinfo.json
12
appinfo.json
@@ -2,8 +2,10 @@
|
|||||||
"appKeys": {
|
"appKeys": {
|
||||||
"background_color": 4,
|
"background_color": 4,
|
||||||
"backlight": 17,
|
"backlight": 17,
|
||||||
|
"bottomrow": 19,
|
||||||
"btvibe": 12,
|
"btvibe": 12,
|
||||||
"center": 11,
|
"center": 11,
|
||||||
|
"cheeky": 22,
|
||||||
"contrast": 13,
|
"contrast": 13,
|
||||||
"debugwatch": 50,
|
"debugwatch": 50,
|
||||||
"eu_date": 1,
|
"eu_date": 1,
|
||||||
@@ -19,12 +21,16 @@
|
|||||||
"ornament_base_color": 7,
|
"ornament_base_color": 7,
|
||||||
"ornament_variation": 8,
|
"ornament_variation": 8,
|
||||||
"quick_start": 2,
|
"quick_start": 2,
|
||||||
"weekday": 18
|
"stepgoal": 21,
|
||||||
|
"weekday": 18,
|
||||||
|
"wristflick": 20
|
||||||
},
|
},
|
||||||
"capabilities": [
|
"capabilities": [
|
||||||
"configurable"
|
"configurable",
|
||||||
|
"health"
|
||||||
],
|
],
|
||||||
"companyName": "lastfuture",
|
"companyName": "lastfuture",
|
||||||
|
"enableMultiJS": false,
|
||||||
"longName": "Squared 4.0",
|
"longName": "Squared 4.0",
|
||||||
"projectType": "native",
|
"projectType": "native",
|
||||||
"resources": {
|
"resources": {
|
||||||
@@ -38,7 +44,7 @@
|
|||||||
"chalk"
|
"chalk"
|
||||||
],
|
],
|
||||||
"uuid": "793bab03-9464-48a2-b63f-3f779c473db8",
|
"uuid": "793bab03-9464-48a2-b63f-3f779c473db8",
|
||||||
"versionLabel": "4.11",
|
"versionLabel": "4.12",
|
||||||
"watchapp": {
|
"watchapp": {
|
||||||
"watchface": true
|
"watchface": true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,109 +0,0 @@
|
|||||||
#include <pebble.h>
|
|
||||||
|
|
||||||
#define DONT_INTERSECT 0
|
|
||||||
#define DO_INTERSECT 1
|
|
||||||
#define COLLINEAR 2
|
|
||||||
|
|
||||||
#define SAME_SIGNS( a, b ) \
|
|
||||||
(((long) ((unsigned long) a ^ (unsigned long) b)) >= 0 )
|
|
||||||
|
|
||||||
int lines_intersect(
|
|
||||||
x1, y1,
|
|
||||||
x2, y2,
|
|
||||||
x3, y3,
|
|
||||||
x4, y4,
|
|
||||||
x,
|
|
||||||
y
|
|
||||||
)
|
|
||||||
|
|
||||||
long x1, y1, x2, y2, x3, y3, x4, y4, *x, *y;
|
|
||||||
|
|
||||||
{
|
|
||||||
long a1, a2, b1, b2, c1, c2; /* Coefficients of line eqns. */
|
|
||||||
long r1, r2, r3, r4; /* 'Sign' values */
|
|
||||||
long denom, offset, num; /* Intermediate values */
|
|
||||||
|
|
||||||
a1 = y2 - y1;
|
|
||||||
b1 = x1 - x2;
|
|
||||||
c1 = x2 * y1 - x1 * y2;
|
|
||||||
|
|
||||||
r3 = a1 * x3 + b1 * y3 + c1;
|
|
||||||
r4 = a1 * x4 + b1 * y4 + c1;
|
|
||||||
|
|
||||||
if ( r3 != 0 &&
|
|
||||||
r4 != 0 &&
|
|
||||||
SAME_SIGNS( r3, r4 ))
|
|
||||||
return ( DONT_INTERSECT );
|
|
||||||
|
|
||||||
a2 = y4 - y3;
|
|
||||||
b2 = x3 - x4;
|
|
||||||
c2 = x4 * y3 - x3 * y4;
|
|
||||||
|
|
||||||
r1 = a2 * x1 + b2 * y1 + c2;
|
|
||||||
r2 = a2 * x2 + b2 * y2 + c2;
|
|
||||||
|
|
||||||
if ( r1 != 0 &&
|
|
||||||
r2 != 0 &&
|
|
||||||
SAME_SIGNS( r1, r2 ))
|
|
||||||
return ( DONT_INTERSECT );
|
|
||||||
|
|
||||||
denom = a1 * b2 - a2 * b1;
|
|
||||||
if ( denom == 0 )
|
|
||||||
return ( COLLINEAR );
|
|
||||||
offset = denom < 0 ? - denom / 2 : denom / 2;
|
|
||||||
|
|
||||||
num = b1 * c2 - b2 * c1;
|
|
||||||
*x = ( num < 0 ? num - offset : num + offset ) / denom;
|
|
||||||
|
|
||||||
num = a2 * c1 - a1 * c2;
|
|
||||||
*y = ( num < 0 ? num - offset : num + offset ) / denom;
|
|
||||||
|
|
||||||
return ( DO_INTERSECT );
|
|
||||||
}
|
|
||||||
|
|
||||||
#define INTERSECTION_NONE 0
|
|
||||||
#define INTERSECTION_PARTIAL 1
|
|
||||||
#define INTERSECTION_FULL 2
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
uint8_t success;
|
|
||||||
GPoint p1;
|
|
||||||
GPoint p2;
|
|
||||||
} Intersection;
|
|
||||||
|
|
||||||
Intersection rectintersect(GPoint p1, GPoint p2, GRect rect) {
|
|
||||||
long x,y;
|
|
||||||
long x1=0,y1=0,x2=0,y2=0;
|
|
||||||
bool intersection = false, final_intersection = false;
|
|
||||||
if (lines_intersect(p1.x, p1.y, p2.x, p2.y, rect.origin.x, rect.origin.y, rect.origin.x, rect.origin.y+rect.size.h, &x, &y) == DO_INTERSECT) {
|
|
||||||
x1 = x; y1 = y; intersection = true;
|
|
||||||
}
|
|
||||||
if (lines_intersect(p1.x, p1.y, p2.x, p2.y, rect.origin.x, rect.origin.y, rect.origin.x+rect.size.w, rect.origin.y, &x, &y) == DO_INTERSECT) {
|
|
||||||
if (!intersection) {
|
|
||||||
x1 = x; y1 = y; intersection = true;
|
|
||||||
} else if (x != x1 && y != y1) {
|
|
||||||
x2 = x; y2 = y; final_intersection = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!final_intersection && lines_intersect(p1.x, p1.y, p2.x, p2.y, rect.origin.x, rect.origin.y+rect.size.h, rect.origin.x+rect.size.w, rect.origin.y+rect.size.h, &x, &y) == DO_INTERSECT) {
|
|
||||||
if (!intersection) {
|
|
||||||
x1 = x; y1 = y; intersection = true;
|
|
||||||
} else if (x != x1 && y != y1) {
|
|
||||||
x2 = x; y2 = y; final_intersection = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!final_intersection && lines_intersect(p1.x, p1.y, p2.x, p2.y, rect.origin.x+rect.size.w, rect.origin.y, rect.origin.x+rect.size.w, rect.origin.y+rect.size.h, &x, &y) == DO_INTERSECT) {
|
|
||||||
if (!intersection) {
|
|
||||||
x1 = x; y1 = y;
|
|
||||||
} else if (x != x1 && y != y1) {
|
|
||||||
x2 = x; y2 = y; final_intersection = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(final_intersection) {
|
|
||||||
return (Intersection) { .success = INTERSECTION_FULL, .p1 = (GPoint) { .x = x1, .y = y1 }, .p2 = (GPoint) { .x = x2, .y = y2 } };
|
|
||||||
} else if (intersection) {
|
|
||||||
return (Intersection) { .success = INTERSECTION_PARTIAL, .p1 = (GPoint) { .x = x1, .y = y1 }, .p2 = (GPoint) { .x = x2, .y = y2 } };
|
|
||||||
} else {
|
|
||||||
return (Intersection) { .success = INTERSECTION_NONE, .p1 = (GPoint) { .x = x1, .y = y1 }, .p2 = (GPoint) { .x = x2, .y = y2 } };
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -35,7 +35,7 @@ Pebble.addEventListener('showConfiguration', function() {
|
|||||||
if(Pebble.getActiveWatchInfo) {
|
if(Pebble.getActiveWatchInfo) {
|
||||||
watch = Pebble.getActiveWatchInfo();
|
watch = Pebble.getActiveWatchInfo();
|
||||||
}
|
}
|
||||||
var url='http://pebble.lastfuture.de/config/squared48/';
|
var url='http://pebble.lastfuture.de/config/squared412/';
|
||||||
url += "?model="+watch.model;
|
url += "?model="+watch.model;
|
||||||
if (watch.platform == "basalt") {
|
if (watch.platform == "basalt") {
|
||||||
url += "&rect=true";
|
url += "&rect=true";
|
||||||
@@ -73,6 +73,10 @@ Pebble.addEventListener('webviewclosed', function(e) {
|
|||||||
ns_stop: parseInt(configData.ns_stop),
|
ns_stop: parseInt(configData.ns_stop),
|
||||||
backlight: 0+(configData.backlight === 'true'),
|
backlight: 0+(configData.backlight === 'true'),
|
||||||
weekday: 0+(configData.weekday === 'true'),
|
weekday: 0+(configData.weekday === 'true'),
|
||||||
|
bottomrow: parseInt(configData.bottomrow),
|
||||||
|
wristflick: parseInt(configData.wristflick),
|
||||||
|
stepgoal: parseInt(configData.stepgoal),
|
||||||
|
cheeky: 0+(configData.cheeky === 'true')
|
||||||
};
|
};
|
||||||
if (debugwatches.indexOf(tokenhash) > -1) {
|
if (debugwatches.indexOf(tokenhash) > -1) {
|
||||||
console.log('Debug Watch with Hash '+tokenhash+'. Setting debug flag on watchface …');
|
console.log('Debug Watch with Hash '+tokenhash+'. Setting debug flag on watchface …');
|
||||||
|
|||||||
1227
src/squared.c
1227
src/squared.c
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user