Skip to content
This repository was archived by the owner on Aug 15, 2025. It is now read-only.

Commit 12191e5

Browse files
committed
Better Documentation Update
1 parent f58395c commit 12191e5

File tree

6 files changed

+134
-11
lines changed

6 files changed

+134
-11
lines changed

source/applet.hpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,18 @@ void sendNotification(std::string title, std::string description);
4141
void popupError(errorConf errorCtx, std::string text);
4242

4343
/**
44-
* @brief Reads the input text from user and returns the string result.
45-
* @return String with text inputted to user.
44+
* @brief Reads the input text from user and returns the string result.
45+
*
46+
* This will use the SWKBD applet to launch the text and then return string inputted from the user.
47+
*
48+
* @return String with text inputted to user.
49+
*
50+
* #### Example Usage:
51+
* ```
52+
* std::string newInput = dsge::Applet::swkbdGetInput();
53+
*
54+
* print(newInput);
55+
* ```
4656
*/
4757
std::string swkbdGetInput();
4858

source/dsge.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ void init() {
8484
dsgeColor.white = 0xffffffff;
8585
dsgeColor.yellow = 0xff00ffff;
8686

87+
elapsed = 0;
8788
bgColor = 0xFF000000;
8889

8990
srand(time(NULL));

source/dsge.hpp

Lines changed: 106 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,32 +47,88 @@ namespace _internal {
4747
void _renderDebugText();
4848
}
4949

50-
// The external color for dsge.
50+
/**
51+
* @brief The external color for dsge.
52+
*
53+
* You cannot modify this, if you do, something may go wrong with the look of the colors and it may not look right.
54+
*
55+
* #### Example Usage:
56+
* ```
57+
* // Getting the green color:
58+
* dsge::dsgeColor.green // -> 0xff008000;
59+
*
60+
* // Getting the yellow color:
61+
* dsge::dsgeColor.yellow // -> 0xff00ffff;
62+
* ```
63+
*/
5164
extern color dsgeColor;
5265

53-
// Represents the amount of time in milliseconds that passed since last frame.
66+
/**
67+
* @brief Represents the amount of time in milliseconds that passed since last frame.
68+
*
69+
* You cannot modify this, since it always updates the variable every `dsge::Render()`
70+
*
71+
* #### Example Usage:
72+
* ```
73+
* // Run the rendering process
74+
* dsge::Render([&]() {
75+
* // Do something
76+
* });
77+
*
78+
* print(dsge::elapsed); // Returns the amount of time in millis
79+
* ```
80+
*/
5481
extern u64 elapsed;
5582

5683
/**
5784
* @brief Current background hex color when using the dsge::Render function.
5885
*
5986
* Be careful, if you are debugging and want to set the background color to white, the print output will blend with all of the whiteness! But not to fear, it'll output in the bottom screen instead.
87+
*
88+
* #### Example Usage:
89+
* ```
90+
* // Setting bgColor to something else:
91+
*
92+
* dsge::bgColor = dsge::dsgeColor.red; // Sets color to red
93+
* ```
6094
*/
6195
extern u32 bgColor;
6296

6397
/**
64-
* Initializes dsge and bring back the lives of your own 3DS Games.
98+
* @brief Initializes dsge and bring back the lives of your own 3DS Games.
6599
*
66100
* Note that if you try to initialize the same function again, there's likely bad things that is gonna happen so don't trigger twice!
101+
*
102+
* #### Example Usage:
103+
* ```
104+
* #include <dsge.hpp>
105+
*
106+
* int main() {
107+
* dsge::init(); // Here is where you init!
108+
*
109+
* // Rest of the functions below...
110+
* }
111+
* ```
67112
*/
68113
void init();
69114

70115
/**
71-
* Exits all of the needed libraries that DSGE needs
116+
* @brief Exits all of the needed libraries that DSGE needs
72117
*
73-
* Note that you must initialize this first, there's likely bad things that is gonna happen so don't trigger twice!
118+
* Note that you must initialize this to the very last of `int main`, especially `return dsge::exit()`.
74119
*
75120
* It always returns 0 no matter if it's a serious error.
121+
*
122+
* #### Example Usage:
123+
* ```
124+
* #include <dsge.hpp>
125+
*
126+
* int main() {
127+
* // Rest of the functions below...
128+
*
129+
* return dsge::exit(); // This is where you exit!
130+
* }
131+
* ```
76132
*/
77133
int exit();
78134

@@ -92,6 +148,29 @@ int exit();
92148
*/
93149
bool overlap(dsge::Sprite* obj1, dsge::Sprite* obj2);
94150

151+
/**
152+
* @brief Starts a function rendering that starts rendering the 3DS's top screen with what sprite renders you want to use.
153+
*
154+
* This can also render **debug** lines on the top left for clever lookarounds.
155+
*
156+
* #### Example Usage:
157+
* ```
158+
* // Test Sprite
159+
* dsge::Sprite newSprite(0, 0);
160+
* newSprite.makeGraphic(84, 84);
161+
*
162+
* // Test Text
163+
* dsge::Text newText(0, 0, "New Text!");
164+
*
165+
* while (aptMainLoop()) {
166+
* // Now render all of it!
167+
* dsge::render([&]() {
168+
* newSprite.render();
169+
* newText.render();
170+
* });
171+
* }
172+
* ```
173+
*/
95174
void render(std::function<void()> function);
96175

97176
// Public logging macro
@@ -102,10 +181,30 @@ void render(std::function<void()> function);
102181
#define print(message) ((void)0)
103182
#endif
104183

105-
// Width of your 3DS
184+
/**
185+
* @brief The current width of the 3DS.
186+
*
187+
* #### Warning:
188+
* NEVER EVER mess with this variable because it's use for screen center and a whole LOT more!! I suggest you to never set anything there.
189+
*
190+
* #### Example Usage:
191+
* ```
192+
* print(dsge::WIDTH); // Returns int 400
193+
* ```
194+
*/
106195
int WIDTH = 400;
107196

108-
// Height of your 3DS
197+
/**
198+
* @brief The current height of the 3DS.
199+
*
200+
* #### Warning:
201+
* NEVER EVER mess with this variable because it's use for screen center and a whole LOT more!! I suggest you to never set anything there.
202+
*
203+
* #### Example Usage:
204+
* ```
205+
* print(dsge::height); // Returns int 400
206+
* ```
207+
*/
109208
int HEIGHT = 240;
110209
}
111210

source/math.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ double distanceBetween(dsge::Sprite spriteA, dsge::Sprite spriteB);
2929
*
3030
* will extrapolate beyond the [a, b] range.
3131
*
32-
*
3332
* @param a The start value (returned when t = 0)
3433
* @param b The end value (returned when t = 1)
3534
* @param t The interpolation parameter (typically between 0 and 1)

source/sound.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ void resume(int channel);
6666
*
6767
* // Replaying a sound even if it doesn't exist anymore:
6868
* std::string sound = "sound.ogg";
69-
* int channel = dsge::Sound::play("sound.ogg");
69+
* channel = dsge::Sound::play("sound.ogg");
7070
*
7171
* dsge::Timer::start(5, [&]() {
7272
* if (!dsge::Sound::replay(channel)) {

source/tween.hpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,33 @@
1010
* These functions modify the progress value to create different animation effects.
1111
*
1212
* #### Easing Types:
13+
*
1314
* - LINEAR: No easing, linear progression
15+
*
1416
* - SINE_IN: Slow start, accelerating
17+
*
1518
* - SINE_OUT: Fast start, decelerating
19+
*
1620
* - SINE_IN_OUT: Slow start and end, fast middle
21+
*
1722
* - QUAD_IN: Quadratic easing in
23+
*
1824
* - QUAD_OUT: Quadratic easing out
25+
*
1926
* - QUAD_IN_OUT: Quadratic easing in and out
27+
*
2028
* - CUBIC_IN: Cubic easing in
29+
*
2130
* - CUBIC_OUT: Cubic easing out
31+
*
2232
* - CUBIC_IN_OUT: Cubic easing in and out
33+
*
2334
* - EXPO_IN: Exponential easing in
35+
*
2436
* - EXPO_OUT: Exponential easing out
37+
*
2538
* - EXPO_IN_OUT: Exponential easing in and out
39+
*
2640
*/
2741
typedef enum {
2842
EASE_LINEAR, // No easing

0 commit comments

Comments
 (0)