Skip to content

Commit 8526b8e

Browse files
committed
BLACKBOX
1 parent eec41f5 commit 8526b8e

File tree

131 files changed

+106
-97
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

131 files changed

+106
-97
lines changed

.gitignore

100644100755
File mode changed.

.vscode/c_cpp_properties.json

100644100755
File mode changed.

.vscode/launch.json

100644100755
+7-7
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"name": "Heavy Debug",
1010
"type": "cppdbg",
1111
"request": "launch",
12-
"program": "${workspaceFolder}/csol",
12+
"program": "${workspaceFolder}/gomps4",
1313
"args": ["--nolerp","--noflip","--noload","-w","1024","--height","1024","Quick Win"],
1414
"stopAtEntry": false,
1515
"cwd": "${workspaceFolder}",
@@ -27,7 +27,7 @@
2727
"name": "Launch",
2828
"type": "cppdbg",
2929
"request":"launch",
30-
"program":"${workspaceRoot}/csol",
30+
"program":"${workspaceRoot}/gomps4",
3131
"miDebuggerPath": "/usr/bin/gdb",
3232
},
3333
"preLaunchTask": "build debug"
@@ -36,7 +36,7 @@
3636
"name": "Debug",
3737
"type": "cppdbg",
3838
"request": "launch",
39-
"program": "${workspaceFolder}/csol",
39+
"program": "${workspaceFolder}/gomps4",
4040
"args": ["--pack=default"],
4141
"stopAtEntry": false,
4242
"cwd": "${workspaceFolder}",
@@ -54,7 +54,7 @@
5454
"name": "Launch",
5555
"type": "cppdbg",
5656
"request":"launch",
57-
"program":"${workspaceRoot}/csol",
57+
"program":"${workspaceRoot}/gomps4",
5858
"miDebuggerPath": "/usr/bin/gdb",
5959
},
6060
"preLaunchTask": "build debug"
@@ -63,7 +63,7 @@
6363
"name": "Fallback",
6464
"type": "cppdbg",
6565
"request": "launch",
66-
"program": "${workspaceFolder}/csol",
66+
"program": "${workspaceFolder}/gomps4",
6767
"args": ["--variant=Fallback","--noload"],
6868
"stopAtEntry": false,
6969
"cwd": "${workspaceFolder}",
@@ -81,7 +81,7 @@
8181
"name": "Launch",
8282
"type": "cppdbg",
8383
"request":"launch",
84-
"program":"${workspaceRoot}/csol",
84+
"program":"${workspaceRoot}/gomps4",
8585
"miDebuggerPath": "/usr/bin/gdb",
8686
},
8787
"preLaunchTask": "build debug"
@@ -101,7 +101,7 @@
101101
"name": "Launch",
102102
"type": "cppdbg",
103103
"request":"launch",
104-
"program":"${workspaceRoot}/csol",
104+
"program":"${workspaceRoot}/gomps4",
105105
"miDebuggerPath": "/usr/bin/gdb"
106106
},
107107
"preLaunchTask": "build release",

.vscode/settings.json

100644100755
-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,5 @@
1616
"raylib.h": "c",
1717
"typeinfo": "c",
1818
"string.h": "c",
19-
"util.h": "c"
2019
}
2120
}

.vscode/tasks.json

100644100755
File mode changed.

Makefile

100644100755
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# https://www.gnu.org/software/make/manual/make.html
22
# make -recon
33

4-
PROJECT_NAME ?= csol
4+
PROJECT_NAME ?= gomps4
55
BUILD_MODE ?= DEBUG
66
EXECUTABLE ?= $(PROJECT_NAME)
77

Makefile.Android

100644100755
File mode changed.

Makefile.old

100644100755
File mode changed.

array.c

100644100755
File mode changed.

array.h

100644100755
File mode changed.

assets/Acme-Regular.ttf

100644100755
File mode changed.

assets/Makefile

100644100755
File mode changed.

assets/Roboto-Regular.ttf

100644100755
File mode changed.

assets/appicon.png

100644100755
File mode changed.

assets/appicon.xcf

100644100755
File mode changed.

assets/cards71x96.png

100644100755
File mode changed.

assets/icons.png

100644100755
File mode changed.

assets/lessblockycards71x96.png

100644100755
File mode changed.

assets/playingCardBacks.png

100644100755
File mode changed.

assets/playingCardBacks48.png

100644100755
File mode changed.

assets/playingCardBacks64.png

100644100755
File mode changed.

assets/playingCardBacks96.png

100644100755
File mode changed.

assets/playingCards.png

100644100755
File mode changed.

assets/playingCards48.png

100644100755
File mode changed.

assets/playingCards64.png

100644100755
File mode changed.

assets/playingCards96.png

100644100755
File mode changed.

assets/spritesheet simple 140x190.png

100644100755
File mode changed.

assets/spritesheet simple 47x63.png

100644100755
File mode changed.

assets/spritesheet simple 93x127.png

100644100755
File mode changed.

assets/spritesheet simple back 140x190.png

100644100755
File mode changed.

assets/spritesheet simple back 47x63.png

100644100755
File mode changed.

assets/spritesheet simple back 93x127.png

100644100755
File mode changed.

assets/svg/DeckCards.svg

100644100755
File mode changed.

assets/svg/playingCards.svg

100644100755
File mode changed.

assets/svg/playingCards_back.svg

100644100755
File mode changed.

assets/test.png

100644100755
File mode changed.

assets/windows_16bit_cards.png

100644100755
File mode changed.

baize.c

100644100755
+1-1
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ void BaizeResetState(struct Baize *const self, struct Array *undoStack)
175175
}
176176
self->undoStack = undoStack ? undoStack : UndoStackNew();
177177

178-
self->savedPosition = 0;
178+
self->bookmark = 0;
179179

180180
self->touchedPile = NULL;
181181
self->touchedWidget = NULL;

baize.h

100644100755
+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ struct Baize {
3333

3434
struct Array *tail;
3535
struct Array *undoStack;
36-
size_t savedPosition;
36+
size_t bookmark;
3737
Vector2 lastTouch;
3838
struct Pile *touchedPile;
3939

card.c

100644100755
+3-1
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,7 @@ static void DrawUnicodeCard(struct Card *const self, struct Pack *const pack, _B
282282
DrawTextCodepoint(pack->unicodeFont, glyph, cpos, pack->width * pack->unicodeFontExpansion, cardColor);
283283
}
284284

285+
#if 0
285286
static void DrawScaledCard(struct Card *const self, struct Pack *const pack, _Bool showFace)
286287
{
287288
static int suitSymbol[4] = {
@@ -313,6 +314,7 @@ static void DrawScaledCard(struct Card *const self, struct Pack *const pack, _Bo
313314
DrawRectangleRoundedLines(rc, pack->roundness, 9, 2.0f, (Color){192,192,192,255}); // Silver
314315
}
315316
}
317+
#endif
316318

317319
void CardDraw(struct Card *const self)
318320
{
@@ -397,7 +399,7 @@ void CardDraw(struct Card *const self)
397399
} else if (pack->unicodeFont.baseSize) {
398400
DrawUnicodeCard(self, pack, showFace);
399401
} else {
400-
DrawScaledCard(self, pack, showFace);
402+
// DrawScaledCard(self, pack, showFace);
401403
}
402404
}
403405

card.h

100644100755
File mode changed.

cell.c

100644100755
File mode changed.

cell.h

100644100755
File mode changed.

command.c

100644100755
File mode changed.

command.h

100644100755
File mode changed.

constraint.c

100644100755
File mode changed.

constraint.h

100644100755
File mode changed.

container.c

100644100755
File mode changed.

csol

-2.21 MB
Binary file not shown.

csol.settings.lua

100644100755
File mode changed.

discard.c

100644100755
File mode changed.

discard.h

100644100755
File mode changed.

drawer.c

100644100755
File mode changed.

driface.c

100644100755
File mode changed.

driface.h

100644100755
File mode changed.

fallback.c

100644100755
File mode changed.

foundation.c

100644100755
File mode changed.

foundation.h

100644100755
File mode changed.

freecell.c

100644100755
File mode changed.

gomps4

2.21 MB
Binary file not shown.

iconwidget.c

100644100755
File mode changed.

klondike.c

100644100755
File mode changed.

label.c

100644100755
File mode changed.

label.h

100644100755
File mode changed.

lua_settings.c

100644100755
File mode changed.

luautil.c

100644100755
File mode changed.

luautil.h

100644100755
File mode changed.

main.c

100644100755
+1-1
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ int main(int argc, char* argv[], char* envp[])
171171
// fprintf(stderr, "%d:%d,%d\n", n, w, h);
172172
// }
173173

174-
InitWindow(640*2, 480*2, "Oddstream Solitaire");
174+
InitWindow(640*2, 480*2, "Solitaire");
175175

176176
#ifdef PLATFORM_DESKTOP
177177
if (windowWidth == 0 || windowHeight == 0) {

moon.c

100644100755
File mode changed.

moon.h

100644100755
File mode changed.

moongame.c

100644100755
File mode changed.

navdrawer.c

100644100755
File mode changed.

pack.c

100644100755
File mode changed.

pack.h

100644100755
File mode changed.

pile.c

100644100755
File mode changed.

pile.h

100644100755
File mode changed.

pilevtable.c

100644100755
File mode changed.

reserve.c

100644100755
File mode changed.

reserve.h

100644100755
File mode changed.

scrunch.c

100644100755
File mode changed.

scrunch.h

100644100755
File mode changed.

settings.h

100644100755
File mode changed.

spritesheet.c

100644100755
File mode changed.

spritesheet.h

100644100755
File mode changed.

statusbar.c

100644100755
+3-5
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,17 @@ struct StatusBar* StatusBarNew(void)
2828

2929
void StatusBarLayoutWidgets(struct Container *const self)
3030
{
31-
const float padding = (14.0f);
32-
3331
size_t index;
3432
for ( struct Widget *w = ArrayFirst(self->widgets, &index); w; w = ArrayNext(self->widgets, &index) ) {
3533
switch (w->align) {
3634
case -1:
37-
w->rect.x = 0.0f + padding;
35+
w->rect.x = 0.0f + WIDGET_PADDING;
3836
break;
3937
case 0:
40-
w->rect.x = (self->rect.width / 2.0f) - (w->rect.width / 2.0f);
38+
w->rect.x = (self->rect.width - w->rect.width) / 2.0f;
4139
break;
4240
case 1:
43-
w->rect.x = self->rect.width - w->rect.width - padding;
41+
w->rect.x = self->rect.width - w->rect.width - WIDGET_PADDING;
4442
break;
4543
default:
4644
break;

stock.c

100644100755
File mode changed.

stock.h

100644100755
File mode changed.

tableau.c

100644100755
File mode changed.

tableau.h

100644100755
File mode changed.

textwidget.c

100644100755
+33-16
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ struct TextWidget* TextWidgetNew(struct Container *parent, enum IconName frame,
2323
self->font = font;
2424
self->fontSize = fontSize;
2525
self->text = NULL;
26-
self->mte = (Vector2){0};
2726
}
2827
return self;
2928
}
@@ -32,21 +31,24 @@ void TextWidgetSetText(struct TextWidget *const self, const char* text)
3231
{
3332
extern float fontSpacing;
3433

35-
if ( self->text ) {
34+
if (self->text) {
3635
free(self->text);
3736
self->text = NULL;
3837
}
39-
if ( text ) {
38+
if (text) {
4039
self->text = UtilStrDup(text);
41-
self->mte = MeasureTextEx(*(self->font), text, self->fontSize, fontSpacing);
42-
if ( self->frame == NONE ) {
43-
self->super.rect.width = self->mte.x;
44-
self->super.rect.height = self->mte.y;
40+
Vector2 mte = MeasureTextEx(*(self->font), self->text, self->fontSize, fontSpacing);
41+
if (self->frame == NONE) {
42+
self->super.rect.width = mte.x;
43+
self->super.rect.height = mte.y;
4544
} else {
46-
self->super.rect.width = ICON_SIZE + self->mte.x;
47-
self->super.rect.height = ICON_SIZE + self->mte.y;
45+
self->super.rect.width = ICON_SIZE + WIDGET_PADDING + mte.x;
46+
self->super.rect.height = ICON_SIZE;
4847
}
4948
}
49+
// the size of this widget has changed, so it needs to be repositioned in it's parent container
50+
struct Widget *w = (struct Widget*)self;
51+
w->parent->vtable->Layout(w->parent, GetScreenWidth(), GetScreenHeight());
5052
}
5153

5254
void TextWidgetDraw(struct Widget *const self)
@@ -62,36 +64,51 @@ void TextWidgetDraw(struct Widget *const self)
6264
Vector2 pos;
6365
pos.x = con->rect.x + self->rect.x;
6466
pos.y = con->rect.y + self->rect.y;
67+
68+
// draw the icon, if there is one
6569
if ( tw->frame != NONE ) {
6670
extern struct Spritesheet *ssIcons;
67-
Rectangle rectIcon = WidgetScreenRect(&(tw->super));
71+
Rectangle rectIcon = WidgetScreenRect((struct Widget*)tw);
6872
rectIcon.width = ICON_SIZE;
6973
rectIcon.height = ICON_SIZE;
7074

7175
if (!UtilRectangleWithinRectangle(rectIcon, con->rect)) {
76+
#ifdef _DEBUG
77+
Rectangle r = WidgetScreenRect((struct Widget*)tw);
78+
DrawRectangleLines(r.x, r.y, r.width, r.height, RED);
79+
#endif
7280
return;
7381
}
7482
if ( self->bcf && CheckCollisionPointRec(GetMousePosition(), WidgetScreenRect(self)) ) {
7583
rectIcon.x += 2.0f;
7684
rectIcon.y += 2.0f;
7785
}
7886
SpritesheetDraw(ssIcons, tw->frame, 1.0f, 0.0f, rectIcon);
79-
80-
pos.x += ICON_SIZE;
8187
}
88+
89+
// draw the text to the right of the icon
8290
if ( tw->text ) {
83-
Rectangle rectText = WidgetScreenRect(&(tw->super));
84-
if (!UtilRectangleWithinRectangle(rectText, con->rect)) {
85-
return;
86-
}
91+
Rectangle rectText = WidgetScreenRect((struct Widget*)tw);
92+
8793
if ( tw->frame != NONE ) {
94+
pos.x += ICON_SIZE;
8895
pos.x += WIDGET_PADDING;
8996
pos.y += WIDGET_PADDING / 2.0f;//self->parent->rect.y + (ICON_SIZE / 2.0f) - (self->rect.height / 2.0f);
9097
}
98+
99+
if (!UtilRectangleWithinRectangle(rectText, con->rect)) {
100+
#ifdef _DEBUG
101+
Rectangle r = WidgetScreenRect((struct Widget*)tw);
102+
DrawRectangleLines(r.x, r.y, r.width, r.height, RED);
103+
#endif
104+
return;
105+
}
106+
91107
if ( self->bcf && CheckCollisionPointRec(GetMousePosition(), WidgetScreenRect(self)) ) {
92108
pos.x += 2.0f;
93109
pos.y += 2.0f;
94110
}
111+
95112
DrawTextEx(*(tw->font), tw->text, pos, tw->fontSize, fontSpacing, uiTextColor);
96113
}
97114

titlebar.c

100644100755
File mode changed.

toast.c

100644100755
File mode changed.

trace.h

100644100755
+12-3
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,19 @@
22

33
#include <stdio.h>
44

5-
#define CSOL_INFO(x, ...) do{fprintf(stdout, "INFO: %s: " x "\n", __func__, ##__VA_ARGS__);}while(0)
5+
#define TERM_RED "\x1B[31m"
6+
#define TERM_GRN "\x1B[32m"
7+
#define TERM_YEL "\x1B[33m"
8+
#define TERM_BLU "\x1B[34m"
9+
#define TERM_MAG "\x1B[35m"
10+
#define TERM_CYN "\x1B[36m"
11+
#define TERM_WHT "\x1B[37m"
12+
#define TERM_RESET "\x1B[0m"
13+
14+
#define CSOL_INFO(x, ...) do{fprintf(stdout, TERM_GRN "INFO: %s: " x "\n" TERM_RESET, __func__, ##__VA_ARGS__);}while(0)
615
#ifdef _DEBUG
7-
#define CSOL_WARNING(x, ...) do{fprintf(stderr, "\x1B[33mWARNING: %s: " x "\n", __func__, ##__VA_ARGS__);}while(0)
8-
#define CSOL_ERROR(x, ...) do{fprintf(stderr, "\x1B[31mERROR: %s: " x "\n", __func__, ##__VA_ARGS__);}while(0)
16+
#define CSOL_WARNING(x, ...) do{fprintf(stderr, TERM_YEL "WARNING: %s: " x "\n" TERM_RESET, __func__, ##__VA_ARGS__);}while(0)
17+
#define CSOL_ERROR(x, ...) do{fprintf(stderr, TERM_RED "ERROR: %s: " x "\n" TERM_RESET, __func__, ##__VA_ARGS__);}while(0)
918
#else
1019
#define CSOL_WARNING(x, ...)
1120
#define CSOL_ERROR(x, ...)

ui.c

100644100755
File mode changed.

ui.h

100644100755
-3
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,12 @@ struct WidgetVtable {
4747
void (*Update)(struct Widget *const self);
4848
void (*Draw)(struct Widget *const self);
4949
void (*Free)(struct Widget *const self);
50-
// NotifyCallback
5150
};
5251

5352
struct Widget {
5453
struct WidgetVtable *vtable;
5554
struct Container *parent;
5655
int align; // alignment in parent container: left=-1, center=0, right=+1
57-
// _Bool disabled;
5856
CommandFunction bcf;
5957
void* param; // NULL, or a pointer to a block of memory, owned by the widget
6058
Rectangle rect; // x, y relative to parent
@@ -80,7 +78,6 @@ struct TextWidget {
8078
Font *font;
8179
float fontSize;
8280
char *text;
83-
Vector2 mte; // cached result from MeasureTextEx()
8481
};
8582

8683
struct TextWidget* TextWidgetNew(struct Container *parent, enum IconName frame, Font *font, float fontSize, int align, CommandFunction cf, void* param);

0 commit comments

Comments
 (0)