pebble-scalable 1.0.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -14
- package/dist.zip +0 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# pebble-scalable
|
|
2
2
|
|
|
3
|
-
Package aiming to make it easy to make scaling layouts for different
|
|
3
|
+
Package aiming to make it easy to make scaling layouts for different display
|
|
4
4
|
sizes by defining their dimension only one.
|
|
5
5
|
|
|
6
6
|
- [Setting up](#setting-up)
|
|
@@ -26,10 +26,10 @@ Add the includes at the top of your source.
|
|
|
26
26
|
|
|
27
27
|
## Dimensions
|
|
28
28
|
|
|
29
|
-
Get values for layout dimensions based on
|
|
29
|
+
Get values for layout dimensions based on display size:
|
|
30
30
|
|
|
31
31
|
```c
|
|
32
|
-
// Get a percentage of the
|
|
32
|
+
// Get a percentage of the display width and height
|
|
33
33
|
const int half_w = scalable_x(50);
|
|
34
34
|
const int half_h = scalable_y(50);
|
|
35
35
|
|
|
@@ -63,7 +63,7 @@ const GRect centered = scalable_center(r);
|
|
|
63
63
|
|
|
64
64
|
## Fonts
|
|
65
65
|
|
|
66
|
-
Use different fonts for different
|
|
66
|
+
Use different fonts for different display sizes, based on a category of 'small',
|
|
67
67
|
'medium', or 'large'.
|
|
68
68
|
|
|
69
69
|
```c
|
|
@@ -75,29 +75,30 @@ s_gothic_18 = fonts_get_system_font(FONT_KEY_GOTHIC_18);
|
|
|
75
75
|
s_gothic_24 = fonts_get_system_font(FONT_KEY_GOTHIC_24);
|
|
76
76
|
```
|
|
77
77
|
|
|
78
|
-
Specify which
|
|
78
|
+
Specify which fonts to use for each display size:
|
|
79
79
|
|
|
80
80
|
```c
|
|
81
|
-
//
|
|
82
|
-
|
|
81
|
+
// The 'small font' set ID
|
|
82
|
+
#define FONT_ID_SMALL 0
|
|
83
|
+
|
|
84
|
+
...
|
|
85
|
+
|
|
86
|
+
// The small font - regular screens use Gothic 18, Chalk N/A Emery uses Gothic 24
|
|
87
|
+
scalable_set_fonts(FONT_ID_SMALL, &s_gothic_18, NULL, &s_gothic_24);
|
|
83
88
|
```
|
|
84
89
|
|
|
85
|
-
During layout or drawing, simply use the font by
|
|
90
|
+
During layout or drawing, simply use the font by ID:
|
|
86
91
|
|
|
87
92
|
```c
|
|
88
93
|
// Text in the vertical middle third!
|
|
89
94
|
graphics_context_set_text_color(ctx, GColorBlack);
|
|
90
95
|
graphics_draw_text(
|
|
91
96
|
ctx,
|
|
92
|
-
"This text should appear in the middle third on any platform or
|
|
93
|
-
|
|
97
|
+
"This text should appear in the middle third on any platform or display size",
|
|
98
|
+
scalable_get_font(FONT_ID_SMALL),
|
|
94
99
|
scalable_grect(0, 33, 100, 33),
|
|
95
100
|
GTextOverflowModeTrailingEllipsis,
|
|
96
101
|
GTextAlignmentCenter,
|
|
97
102
|
NULL
|
|
98
103
|
);
|
|
99
104
|
```
|
|
100
|
-
|
|
101
|
-
## TODO
|
|
102
|
-
|
|
103
|
-
- [ ] What other things need to be set based on size and/or platform aside from position and font size?
|
package/dist.zip
CHANGED
|
Binary file
|