Skip to content
This repository has been archived by the owner on May 17, 2022. It is now read-only.

Commit

Permalink
initial import from old archive
Browse files Browse the repository at this point in the history
Signed-off-by: Luís Ferreira <lsferreira169@gmail.com>
  • Loading branch information
ljmf00 committed May 11, 2018
1 parent 4ca5f11 commit 54160fc
Show file tree
Hide file tree
Showing 16 changed files with 696 additions and 0 deletions.
22 changes: 22 additions & 0 deletions dub.json
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"
]
}
2 changes: 2 additions & 0 deletions src/core/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.dub
out/
7 changes: 7 additions & 0 deletions src/core/dub.json
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" ]
}
76 changes: 76 additions & 0 deletions src/core/source/aurorafw/core/appcontext.d
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;
}
52 changes: 52 additions & 0 deletions src/core/source/aurorafw/core/application.d
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;
}
28 changes: 28 additions & 0 deletions src/core/source/aurorafw/core/debugmanager.d
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;
59 changes: 59 additions & 0 deletions src/core/source/aurorafw/core/inputlistener.d
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; }
}
21 changes: 21 additions & 0 deletions src/core/source/aurorafw/core/logger.d
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;
Loading

0 comments on commit 54160fc

Please sign in to comment.