Skip to content

Commit 61d1ece

Browse files
committed
feat(window): add redirectLogs parameter
1 parent 3e992e2 commit 61d1ece

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

SharpEngine.Core/Window.cs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ public Scene CurrentScene
210210
/// <param name="debug">Debug Mode (false)</param>
211211
/// <param name="consoleLog">Log in Console</param>
212212
/// <param name="fileLog">Log in File (log.txt)</param>
213+
/// <param name="redirectLogs">Redirect Logs</param>
213214
public Window(
214215
int width,
215216
int height,
@@ -218,9 +219,10 @@ public Window(
218219
int? fps = 60,
219220
bool debug = false,
220221
bool consoleLog = true,
221-
bool fileLog = false
222+
bool fileLog = false,
223+
bool redirectLogs = true
222224
)
223-
: this(new Vec2(width, height), title, backgroundColor, fps, debug, consoleLog, fileLog) { }
225+
: this(new Vec2(width, height), title, backgroundColor, fps, debug, consoleLog, fileLog, redirectLogs) { }
224226

225227
/// <summary>
226228
/// Create and Init Window
@@ -232,14 +234,16 @@ public Window(
232234
/// <param name="debug">Debug Mode (false)</param>
233235
/// <param name="consoleLog">Log in Console</param>
234236
/// <param name="fileLog">Log in File (log.txt)</param>
237+
/// <param name="redirectLogs">Redirect Logs</param>
235238
public Window(
236239
Vec2 screenSize,
237240
string title,
238241
Color? backgroundColor = null,
239242
int? fps = 60,
240243
bool debug = false,
241244
bool consoleLog = true,
242-
bool fileLog = false
245+
bool fileLog = false,
246+
bool redirectLogs = true
243247
)
244248
{
245249
InputManager.InternalWindow = this;
@@ -255,9 +259,12 @@ public Window(
255259
if (FileLog && File.Exists("log.txt"))
256260
File.Delete("log.txt");
257261

258-
unsafe
262+
if (redirectLogs)
259263
{
260-
Raylib.SetTraceLogCallback(&LogCustom);
264+
unsafe
265+
{
266+
Raylib.SetTraceLogCallback(&LogCustom);
267+
}
261268
}
262269

263270
Raylib.InitWindow((int)screenSize.X, (int)screenSize.Y, title);

0 commit comments

Comments
 (0)