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

Commit

Permalink
remove OS static this. input for windows only
Browse files Browse the repository at this point in the history
  • Loading branch information
vladdeSV committed Feb 18, 2017
1 parent 39cde80 commit c633478
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 22 deletions.
6 changes: 6 additions & 0 deletions source/scone/core.d
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,18 @@ static this()
logfile.writefln("scone: %s", Clock.currTime().toISOExtString());

//get current width and height
OS.init();
auto w = OS.size[0];
auto h = OS.size[1];

//init window
window = Window(w,h);
}

static ~this()
{
OS.deinit();
}

///global window (aka console/terminal)
static Window window;
10 changes: 6 additions & 4 deletions source/scone/os.d
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ version(Posix)
}

struct OS
{
{
static:
static this()

auto init()
{
cursorVisible = false;

Expand All @@ -47,7 +47,7 @@ struct OS
}
}

static ~this()
auto deinit()
{
cursorVisible = true;
setCursor(0,0);
Expand Down Expand Up @@ -1112,6 +1112,7 @@ struct OS
}
}

/+
void pollInputEvent(Tid parentThreadID)
{
import std.datetime;
Expand All @@ -1126,5 +1127,6 @@ struct OS
}
}
}
+/
}
}
40 changes: 22 additions & 18 deletions source/scone/window.d
Original file line number Diff line number Diff line change
Expand Up @@ -278,30 +278,34 @@ struct Window
alias w = width;
alias h = height;

/**
* Returns: InputEvent, last call
*/
InputEvent[] getInputs()
//Temporarily disable input for non-Windows
version(Windows)
{
version(Windows){ return OS.Windows.retreiveInputs(); }
version(Posix)
/**
* Returns: InputEvent, last call
*/
InputEvent[] getInputs()
{
/+
import std.datetime : msecs;
version(Windows){ return OS.Windows.retreiveInputs(); }
version(Posix)
{
/+
import std.datetime : msecs;
InputEvent e;
InputEvent e;
receiveTimeout(
100.msecs,
(InputEvent ie) { e = ie; }
);
receiveTimeout(
100.msecs,
(InputEvent ie) { e = ie; }
);
if(e.key != SK.unknown)
{
return [e];
if(e.key != SK.unknown)
{
return [e];
}
+/
return null;
}
+/
return null;
}
}

Expand Down

0 comments on commit c633478

Please sign in to comment.