Skip to content

Commit 5cc15e4

Browse files
committed
mayor change: Crash Handler
1 parent e9255ba commit 5cc15e4

File tree

21 files changed

+268
-113
lines changed

21 files changed

+268
-113
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ A code probably similar to one from [HaxeFlixel](https://haxeflixel.com) right?
6868
- [x] Wii U Gamepad Gyroscope
6969
- [x] Wii U Gamepad Touchscreen
7070
- [x] Wii U Gamepad Touchscreen touch position and click
71-
- [ ] Wii U Gamepad Touchscreen LCD brightness control
72-
- [ ] Wii U Gamepad Camera
73-
- [ ] Wii U Gamepad Microphone
71+
- [ ] Wii U Gamepad Touchscreen LCD brightness control (Not necessary for now)
72+
- [ ] Wii U Gamepad Camera (not necessary for now)
73+
- [ ] Wii U Gamepad Microphone (Not necessary for now)
7474
- [x] Wii U Gamepad home button control
7575
- Objects
7676
- [x] Sprites
@@ -83,13 +83,13 @@ A code probably similar to one from [HaxeFlixel](https://haxeflixel.com) right?
8383
- [x] Sprites basic physics
8484
- [x] Tweens and easing functions
8585
- [x] JSONs file support (Only decoding)
86-
- [x] Timers (Using [``haxe.Timer``](https://api.haxe.org/haxe/Timer.html))
86+
- [x] Timers
8787
- [x] HTTP requests (Via CURL)
8888
- Engine rendering modes
8989
- [x] Only on the Wii U Gamepad (-> ``DRC``)
9090
- [x] Only on the TV (-> ``TV``)
9191
- [x] Both (-> ``UNIQUE``)
92-
- [ ] Separate rendering (Wii U Gamepad and TV independent at the same time)
92+
- [ ] Separate rendering (Wii U Gamepad and TV independent at the same time -> ``DUAL``)
9393
- [x] FileSystem manipulation
9494
- [ ] Engine cameras
9595

docs/wiki/Getting-Started.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ haxelib git hxu_vorbis https://github.com/Haxe-WiiU/HxU_Vorbis.git
2424
haxelib git hxu_jansson https://github.com/Haxe-WiiU/HxU_Jansson.git
2525
```
2626

27-
Now get or compile the compiler, [HxCompileU](https://github.com/Slushi-Github/hxCompileU) in version 1.5.0 or higher, and add the executable to your project folder.
27+
Now get or compile the compiler, [HxCompileU](https://github.com/Slushi-Github/hxCompileU) in version 1.5.1 or higher, and add the executable to your project folder.
2828

2929
Now you need the DevKitPro dependencies:
3030

@@ -52,7 +52,7 @@ When you have everything, install the following:
5252
Now you're ready to start coding!
5353

5454
# Using the engine
55-
You can copy the required ``hxCompileUConfig.json`` file to your project folder, [you can find it here](https://github.com/Slushi-Github/leafyEngine/blob/main/hxCompileUConfig.json), or you can implement it yourself using the following command:
55+
You can copy the required ``hxCompileUConfig.json`` file to your project folder, [you can find it here](https://github.com/Slushi-Github/leafyEngine/blob/main/hxCompileUConfig.json), or you can import it yourself using the following command:
5656

5757
```bash
5858
haxeCompileU --import leafyEngine
@@ -71,9 +71,10 @@ class Main {
7171
public static function main() {
7272
/*
7373
"YOUR_GAME" = The name of your game, this will be the name of the folder where you'll find your assets
74-
DRC = Display the game on the Wii U Gamepad
75-
TV = Display the game on the TV
76-
UNIQUE = Display the game on a unique screen (Gamepad and TV)
74+
Engine render modes:
75+
DRC = Display the game on the Wii U Gamepad
76+
TV = Display the game on the TV
77+
UNIQUE = Display the game on a unique screen (Gamepad and TV)
7778
``YOUR_STATE()`` = The class of the state (LfState) you want to start the game in
7879
*/
7980
LfEngine.initEngine("YOUR_GAME", DRC, new YOUR_STATE());
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Debugging the engine
2+
3+
Leafy Engine isn't really stable, is it? So you need to know what goes wrong when a crash occurs, whether in an emulator or on the actual hardware. The engine provides you with some tools to make that easier.
4+
5+
## Using the debugger
6+
7+
With ``leafy.backend.LeafyDebug``, the debugger is used for logs that are saved in the “leafyLogs” folder in ``/fs/vol/external01/wiiu/``.
8+
9+
```haxe
10+
import leafy.backend.LeafyDebug;
11+
12+
// log a message
13+
LeafyDebug.log("Hello world!", LogLevel.INFO);
14+
15+
// log an error
16+
LeafyDebug.log("Error: something went wrong", LogLevel.ERROR);
17+
```
18+
19+
--------
20+
21+
If there is something you did that, in case of failure, should prevent the program from continuing, there is a function to stop the console and display an error on the screen, as well as saving it in the log file.
22+
23+
```haxe
24+
import leafy.backend.LeafyDebug;
25+
26+
// stop the console
27+
LeafyDebug.criticalError("something went wrong");
28+
```
29+
30+
--------
31+
32+
## The crash handler
33+
34+
The crash handler is used when the engine crashes. The crash handler is used to log the Haxe call stack and error message in the log file and display it on the screen, This should not be used directly, automatically when a critical error occurs, the crash handler appears.
35+
#### Note: The crash handler in Leafy Engine is considered to be truly experimental, so I cannot guarantee that it will work properly in every case of an error that may occur at runtime.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# HTTP requests via CURL
2+
3+
```haxe
4+
// Import the LfCurlRequest class
5+
import leafy.network.LfCurlRequest;
6+
7+
/*
8+
Make the request and get the result as a string variable
9+
This example may not work, it's just an example
10+
*/
11+
var requestResult:String = LfCurlRequest.httpRequest("https://google.com", LfCurlRequestMethod.GET, "", []);
12+
```
13+
14+
--------
15+
16+
See [``LfCurlRequest``](https://github.com/Slushi-Github/leafyEngine/blob/main/leafy/network/LfCurlRequest.hx)
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# JSONs
2+
3+
The ``LfJson`` class is used to parse a JSON file or string.
4+
5+
JSON file content Example:
6+
7+
```json
8+
{
9+
"name": "John Doe",
10+
"age": 30,
11+
"hobbies": ["reading", "coding", "playing video games"],
12+
}
13+
```
14+
15+
To parse a JSON file:
16+
17+
```haxe
18+
import Std;
19+
// import the LfJSON class
20+
import leafy.backend.LfJson;
21+
22+
// parse the JSON file
23+
var json:LeafyJson = LfJson.parseJsonFile("GAME_PATH/file.json");
24+
25+
// access the JSON data
26+
var name:String = LfJson.getStringFromJson(json, "name");
27+
var age:Int = Std.int(LfJson.getNumberFromJson(json, "age"));
28+
var hobbies:Array<String> = LfJson.getArrayStringFromJson(json, "hobbies");
29+
30+
// Free the JSON object after using it
31+
LfJson.freeJson(json);
32+
```
33+
34+
--------
35+
36+
See [``LfJson``](https://github.com/Slushi-Github/leafyEngine/blob/main/leafy/backend/LfJson.hx)
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# Objects
2+
3+
Objects are used to create graphics, texts, or buttons.
4+
5+
## LfSprite
6+
7+
The ``LfSprite`` class is used to create a sprite, with a image or graphic.
8+
9+
```haxe
10+
// import the LfSprite class
11+
import leafy.objects.LfSprite;
12+
13+
// create a sprite in your state
14+
var sprite:LfSprite = new LfSprite(100, 100);
15+
16+
/*
17+
Create a graphic
18+
The ``createGraphic`` function takes 3 parameters, the width, height and the color of the graphic.
19+
*/
20+
sprite.createGraphic(200, 200, [255, 0, 0]);
21+
22+
// Load an image
23+
sprite.loadImage("GAME_PATH/image.png");
24+
25+
// add the sprite to the state
26+
addObject(sprite);
27+
```
28+
29+
--------
30+
31+
## LfText
32+
33+
The ``LfText`` class is used to create a sprite, with a text.
34+
35+
```haxe
36+
// import the LfText class
37+
import leafy.objects.LfText;
38+
39+
// create a text in your state
40+
var text:LfText = new LfText(100, 100, "Hello World!", 32, "GAME_PATH/FONT.ttf");
41+
42+
// add the text to the state
43+
addObject(text);
44+
```
45+
46+
--------
47+
48+
## LfButton
49+
50+
The ``LfButton`` class is used to create a button, with a image or graphic.
51+
52+
```haxe
53+
// import the LfButton class
54+
import leafy.objects.LfButton;
55+
56+
// create a button in your state.
57+
var button:LfButton = new LfButton(100, 100, function():Void {
58+
// do something
59+
});
60+
61+
/*
62+
Create a graphic
63+
The ``createGraphic`` function takes 3 parameters, the width, height and the color of the graphic.
64+
*/
65+
sprite.createGraphic(200, 200, [255, 0, 0]);
66+
67+
// Load an image
68+
sprite.loadImage("GAME_PATH/image.png");
69+
70+
// add the button to the state
71+
addObject(button);
72+
```
73+
74+
--------
75+
76+
See [``LfSprite``](https://github.com/Slushi-Github/leafyEngine/blob/main/leafy/objects/LfSprite.hx)
77+
78+
See [``LfText``](https://github.com/Slushi-Github/leafyEngine/blob/main/leafy/objects/LfText.hx)
79+
80+
See [``LfButton``](https://github.com/Slushi-Github/leafyEngine/blob/main/leafy/objects/LfButton.hx)

docs/wiki/sections/FolderSections/Sprites.md

Lines changed: 0 additions & 48 deletions
This file was deleted.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Timers
2+
3+
The ``LfTimer`` class is used to create a timer, with a duration and a callback function.
4+
5+
```haxe
6+
// import the LfTimer class
7+
import leafy.backend.LfTimer;
8+
9+
// create a timer in your state
10+
LfTimer.after(1000, function():Void {
11+
// do something
12+
});
13+
```
14+
15+
--------
16+
17+
See [``LfTimer``](https://github.com/Slushi-Github/leafyEngine/blob/main/leafy/backend/LfTimer.hx)

docs/wiki/sections/FolderSections/Tweens.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Tweens are used to move objects with a ease in the game.
77
import leafy.tweens.LfTween;
88
99
// create and start a tween
10-
var tween:LfTween = new LfTween(sprite, LfTweenProperty.X, sprite.x, 200, 3, LfTweenEase.ELASTIC_IN_OUT, function () {
10+
var tween:LfTween = new LfTween(sprite, LfTweenProperty.X, sprite.x, 200, 3, LfTweenEase.LINEAR, function ():Void {
1111
// do something when the tween is complete
1212
});
1313

docs/wiki/sections/FolderSections/WiiU_Gamepad.md

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -99,22 +99,6 @@ Leafy.wiiuGamepad.vibrate(1, -1);
9999
Leafy.wiiuGamepad.stopVibration();
100100
```
101101

102-
<!-- --------
103-
104-
For the screen brightness, it would be done in this way:
105-
```haxe
106-
// import the Leafy class
107-
import leafy.Leafy;
108-
109-
// set the brightness of the screen
110-
Leafy.wiiuGamepad.setScreenBrightness(brightness:LfGamepadScreenBrightness);
111-
Leafy.wiiuGamepad.setScreenBrightness(BRIGHTNESS_3);
112-
113-
// get the brightness of the screen
114-
var brightness:LfGamepadScreenBrightness = Leafy.wiiuGamepad.getScreenBrightness();
115-
```
116-
The brightness modes can be found on the enum [``leafy.gamepad.LfGamepad.LfGamepadScreenBrightness``](https://github.com/Slushi-Github/leafyEngine/blob/main/leafy/gamepad/LfGamepad.hx) -->
117-
118102
--------
119103

120104
See [``LfGamepad``](https://github.com/Slushi-Github/leafyEngine/blob/main/leafy/gamepad/LfGamepad.hx)

0 commit comments

Comments
 (0)