This repository has been archived by the owner on May 17, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Luís Ferreira <lsferreira169@gmail.com>
- Loading branch information
Showing
16 changed files
with
696 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"name": "aurorafw", | ||
"description": "A Powerful General Purpose Framework", | ||
"copyright": "Copyright © 2018, Aurora Framework", | ||
"license": "LGPL-3.0", | ||
"authors": [ | ||
"Luís Ferreira" | ||
], | ||
"targetType": "library", | ||
"targetPath": "out/bin", | ||
"targetName": "aurorafw", | ||
"sourcePaths": [ "src/source" ], | ||
"importPaths": [ "src/source" ], | ||
"dependencies": { | ||
":math": "*", | ||
":core": "*" | ||
}, | ||
"subPackages": [ | ||
"src/core", | ||
"src/math" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.dub | ||
out/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"name": "core", | ||
"targetType": "library", | ||
"targetPath": "out/bin", | ||
"sourcePaths": [ "source" ], | ||
"importPaths": [ "source" ] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
module aurorafw.core.appcontext; | ||
|
||
/**************************************************************************** | ||
** ┌─┐┬ ┬┬─┐┌─┐┬─┐┌─┐ ┌─┐┬─┐┌─┐┌┬┐┌─┐┬ ┬┌─┐┬─┐┬┌─ | ||
** ├─┤│ │├┬┘│ │├┬┘├─┤ ├┤ ├┬┘├─┤│││├┤ ││││ │├┬┘├┴┐ | ||
** ┴ ┴└─┘┴└─└─┘┴└─┴ ┴ └ ┴└─┴ ┴┴ ┴└─┘└┴┘└─┘┴└─┴ ┴ | ||
** A Powerful General Purpose Framework | ||
** More information in: https://aurora-fw.github.io/ | ||
** | ||
** Copyright (C) 2018 Aurora Framework, All rights reserved. | ||
** | ||
** This file is part of the Aurora Framework. This framework is free | ||
** software; you can redistribute it and/or modify it under the terms of | ||
** the GNU Lesser General Public License version 3 as published by the | ||
** Free Software Foundation and appearing in the file LICENSE included in | ||
** the packaging of this file. Please review the following information to | ||
** ensure the GNU Lesser General Public License version 3 requirements | ||
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. | ||
****************************************************************************/ | ||
|
||
import aurorafw.core.opt; | ||
import aurorafw.core.debugmanager; | ||
|
||
abstract class ApplicationContext { | ||
public: | ||
final this(string name = "AuroraFW Application", string[] args = null) | ||
{ | ||
_name = name; | ||
_opts = OptionHandler(args); | ||
_opts.add("afw-debug", "Enable the aurora built-in debug logger"); | ||
if(_opts.option("afw-debug").active) | ||
{ | ||
afwDebugFlag = true; | ||
debug trace(afwDebugFlag, "Debug is now enabled"); | ||
} | ||
|
||
debug trace(afwDebugFlag, "creating new application"); | ||
debug trace(afwDebugFlag, "application is created."); | ||
} | ||
|
||
pure ~this() @safe | ||
{ | ||
debug trace(afwDebugFlag, "application is destroyed."); | ||
} | ||
|
||
void onStart() @safe; | ||
void onClose() @safe; | ||
|
||
final void start() @safe | ||
{ | ||
debug trace(afwDebugFlag, "application is starting"); | ||
_internalStart(); | ||
onStart(); | ||
debug trace(afwDebugFlag, "application started"); | ||
} | ||
|
||
final void close() @safe | ||
{ | ||
debug trace(afwDebugFlag, "application is closing"); | ||
_internalClose(); | ||
onClose(); | ||
debug trace(afwDebugFlag, "application closed"); | ||
} | ||
|
||
pure @property string name() @safe { return _name; } | ||
pure @property string name(string name) @safe { return _name = name; } | ||
|
||
protected: | ||
void _internalSetName(string ) @safe; | ||
void _internalStart() @safe; | ||
void _internalClose() @safe; | ||
|
||
private: | ||
string _name; | ||
OptionHandler _opts; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
module aurorafw.core.application; | ||
|
||
/**************************************************************************** | ||
** ┌─┐┬ ┬┬─┐┌─┐┬─┐┌─┐ ┌─┐┬─┐┌─┐┌┬┐┌─┐┬ ┬┌─┐┬─┐┬┌─ | ||
** ├─┤│ │├┬┘│ │├┬┘├─┤ ├┤ ├┬┘├─┤│││├┤ ││││ │├┬┘├┴┐ | ||
** ┴ ┴└─┘┴└─└─┘┴└─┴ ┴ └ ┴└─┴ ┴┴ ┴└─┘└┴┘└─┘┴└─┴ ┴ | ||
** A Powerful General Purpose Framework | ||
** More information in: https://aurora-fw.github.io/ | ||
** | ||
** Copyright (C) 2018 Aurora Framework, All rights reserved. | ||
** | ||
** This file is part of the Aurora Framework. This framework is free | ||
** software; you can redistribute it and/or modify it under the terms of | ||
** the GNU Lesser General Public License version 3 as published by the | ||
** Free Software Foundation and appearing in the file LICENSE included in | ||
** the packaging of this file. Please review the following information to | ||
** ensure the GNU Lesser General Public License version 3 requirements | ||
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. | ||
****************************************************************************/ | ||
|
||
import core.stdc.stdlib : exit, EXIT_SUCCESS, EXIT_FAILURE; | ||
import aurorafw.core.debugmanager; | ||
|
||
struct Application { | ||
public: | ||
this(immutable shared string[] args, immutable void function(Application) func) | ||
{ | ||
this.args = args; | ||
foreach(string str; this.args) | ||
if(str == "--afw-debug") | ||
{ | ||
afwDebugFlag = true; | ||
debug trace(afwDebugFlag, "Debug is now enabled"); | ||
} | ||
|
||
func(this); | ||
} | ||
|
||
static void exitSuccess() @trusted | ||
{ | ||
debug trace(afwDebugFlag, "application return success code: ", EXIT_SUCCESS); | ||
exit(EXIT_SUCCESS); | ||
} | ||
|
||
static void exitFail() @trusted | ||
{ | ||
debug trace(afwDebugFlag, "application return error code: ", EXIT_FAILURE); | ||
exit(EXIT_FAILURE); | ||
} | ||
|
||
immutable shared string[] args; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
module aurorafw.core.debugmanager; | ||
|
||
/**************************************************************************** | ||
** ┌─┐┬ ┬┬─┐┌─┐┬─┐┌─┐ ┌─┐┬─┐┌─┐┌┬┐┌─┐┬ ┬┌─┐┬─┐┬┌─ | ||
** ├─┤│ │├┬┘│ │├┬┘├─┤ ├┤ ├┬┘├─┤│││├┤ ││││ │├┬┘├┴┐ | ||
** ┴ ┴└─┘┴└─└─┘┴└─┴ ┴ └ ┴└─┴ ┴┴ ┴└─┘└┴┘└─┘┴└─┴ ┴ | ||
** A Powerful General Purpose Framework | ||
** More information in: https://aurora-fw.github.io/ | ||
** | ||
** Copyright (C) 2018 Aurora Framework, All rights reserved. | ||
** | ||
** This file is part of the Aurora Framework. This framework is free | ||
** software; you can redistribute it and/or modify it under the terms of | ||
** the GNU Lesser General Public License version 3 as published by the | ||
** Free Software Foundation and appearing in the file LICENSE included in | ||
** the packaging of this file. Please review the following information to | ||
** ensure the GNU Lesser General Public License version 3 requirements | ||
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. | ||
****************************************************************************/ | ||
|
||
public import aurorafw.core.logger : trace; | ||
|
||
enum string debugMsgPrefix(string f = __FILE__, size_t l = __LINE__) { | ||
import std.conv : to; | ||
return f ~ ":" ~ l.to!string ~ ": "; | ||
} | ||
|
||
__gshared bool afwDebugFlag; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
module aurorafw.core.inputlistener; | ||
|
||
/**************************************************************************** | ||
** ┌─┐┬ ┬┬─┐┌─┐┬─┐┌─┐ ┌─┐┬─┐┌─┐┌┬┐┌─┐┬ ┬┌─┐┬─┐┬┌─ | ||
** ├─┤│ │├┬┘│ │├┬┘├─┤ ├┤ ├┬┘├─┤│││├┤ ││││ │├┬┘├┴┐ | ||
** ┴ ┴└─┘┴└─└─┘┴└─┴ ┴ └ ┴└─┴ ┴┴ ┴└─┘└┴┘└─┘┴└─┴ ┴ | ||
** A Powerful General Purpose Framework | ||
** More information in: https://aurora-fw.github.io/ | ||
** | ||
** Copyright (C) 2018 Aurora Framework, All rights reserved. | ||
** | ||
** This file is part of the Aurora Framework. This framework is free | ||
** software; you can redistribute it and/or modify it under the terms of | ||
** the GNU Lesser General Public License version 3 as published by the | ||
** Free Software Foundation and appearing in the file LICENSE included in | ||
** the packaging of this file. Please review the following information to | ||
** ensure the GNU Lesser General Public License version 3 requirements | ||
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. | ||
****************************************************************************/ | ||
|
||
pure @safe abstract class InputListener { | ||
struct KeyboardEvent { | ||
int key, scancode; | ||
ushort mods; | ||
} | ||
|
||
struct MouseButtonEvent { | ||
int btn; | ||
ushort mods; | ||
} | ||
|
||
struct MouseMotionEvent { | ||
double xpos, ypos; | ||
} | ||
|
||
struct MouseScrollEvent { | ||
double xoffset, yoffset; | ||
} | ||
|
||
~this() {} | ||
|
||
bool keyPressed(immutable ref KeyboardEvent ) | ||
{ return true; } | ||
|
||
bool keyReleased(immutable ref KeyboardEvent ) | ||
{ return true; } | ||
|
||
bool mousePressed(immutable ref MouseButtonEvent ) | ||
{ return true; } | ||
|
||
bool mouseReleased(immutable ref MouseButtonEvent ) | ||
{ return true; } | ||
|
||
bool mouseMoved(immutable ref MouseMotionEvent ) | ||
{ return true; } | ||
|
||
bool mouseScrolled(immutable ref MouseScrollEvent ) | ||
{ return true; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
module aurorafw.core.logger; | ||
|
||
/**************************************************************************** | ||
** ┌─┐┬ ┬┬─┐┌─┐┬─┐┌─┐ ┌─┐┬─┐┌─┐┌┬┐┌─┐┬ ┬┌─┐┬─┐┬┌─ | ||
** ├─┤│ │├┬┘│ │├┬┘├─┤ ├┤ ├┬┘├─┤│││├┤ ││││ │├┬┘├┴┐ | ||
** ┴ ┴└─┘┴└─└─┘┴└─┴ ┴ └ ┴└─┴ ┴┴ ┴└─┘└┴┘└─┘┴└─┴ ┴ | ||
** A Powerful General Purpose Framework | ||
** More information in: https://aurora-fw.github.io/ | ||
** | ||
** Copyright (C) 2018 Aurora Framework, All rights reserved. | ||
** | ||
** This file is part of the Aurora Framework. This framework is free | ||
** software; you can redistribute it and/or modify it under the terms of | ||
** the GNU Lesser General Public License version 3 as published by the | ||
** Free Software Foundation and appearing in the file LICENSE included in | ||
** the packaging of this file. Please review the following information to | ||
** ensure the GNU Lesser General Public License version 3 requirements | ||
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. | ||
****************************************************************************/ | ||
|
||
public import std.experimental.logger; |
Oops, something went wrong.