+9
-1
.editorconfig
+9
-1
.editorconfig
···
1
1
root = true
2
2
3
-
[*.{c,h,lua}]
3
+
[*.{c,h}]
4
4
charset = utf-8
5
5
end_of_line = lf
6
6
indent_style = tab
7
7
insert_final_newline = true
8
8
trim_trailing_whitespace = true
9
+
10
+
[*.{lua}]
11
+
charset = utf-8
12
+
end_of_line = lf
13
+
indent_style = space
14
+
indent_size = 2
15
+
insert_final_newline = true
16
+
trim_trailing_whitespace = true
+1
-1
src/api/system.c
+1
-1
src/api/system.c
···
220
220
# if _WIN32
221
221
int id = MessageBox(0, msg, title, MB_YESNO | MB_ICONWARNING);
222
222
lua_pushboolean(L, id == IDYES);
223
-
224
223
# else
225
224
SDL_MessageBoxButtonData buttons[] = {
226
225
{ SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT, 1, "Yes" },
···
236
235
SDL_ShowMessageBox(&data, &buttonid);
237
236
lua_pushboolean(L, buttonid == 1);
238
237
# endif
238
+
239
239
return 1;
240
240
}
241
241
+1
-1
src/main.c
+1
-1
src/main.c
···
56
56
{
57
57
# ifdef _WIN32
58
58
HINSTANCE lib = LoadLibrary("user32.dll");
59
-
int (*SetProcessDPIAware)() = (void*) GetProcAddress(lib, "SetProcessDPIAware");
59
+
int (*SetProcessDPIAware)() = (void *)GetProcAddress(lib, "SetProcessDPIAware");
60
60
SetProcessDPIAware();
61
61
# endif
62
62
+6
-6
src/rencache.c
+6
-6
src/rencache.c
···
117
117
}
118
118
else
119
119
{
120
-
*prev = (Command *)(((char*) *prev) + (*prev)->size);
120
+
*prev = (Command *)(((char *)*prev) + (*prev)->size);
121
121
}
122
122
123
123
return *prev != ((Command *)(command_buf + command_buf_idx));
···
218
218
int x2 = (r.x + r.width) / CELL_SIZE;
219
219
int y2 = (r.y + r.height) / CELL_SIZE;
220
220
221
-
for (int y = y1; y <= y2; y++)
221
+
for (int y = y1 ; y <= y2 ; y++)
222
222
{
223
-
for (int x = x1; x <= x2; x++)
223
+
for (int x = x1 ; x <= x2 ; x++)
224
224
{
225
225
int idx = cell_idx(x, y);
226
226
hash(&cells[idx], &h, sizeof(h));
···
232
232
static void push_rect(RenRect r, int *count)
233
233
{
234
234
/* try to merge with existing rectangle */
235
-
for (int i = *count - 1; i >= 0; i--)
235
+
for (int i = *count - 1 ; i >= 0 ; i--)
236
236
{
237
237
RenRect *rp = &rect_buf[i];
238
238
if (rects_overlap(*rp, r))
···
271
271
int rect_count = 0;
272
272
int max_x = screen_rect.width / CELL_SIZE + 1;
273
273
int max_y = screen_rect.height / CELL_SIZE + 1;
274
-
for (int y = 0; y < max_y; y++)
274
+
for (int y = 0 ; y < max_y; y++)
275
275
{
276
-
for (int x = 0; x < max_x; x++)
276
+
for (int x = 0 ; x < max_x ; x++)
277
277
{
278
278
/* compare previous and current cell for change */
279
279
int idx = cell_idx(x, y);
+18
-19
src/renderer.c
+18
-19
src/renderer.c
···
162
162
/* convert 8bit data to 32bit */
163
163
for (int i = width * height - 1; i >= 0; i--)
164
164
{
165
-
uint8_t n = *((uint8_t*) set->image->pixels + i);
165
+
uint8_t n = *((uint8_t *)set->image->pixels + i);
166
166
set->image->pixels[i] = (RenColor) { .r = 255, .g = 255, .b = 255, .a = n };
167
167
}
168
168
···
232
232
233
233
void ren_free_font(RenFont *font)
234
234
{
235
-
for (int i = 0; i < MAX_GLYPHSET; i++)
235
+
for (int i = 0 ; i < MAX_GLYPHSET ; i++)
236
236
{
237
237
GlyphSet *set = font->sets[i];
238
238
if (set)
···
303
303
}
304
304
305
305
306
-
#define rect_draw_loop(expr) do { \
307
-
for (int j = y1; j < y2; j++) \
306
+
#define rect_draw_loop(expr) \
307
+
for (int j = y1 ; j < y2 ; j++) \
308
+
{ \
309
+
for (int i = x1 ; i < x2 ; i++) \
308
310
{ \
309
-
for (int i = x1; i < x2; i++) \
310
-
{ \
311
-
*d = expr; \
312
-
d++; \
313
-
} \
314
-
d += dr; \
311
+
*d = expr; \
312
+
d++; \
315
313
} \
316
-
} while (0)
314
+
d += dr; \
315
+
}
317
316
318
317
void ren_draw_rect(RenRect rect, RenColor color)
319
318
{
···
333
332
int dr = surf->w - (x2 - x1);
334
333
335
334
if (color.a == 0xff)
335
+
{
336
336
rect_draw_loop(color);
337
+
}
337
338
else
339
+
{
338
340
rect_draw_loop(blend_pixel(*d, color));
341
+
}
339
342
}
340
343
341
344
···
346
349
347
350
/* clip */
348
351
int n;
349
-
if ((n = clip.left - x) > 0)
350
-
sub->width -= n; sub->x += n; x += n;
351
-
if ((n = clip.top - y) > 0)
352
-
sub->height -= n; sub->y += n; y += n;
353
-
if ((n = x + sub->width - clip.right ) > 0)
354
-
sub->width -= n;
355
-
if ((n = y + sub->height - clip.bottom) > 0)
356
-
sub->height -= n;
352
+
if ((n = clip.left - x) > 0) { sub->width -= n; sub->x += n; x += n; }
353
+
if ((n = clip.top - y) > 0) { sub->height -= n; sub->y += n; y += n; }
354
+
if ((n = x + sub->width - clip.right ) > 0) { sub->width -= n; }
355
+
if ((n = y + sub->height - clip.bottom) > 0) { sub->height -= n; }
357
356
358
357
if (sub->width <= 0 || sub->height <= 0)
359
358
return;