Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 20 additions & 5 deletions dub.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,24 +87,39 @@
},
"dependencies":{
"dcv:core": "*",
"bindbc-glfw": "~>1.0.0",
"bindbc-opengl": "~>1.0.0"
},
"versions": ["GLFW_31"],
"configurations": [
{
"name": "default",
"versions": [
"GL_31"
]
"GL_31", "BindGLFW_NoGC_Callbacks"
],
"dependencies": {
"bindbc-glfw": "~>1.0.0"
}
},
{
"name": "legacygl",
"versions": [
"GL_11",
"GL_AllowDeprecated",
"UseLegacyGL"
]
"UseLegacyGL",
"BindGLFW_NoGC_Callbacks"
],
"dependencies": {
"bindbc-glfw": "~>1.0.0"
}
},
{
"name": "use-glfw-d",
"versions": [
"GL_31", "GLFW_D"
],
"dependencies": {
"glfw-d": "~>1.1.0"
}
}
]
}
Expand Down
13 changes: 9 additions & 4 deletions source/dcv/plot/bindings/glfw.d
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
module dcv.plot.bindings.glfw;

public import bindbc.glfw;
version(GLFW_D){
public import glfw3.api;

auto loadGLFWLib(){
auto ret = loadGLFW();
return ret;
}else{
public import bindbc.glfw;

auto loadGLFWLib(){
auto ret = loadGLFW();
return ret;
}
}
3 changes: 1 addition & 2 deletions source/dcv/plot/drawprimitives.d
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@ int DISPLAY_FORMAT(int format) @nogc nothrow
} else
if(format == 3){
return GL_BGR;
} else {
debug assert(0, "unsopported format for imshow."); // it will never come here :)
}

return -1;
}

Expand Down
18 changes: 9 additions & 9 deletions source/dcv/plot/figure.d
Original file line number Diff line number Diff line change
Expand Up @@ -426,9 +426,9 @@ void imdestroy(string title = "")
}

/// Key press callback function.
alias KeyPressCallback = void delegate(int key, int scancode, int action, int mods) nothrow;
alias KeyPressCallback = void delegate(int key, int scancode, int action, int mods) @nogc nothrow;
/// Character callback function.
alias CharCallback = void delegate(uint key) nothrow;
alias CharCallback = void delegate(uint key) @nogc nothrow;

/**
Assign key press callback function.
Expand All @@ -452,11 +452,11 @@ Plotting figure type.
class Figure
{
/// Mouse button callback function.
alias MouseCallback = void delegate(Figure figure, int button, int action, int mods) nothrow;
alias MouseCallback = void delegate(Figure figure, int button, int action, int mods) @nogc nothrow;
/// Cursor movement callback function.
alias CursorCallback = void delegate(Figure figure, double xpos, double ypos) nothrow;
alias CursorCallback = void delegate(Figure figure, double xpos, double ypos) @nogc nothrow;
/// Figure closing callback function.
alias CloseCallback = void delegate(Figure figure) nothrow;
alias CloseCallback = void delegate(Figure figure) @nogc nothrow;

private
{
Expand Down Expand Up @@ -896,7 +896,7 @@ version(UseLegacyGL){ } else {
}
}

private void defaultCloseCallback(Figure figure) nothrow
private void defaultCloseCallback(Figure figure) @nogc nothrow
{
glfwHideWindow(figure._glfwWindow);
}
Expand Down Expand Up @@ -1014,9 +1014,9 @@ enum checkContextInit = q{
static this()
{
import std.stdio;

version(GLFW_D){}else{
enforce(loadGLFWLib() == glfwSupport, "Problem loading GLFW dynamic library!");

}
GLFW_STATUS = glfwInit();

setCharCallback((uint key) { _lastKey = key; });
Expand All @@ -1040,7 +1040,7 @@ int _lastKey = -1; // last hit key
KeyPressCallback _keyPressCallback; // global key press callback
CharCallback _charCallback; // global char callback

extern (C) nothrow {
extern (C) @nogc nothrow {
void keyCallbackWrapper(GLFWwindow* window, int mods, int action, int scancode, int key)
{
if (_keyPressCallback)
Expand Down