Basic dynamic array question. Use of new versus no new.

2014-06-10 Thread WhatMeWorry via Digitalmars-d-learn
In Mr. Cehreli's book it says Additionally, the length of dynamic arrays can be changed by assigning a value to this property: int[] array; // initially empty array.length = 5; // now has 5 elements while in Mr. Alexandrescu's book, it says To create a dynamic array, use a new expression (§

very short pipeShell program

2014-06-22 Thread WhatMeWorry via Digitalmars-d-learn
After hours of reading (obviously not comprehending) std.process and looking at code samples, I still can't even do something this simple. Open a Windows command line and run miscellaneous commands. Only the first command, dir is shown in the final output. auto pipe = pipeShell(dir,

Is their a way for a Child process to modify its Parent's environment?

2014-06-24 Thread WhatMeWorry via Digitalmars-d-learn
I open a command line window, and run the following 6 line program void main() { string envPath = environment[PATH]; writeln(PATH is: , envPath); envPath ~= r;F:\dmd2\windows\bin; environment[PATH] = envPath; envPath = environment[PATH]; writeln(PATH is: , envPath); } It

is there a way to pause a program and resume with just a key press (or enter key)

2014-07-14 Thread WhatMeWorry via Digitalmars-d-learn
Sorry if this is an incredibly naive question. I prefer to pragmatically pause my programs periodically so that I can peruse output statements. Ideally, I'd like to continue by just hitting any old key. My feeble attempt below requires I enter at least one character and then the enter key.

Should dmd have given me a warning at least?

2014-09-12 Thread WhatMeWorry via Digitalmars-d-learn
// the following two lines compile cleanly but when executed, I get // D:\Projects\Derelict02_SimpleOpenGL_3_3_program.exe // object.Error: Access Violation // string glShadingLangVer = to!string(glGetString(GL_SHADING_LANGUAGE_VERSION)); writeln(glShadingLangVer is ,

Re: Should dmd have given me a warning at least?

2014-09-12 Thread WhatMeWorry via Digitalmars-d-learn
On Friday, 12 September 2014 at 22:53:35 UTC, Ali Çehreli wrote: On 09/12/2014 03:44 PM, WhatMeWorry wrote: // the following two lines compile cleanly but when executed, I get // D:\Projects\Derelict02_SimpleOpenGL_3_3_program.exe // object.Error: Access Violation // string

Re: Should dmd have given me a warning at least?

2014-09-13 Thread WhatMeWorry via Digitalmars-d-learn
On Saturday, 13 September 2014 at 08:09:15 UTC, Mike Parker wrote: On 9/13/2014 7:44 AM, WhatMeWorry wrote: // the following two lines compile cleanly but when executed, I get // D:\Projects\Derelict02_SimpleOpenGL_3_3_program.exe // object.Error: Access Violation // string

String Theory Questions

2014-09-13 Thread WhatMeWorry via Digitalmars-d-learn
The name string is aliased to immutable(char)[] Why was immutable chosen? Why not mutable. Or why not just make another alias called strung where it is aliased to mutable(char)[] Also, since strings are arrays and arrays are structs with a length and ptr field, I ran the following code

Re: String Theory Questions

2014-09-13 Thread WhatMeWorry via Digitalmars-d-learn
On Saturday, 13 September 2014 at 23:22:40 UTC, ketmar via Digitalmars-d-learn wrote: On Sat, 13 Sep 2014 22:41:38 + AsmMan via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: D string are actullay C-strings? in no way. only string *LITERALS* are zero-terminated. Ok. So I

Can't get Visual D to come up. No warnings, no errors, no nothing

2014-09-21 Thread WhatMeWorry via Digitalmars-d-learn
Anybody installed Visual D recently? As per the install instructions, I downloaded the Visual Studio isolated Shell 2013 and its integrated package. Everything went smoothly. I then downloaded Visual D and installed it with no problems. However, when I try to run the vdserver.exe

Re: Can't get Visual D to come up. No warnings, no errors, no nothing

2014-09-22 Thread WhatMeWorry via Digitalmars-d-learn
On Monday, 22 September 2014 at 03:30:22 UTC, Vladimir Panteleev wrote: On Monday, 22 September 2014 at 03:21:44 UTC, WhatMeWorry wrote: Anybody installed Visual D recently? As per the install instructions, I downloaded the Visual Studio isolated Shell 2013 and its integrated package.

Simple import question

2014-10-09 Thread WhatMeWorry via Digitalmars-d-learn
Hope this question is not too simple minded but, In the TDPL it says: To import one module from another, specify the name of the module in an import declaration. The name must include the relative path computed from the directory where compilation takes place Ok, but how does one

Can someone explain how glfw3.dll gets created?

2014-10-13 Thread WhatMeWorry via Digitalmars-d-learn
I have a simple GLFW3 program running in Visual D integrated shell, that kept aborting at DerelictFLFW3.load() with a failed to load the shared libraries: glfw3.dll.' So I found a glfw3.dll somewhere and moved it into the project folder (I know this is bad technique) and that fixed the

Basic DerelictOrg and Deimos question

2014-10-24 Thread WhatMeWorry via Digitalmars-d-learn
within DerelictOrg, I've used DerelictGL3 and DerelictGLFW3 packages successfully. But just today I stumbled across D-Programming-Deimos and noticed that it has a glfw and an OpenGL as well. I've read some of the descriptions and Derelict talks about dynamic bindings where Deimos mentions

Vibe.d compiler errors...

2014-10-24 Thread WhatMeWorry via Digitalmars-d-learn
I just started to dip my toes into vibe.d and I tried to stay on the beaten track. I downloaded vibe, and did the First Steps as recommended: $ cd /path/to/my/projects $ dub init project-name vibe.d But when I try compiling the default code in app.d which is created after the dub init

Re: Vibe.d compiler errors...

2014-10-24 Thread WhatMeWorry via Digitalmars-d-learn
On Friday, 24 October 2014 at 19:58:37 UTC, WhatMeWorry wrote: I just started to dip my toes into vibe.d and I tried to stay on the beaten track. I downloaded vibe, and did the First Steps as recommended: $ cd /path/to/my/projects $ dub init project-name vibe.d But when I try compiling the

dub fetch target redirection...

2014-10-28 Thread WhatMeWorry via Digitalmars-d-learn
It looks like dub fetch... is putting all packages at %appdata% path on my windows machine. Is there a way to redirect packages to a user specified path?

Re: dub fetch target redirection...

2014-10-29 Thread WhatMeWorry via Digitalmars-d-learn
On Wednesday, 29 October 2014 at 12:47:48 UTC, Kagamin wrote: https://github.com/D-Programming-Language/dub/issues/229 Thanks. This s-ludwig guy is great.

Re: dub fetch target redirection...

2014-10-29 Thread WhatMeWorry via Digitalmars-d-learn
On Wednesday, 29 October 2014 at 11:35:17 UTC, Mike Parker wrote: On 10/29/2014 1:48 PM, WhatMeWorry wrote: It looks like dub fetch... is putting all packages at %appdata% path on my windows machine. Is there a way to redirect packages to a user specified path? You're not really supposed to

Simple code sample of Nesting Structures. I'm I doing something illegal here?

2014-11-22 Thread WhatMeWorry via Digitalmars-d-learn
// Two simple value type structures. one embedded in the other. I've stepped through the debugger and I see the embedded structure being set to 2, and dog. import std.stdio; struct NestedBottom { int i; char[3] fixedArray; // this(){} no-argument ctor can only be defined by

Do functions and/or function pointers have scope (or lifetimes)

2014-11-29 Thread WhatMeWorry via Digitalmars-d-learn
I'm assuming the answer is yes. If so, that implies that I could execute a function pointer that doesn't point to anything meaningful. Conversely, functionality could exist that I can't get access to because my function pointer is unavailable? If these are dangers, is there a technique or

general questions on reference types versus value types...

2014-11-30 Thread WhatMeWorry via Digitalmars-d-learn
Is it correct to say that D reference types (classes, dynamic arrays, etc.) are always allocated on the heap; whereas D value types (structs, static arrays, etc.) are always allocated on the stack? Or is this a gross oversimplification? Because can't structures contain classes and classes

Re: general questions on reference types versus value types...

2014-12-01 Thread WhatMeWorry via Digitalmars-d-learn
Wow. This is great stuff! And diagrams are always appreciated. You should write a book. I'm off to play with emplace.

Re: simple assignment statement compiles but becomes a run time error

2015-01-18 Thread WhatMeWorry via Digitalmars-d-learn
On Sunday, 18 January 2015 at 20:07:25 UTC, weaselcat wrote: On Sunday, 18 January 2015 at 19:51:02 UTC, WhatMeWorry wrote: On Sunday, 18 January 2015 at 19:42:33 UTC, WhatMeWorry wrote: I've got a OpenGL function returning a pointer // const GLubyte *version = glGetString(GL_VERSION); //

simple assignment statement compiles but becomes a run time error

2015-01-18 Thread WhatMeWorry via Digitalmars-d-learn
I've got a OpenGL function returning a pointer // const GLubyte *version = glGetString(GL_VERSION); // C++ and openLG code // the following compiles with no errors or warnings char openglVersion[100] = fromStringz(glGetString(GL_VERSION)); // ABENDS HERE! // documentation from

Re: simple assignment statement compiles but becomes a run time error

2015-01-18 Thread WhatMeWorry via Digitalmars-d-learn
On Sunday, 18 January 2015 at 19:42:33 UTC, WhatMeWorry wrote: I've got a OpenGL function returning a pointer // const GLubyte *version = glGetString(GL_VERSION); // C++ and openLG code // the following compiles with no errors or warnings char openglVersion[100] =

Re: Difference between concatenation and appendation

2015-01-25 Thread WhatMeWorry via Digitalmars-d-learn
On Monday, 26 January 2015 at 01:57:04 UTC, bearophile wrote: Laeeth Isharc: I think concatenation and append are used as synonyms (the same meaning is meant). a~=b or a=a~b a=a~b always allocates a new array, while a~=b sometimes re-allocates in place. Bye, bearophile Perfect! Thank

Need extern (C) interface even though using Derelict GLFW

2015-01-03 Thread WhatMeWorry via Digitalmars-d-learn
I've been translating C++, OpenGL, and GLUT code into D, Derelict OpenGL, and Derelict GLFW using: import derelict.opengl3.gl3; import derelict.glfw3.glfw3; auto window = glfwCreateWindow(800, 600, Shaders, null, null); etc. Things have been going well. I then tried to implement window

Re: Need extern (C) interface even though using Derelict GLFW

2015-01-04 Thread WhatMeWorry via Digitalmars-d-learn
On Sunday, 4 January 2015 at 09:02:48 UTC, Mike Parker wrote: On 1/4/2015 1:34 PM, WhatMeWorry wrote: Maybe GLFW callback functions can't handled through Derelict GLFW? And just to be clear, because the pointers to the callback functions are being passed to a C API, they *have* to be

Difference between concatenation and appendation

2015-01-25 Thread WhatMeWorry via Digitalmars-d-learn
Ok, I just made up that word. But what is the difference between appending and concatenating? Page 100 of TPDL says The result of the concatenation is a new array... and the section on appending talks about possibly needing expansion and reallocation of memory. But I still don't feel like I

How to I translate this C++ structure/array

2015-05-02 Thread WhatMeWorry via Digitalmars-d-learn
This is probably trivial but I just can't make a break thru. I've got C++ code using glm like so: struct Vertex { glm::vec3 position; glm::vec3 color; } Vertex triangle[] = [ glm::vec3(0.0, 1.0, 0.0), glm::vec3(1.0, 0.0, 0.0), // red

Re: Converting (casting?) a dynamic array to a fixed array?

2015-05-04 Thread WhatMeWorry via Digitalmars-d-learn
Many thanks. Just to recap, I got the code working with: glBufferData(GL_ARRAY_BUFFER, (verts.sizeof * verts.length), verts.ptr, GL_STATIC_DRAW); sizeof on a slice doesn't do what you think it does, it returns the size of the actual slice object I believe. I have to admit that I didn't

Converting (casting?) a dynamic array to a fixed array?

2015-05-03 Thread WhatMeWorry via Digitalmars-d-learn
This following code works fine. A triangle is displayed. GLfloat[6] verts = [ 0.0, 1.0, -1.0, -1.0, 1.0, -1.0 ]; glGenBuffers(1, vbo); glBindBuffer(GL_ARRAY_BUFFER, vbo); // Some of the types are:

Re: How to I translate this C++ structure/array

2015-05-02 Thread WhatMeWorry via Digitalmars-d-learn
On Saturday, 2 May 2015 at 22:36:29 UTC, anonymous wrote: On Saturday, 2 May 2015 at 22:01:10 UTC, WhatMeWorry wrote: struct Vertex { vec3 position; vec3 color; } Vertex triangle[6] = [ vec3(0.0, 1.0, 0.0), vec3(1.0, 0.0, 0.0), // red //

Re: How to I translate this C++ structure/array

2015-05-03 Thread WhatMeWorry via Digitalmars-d-learn
On Sunday, 3 May 2015 at 10:56:44 UTC, anonymous wrote: On Sunday, 3 May 2015 at 02:31:51 UTC, WhatMeWorry wrote: On Saturday, 2 May 2015 at 22:36:29 UTC, anonymous wrote: [...] [1] `Vertex triangle[6]` works, but please don't do that. Thanks. I assume you would prefer I use triangle[] but

Re: How to I translate this C++ structure/array

2015-05-03 Thread WhatMeWorry via Digitalmars-d-learn
On Sunday, 3 May 2015 at 10:56:44 UTC, anonymous wrote: On Sunday, 3 May 2015 at 02:31:51 UTC, WhatMeWorry wrote: On Saturday, 2 May 2015 at 22:36:29 UTC, anonymous wrote: [...] [1] `Vertex triangle[6]` works, but please don't do that. Thanks. I assume you would prefer I use triangle[] but

Re: Are stack+heap classes possible in D?

2015-06-17 Thread WhatMeWorry via Digitalmars-d-learn
On Sunday, 14 June 2015 at 01:31:25 UTC, Adam D. Ruppe wrote: On Sunday, 14 June 2015 at 00:52:20 UTC, FujiBar wrote: I have read that in D structs are always allocated on the stack while classes are always allocated on the heap. That's not true; it is a really common misconception. Putting

Re: Template Declarations - Why not Template definitions?

2015-06-30 Thread WhatMeWorry via Digitalmars-d-learn
I was reading D Templates: A Tutorial by Philippe Sigaud which says: --- quote What is a Template? In the next chapters, you’ll see how to define function, struct and class templates. But before that, I’d like to introduce what a template really is, because this

Template Declarations - Why not Template definitions?

2015-06-30 Thread WhatMeWorry via Digitalmars-d-learn
All the stuff I've read about templates always refers to them as template declarations. So with the following code segment: template codeBlockTemplate(T, U) { T a = 7; U b = 'z'; } codeBlockTemplate!(int, char); // error here Microsof's Visual Studio IDE tells me identifier

How does __traits and std.traits differ?

2015-07-24 Thread WhatMeWorry via Digitalmars-d-learn
Looking at the online documentation, it says: __traits are extensions to the language to enable programs, at compile time, to get at information internal to the compiler. std.traits are Templates which extract information about types and symbols at compile time. Do they both basically do

An annoying compile issue

2015-10-25 Thread WhatMeWorry via Digitalmars-d-learn
I'm porting over some C++/glm/openGL code. I've used gl3n for a while now (successfully) to port over glm code, but I've got this pebble in my shoe: glm::mat4 model; model = glm::scale(model, glm::vec3(size, 1.0f)); // size is a vec2 So my D code consists of: mat4 model; model =

Re: Playing audio files and related functions?

2015-10-26 Thread WhatMeWorry via Digitalmars-d-learn
On Monday, 26 October 2015 at 21:25:58 UTC, Cleverson wrote: Hello, Is there any library or module for easily managing basic audio functions, e.g., play/pause/stop a sound? I can't find it amongst the standard library and the packages colection, or maybe I don't know how to search properly,

Re: An annoying compile issue

2015-10-26 Thread WhatMeWorry via Digitalmars-d-learn
On Monday, 26 October 2015 at 03:53:21 UTC, Adam D. Ruppe wrote: On Monday, 26 October 2015 at 03:44:31 UTC, WhatMeWorry wrote: First, isn't Vector!(float,3) a template which creates a tuple consisting of float, float, float; so aren't the argument types identical? I'm not familiar with the

Array initialization with Struct templates

2015-08-30 Thread WhatMeWorry via Digitalmars-d-learn
This seemingly trivial array initialization has caused me hours of grief. enum Purpose { POSITIONAL, COLOR_ONLY, COLOR_AND_ALPHA, GENERIC_TRIPLE, GENERIC_QUAD } Purpose purpose; struct Chameleon(T, Purpose p) // template { static if (is (p == POSITIONAL)) { T x, y, z; }

Re: Array initialization with Struct templates

2015-08-31 Thread WhatMeWorry via Digitalmars-d-learn
Thanks for all the above suggestions, but after many hour of re-reading Ali's book on template, structs, and mixins, I still in the woods. I've tried two approaches: Templatetized struct struct Chameleon(T, Purpose p) { static if (p ==

Anybody use Derelict FreeType recently (successfully)

2015-09-16 Thread WhatMeWorry via Digitalmars-d-learn
Compiling and linking was error free, but when I hit DerelictFT.load(); my program aborts with the following run time message: derelict.util.exception.SymbolLoadException@source\derelict\util\exception.d(35): Failed to load symbol FT_Reference_Face from shared library freetype.dll First of

Re: Anybody use Derelict FreeType recently (successfully)

2015-09-17 Thread WhatMeWorry via Digitalmars-d-learn
On Thursday, 17 September 2015 at 05:27:08 UTC, Mike Parker wrote: On Thursday, 17 September 2015 at 04:58:05 UTC, WhatMeWorry wrote: Compiling and linking was error free, but when I hit DerelictFT.load(); my program aborts with the following run time message:

Re: gl3n does not seem to have an ortho function like glm. Any replacements?

2015-10-04 Thread WhatMeWorry via Digitalmars-d-learn
On Monday, 5 October 2015 at 00:05:42 UTC, Rene Zwanenburg wrote: On Sunday, 4 October 2015 at 21:30:43 UTC, WhatMeWorry wrote: I'm porting some C++/OpenGL/glm code over to D, And I've run into a glm::ortho function. glm::mat4 projection = glm::ortho(0.0f, static_cast(WIDTH), 0.0f,

gl3n does not seem to have an ortho function like glm. Any replacements?

2015-10-04 Thread WhatMeWorry via Digitalmars-d-learn
I'm porting some C++/OpenGL/glm code over to D, And I've run into a glm::ortho function. glm::mat4 projection = glm::ortho(0.0f, static_cast(WIDTH), 0.0f, static_cast (HEIGHT)); gl3n is great for vecs and mats but does not appear to have an ortho function. Any suggestions? Thanks in

Re: This is probably trivial or impossible Code Introspection...

2015-09-19 Thread WhatMeWorry via Digitalmars-d-learn
On Saturday, 19 September 2015 at 19:54:45 UTC, Adam D. Ruppe wrote: On Saturday, 19 September 2015 at 19:52:56 UTC, WhatMeWorry wrote: So I've got type and value of each member, but I want their actual names? http://dlang.org/phobos/std_traits.html#FieldNameTuple You can also do something

This is probably trivial or impossible Code Introspection...

2015-09-19 Thread WhatMeWorry via Digitalmars-d-learn
given some struct: writeln("face.glyph.bitmap = ", face.glyph.bitmap); which displays the following: face.glyph.bitmap = FT_Bitmap(30, 25, 25, 4105948, 256, 2, 0, null) Is there a way for D to display the variable names within the FT_Bitmap? For instance, the following code snippet

Re: Simple template constraint question

2015-09-19 Thread WhatMeWorry via Digitalmars-d-learn
On Saturday, 19 September 2015 at 17:18:23 UTC, Daniel Kozak wrote: WhatMeWorry píše v So 19. 09. 2015 v 17:09 +: [...] http://dlang.org/expression.html#IsExpression 3. is ( Type == TypeSpecialization ) import std.stdio; struct S { } class C { } void f(T)(T someStruct) if (is (T ==

Re: Anybody use Derelict FreeType recently (successfully)

2015-09-19 Thread WhatMeWorry via Digitalmars-d-learn
On Friday, 18 September 2015 at 16:34:16 UTC, BBasile wrote: On Friday, 18 September 2015 at 00:13:41 UTC, BBasile wrote: On Thursday, 17 September 2015 at 22:22:22 UTC, WhatMeWorry wrote: [...] After hours of reading existing freetype/derelict documents, I'm stuck again. Any suggestions.

Re: I'll like to learn D

2015-09-19 Thread WhatMeWorry via Digitalmars-d-learn
On Saturday, 19 September 2015 at 13:41:03 UTC, uNknow123 wrote: Hi! I'll like to learn D Lang. I knew some Pawn, it is pretty similar, but not so similar, if you understan me. In Pawn we have to write just some words, and the Plugin is done, why Plugin, 'cuse Pawn = Scripting for Cs 1.6 and

Re: This is probably trivial or impossible Code Introspection...

2015-09-20 Thread WhatMeWorry via Digitalmars-d-learn
On Sunday, 20 September 2015 at 05:50:16 UTC, Ali Çehreli wrote: On 09/19/2015 10:30 PM, H. S. Teoh via Digitalmars-d-learn wrote: On Sun, Sep 20, 2015 at 05:21:03AM +, WhatMeWorry via Digitalmars-d-learn wrote: [...] Thanks. But now I have an even more fundamental problem. I keep

Simple template constraint question

2015-09-19 Thread WhatMeWorry via Digitalmars-d-learn
Does D provide complete template constraint granularity? In other words, I want to only accept structs in the template below. I've find the isAggregateType which is close but no cigar. Am I missing some other filters? And a more open ended question. Is there a more elegant solution for

Re: How to get the current Timezone

2015-08-28 Thread WhatMeWorry via Digitalmars-d-learn
On Friday, 28 August 2015 at 14:18:24 UTC, Adam D. Ruppe wrote: On Friday, 28 August 2015 at 14:07:37 UTC, wobbles wrote: However, it just returns an empty string. from the doc: Note that this always returns the empty string. This is because time zones cannot be uniquely identified by the

issue porting C++/glm/openGL to D/gl3n/openGL

2016-01-09 Thread WhatMeWorry via Digitalmars-d-learn
Just translating some simple C++/glm/opengl tutorial code to D/gl3n/opengl and I'm coming across more friction than I expected. I've got a square centered at my window which is rotated by 45 degrees (counter clockwise) and then moved to the lower right quadrant. // C++ glm opengl code

Re: issue porting C++/glm/openGL to D/gl3n/openGL

2016-01-09 Thread WhatMeWorry via Digitalmars-d-learn
On Sunday, 10 January 2016 at 04:37:43 UTC, Mike Parker wrote: On Sunday, 10 January 2016 at 02:51:57 UTC, WhatMeWorry wrote: Is gl3n not a direct replacement for glm? From the very top of the gl3n github page: "OpenGL Maths for D (not glm for D)." So, no, it is not. You might want to

Re: issue porting C++/glm/openGL to D/gl3n/openGL

2016-01-09 Thread WhatMeWorry via Digitalmars-d-learn
On Sunday, 10 January 2016 at 06:35:34 UTC, rsw0x wrote: On Sunday, 10 January 2016 at 02:51:57 UTC, WhatMeWorry wrote: Just translating some simple C++/glm/opengl tutorial code to D/gl3n/opengl and I'm coming across more friction than I expected. I've got a square centered at my window

Re: Does this C callback call look correct?

2016-05-28 Thread WhatMeWorry via Digitalmars-d-learn
Never mind. D was fine. Needed an alureUpdate() to trigger the call back.

Does this C callback call look correct?

2016-05-27 Thread WhatMeWorry via Digitalmars-d-learn
// Specification from ALURE documentation ALURE_API ALboolean ALURE_APIENTRY alurePlaySourceStream( ALuint source, alureStream *stream, ALsizei numBufs, ALsizei loopcount, void(*eos_callback)(void *userdata, ALuint source), void*userdata ) // My D code, below

Quite sure a simple basic problem...

2016-06-01 Thread WhatMeWorry via Digitalmars-d-learn
I've got a fairly complex D project (25+ modules) that has grown haphazardly over time. So it is not well designed. But I want to get the thing fully ported before refining the code. (that's called refactoring, I believe?) Anyway, there is a new module called audio.d which which has all the

Re: issue porting C++/glm/openGL to D/gl3n/openGL

2016-01-10 Thread WhatMeWorry via Digitalmars-d-learn
On Sunday, 10 January 2016 at 10:38:07 UTC, Johan Engelen wrote: On Sunday, 10 January 2016 at 10:35:34 UTC, Johan Engelen wrote: It's pretty strange that there is no "translate" method... Didn't see it in the online docs, but in the source there is the "translate" method that you should

Can file name, module name, class name and variable name be the same?

2016-01-17 Thread WhatMeWorry via Digitalmars-d-learn
file 1: camera.d --- module camera; class Camera { public: // Camera Attributes vec3 position = vec3(0.0f, 0.0f, 0.0f); . . . }; --- file 2: main.d --- module main; import camera; Camera camera; // Compile error (1)

D with DerelictASSIMP3 question

2016-02-01 Thread WhatMeWorry via Digitalmars-d-learn
I'm porting a C++/opengl/AssImp tutorial over to D/DerelictOpenGL/DerelictAssImp but have hit a brick wall. It's a fairly large project but a tiny fragment suffices: if(mesh.mMaterialIndex >= 0) { const aiMaterial* material = scene.mMaterials[mesh.mMaterialIndex]; // uint texCount =

Is DUB the best place to get examples of "Best of" D code?

2016-02-27 Thread WhatMeWorry via Digitalmars-d-learn
If so, is there a way to do a global search of all projects in DUB?

static array of structs clarification questions

2016-02-12 Thread WhatMeWorry via Digitalmars-d-learn
I was thinking about fixed length arrays of structures the other day so I played around with the flowing code: struct Foo { inti; string str; void info() { writeln("i = ", i, "str = ", str); } } Foo[2] foos; auto f1 = Foo(1, "6chars"); // this

Simple call to static member function

2016-03-11 Thread WhatMeWorry via Digitalmars-d-learn
--- main.d void main(string[] argv) { ResourceManager.LoadShader("VertexShader.glsl", "FragmentShader.glsl", "filler", "sprite"); --- File ResourceManager.d class ResourceManager {

Re: Simple call to static member function

2016-03-11 Thread WhatMeWorry via Digitalmars-d-learn
On Friday, 11 March 2016 at 23:14:48 UTC, ag0aep6g wrote: On 11.03.2016 23:47, WhatMeWorry wrote: [...] This suggests that you simply `import ResourceManager;` in main.d. [...] Very good. Thanks for the fix and the pointers. I'm porting C++ code over, and it has corrupted me. I'll

Re: Not sure how to translate this C++ variable to D.

2016-03-15 Thread WhatMeWorry via Digitalmars-d-learn
On Monday, 14 March 2016 at 22:19:50 UTC, Ali Çehreli wrote: On 03/14/2016 03:14 PM, WhatMeWorry wrote: > > sprite_renderer.h -- > > class SpriteRenderer > { > ... > }; Same thing in D without the semicolon. :) > game.cpp

Not sure how to translate this C++ variable to D.

2016-03-14 Thread WhatMeWorry via Digitalmars-d-learn
sprite_renderer.h -- class SpriteRenderer { ... }; game.cpp #include "sprite_renderer.h" SpriteRenderer *Renderer; Game::Game(GLuint width, GLuint height) : State(GAME_ACTIVE), Keys(), Width(width),

function returning a tuple

2016-04-08 Thread WhatMeWorry via Digitalmars-d-learn
This might be a very simple fix, but I've been fighting this for more hours than I care to admit to. std.typecons says "Tuple of values, for example Tuple!(int, string) is a record that stores an int and a string. Tuple can be used to bundle values together, notably when returning multiple

How to Deify char**

2016-05-17 Thread WhatMeWorry via Digitalmars-d-learn
I'm weak enough with C pointers, but when I see char** my brain freezes up like a deer caught in headlights. Can anyone translate the below C call into D? ALURE_API const ALCchar** ALURE_APIENTRY alureGetDeviceNames(ALCboolean all,ALCsizei *count) // my poor attempt to Deify it int

Does DUB create .dll files?

2016-05-16 Thread WhatMeWorry via Digitalmars-d-learn
I just incorporated DerelictALURE into a project and it compiled and linked fine, but when I ran the executable, it aborted with: derelict.util.exception.SharedLibLoadException@N:\DUB_Packages\DerelictOrg\DerelictUtil\source\derelict\util\exception.d(35): Failed to load one or more

Anybody use FreeImage on Linux with D?

2016-07-27 Thread WhatMeWorry via Digitalmars-d-learn
I've been stumped for several days trying to resolve this run time error. I'm pretty new with Linux. No problem on Windows. DerelictFI.load("/home/generic/MySharedLibraries/libfreeimage.so"); before DerelictFI.load

Re: DUB saying my Linux exe file is "not an executable file" even though DUB built it

2016-08-13 Thread WhatMeWorry via Digitalmars-d-learn
On Sunday, 14 August 2016 at 01:05:33 UTC, Basile B. wrote: On Saturday, 13 August 2016 at 21:56:49 UTC, WhatMeWorry wrote: $ sudo chmod -v 777 * mode of 'HelloWindow' changed from 0644 (rw-r--r--) to 0777 (rwxrwxrwx) $ ls -al total 3016 drwxr-xr-x 2 generic generic4096 Aug 13 16:48 .

Re: DUB saying my Linux exe file is "not an executable file" even though DUB built it

2016-08-14 Thread WhatMeWorry via Digitalmars-d-learn
This is the actual problem that cause trouble. Your flash drive is probably Fat32 or NTFS formatted rather than ext4. Since those file systems do not support "executable attribute", Linux will silently fail to give files the attribute which results in these sort of surprises. You may wonder

DUB saying my Linux exe file is "not an executable file" even though DUB built it

2016-08-13 Thread WhatMeWorry via Digitalmars-d-learn
Not a lot to work with here. I'm a beginner Linux user. $ dub build --force Performing "debug" build using dmd for x86_64. derelict-util 2.0.6: building configuration "library"... derelict-gl3 1.0.18: building configuration "library"... derelict-glfw3 3.1.0: building configuration

Re: DUB saying my Linux exe file is "not an executable file" even though DUB built it

2016-08-13 Thread WhatMeWorry via Digitalmars-d-learn
$ sudo chmod -v 777 * mode of 'HelloWindow' changed from 0644 (rw-r--r--) to 0777 (rwxrwxrwx) $ ls -al total 3016 drwxr-xr-x 2 generic generic4096 Aug 13 16:48 . drwxr-xr-x 7 generic generic4096 Aug 12 23:14 .. -rw-r--r-- 1 generic generic 3080080 Aug 13 16:48 HelloWindow Now I'm

minor question of the difference between " and '

2016-08-10 Thread WhatMeWorry via Digitalmars-d-learn
string pwdxCommand = escapeShellCommand("pwdx", to!string(pid)); writeln("pwdxCommand = ", pwdxCommand); Output: Current process ID: 7962 pwdxCommand = 'pwdx' '7962' I'm confused as to why the writeln statement didn't output "pwdx 7962"? Afterall, isn't that the definition of a

Re: Is there a way to "see" source code generated by templates after a compile?

2016-07-17 Thread WhatMeWorry via Digitalmars-d-learn
On Sunday, 17 July 2016 at 11:14:39 UTC, Stefan Koch wrote: On Sunday, 17 July 2016 at 05:57:52 UTC, WhatMeWorry wrote: I don't suppose there's a way to "see" source code generated by templates after a compile but before execution? Or does the compiler generate it to a lower level on the

Re: Is there a way to "see" source code generated by templates after a compile?

2016-07-18 Thread WhatMeWorry via Digitalmars-d-learn
On Monday, 18 July 2016 at 07:37:27 UTC, lobo wrote: On Sunday, 17 July 2016 at 05:57:52 UTC, WhatMeWorry wrote: [snip] Now that I think about, was there even a way to look at c/c++ code after the pre-processor step? Does this do what you want? cl.exe /E gcc -E clang -E clang-cl /E i

Is there a way to "see" source code generated by templates after a compile?

2016-07-17 Thread WhatMeWorry via Digitalmars-d-learn
I don't suppose there's a way to "see" source code generated by templates after a compile but before execution? Or does the compiler generate it to a lower level on the fly; thus losing the source code? I'm assuming no because if there were a way, I'd of come across it by now :) Now

Re: Is there a way to "see" source code generated by templates after a compile?

2016-07-19 Thread WhatMeWorry via Digitalmars-d-learn
On Sunday, 17 July 2016 at 05:57:52 UTC, WhatMeWorry wrote: I don't suppose there's a way to "see" source code generated by templates after a compile but before execution? Or does the compiler generate it to a lower level on the fly; thus losing the source code? I'm assuming no because

Re: sorting std.container

2016-07-11 Thread WhatMeWorry via Digitalmars-d-learn
On Monday, 11 July 2016 at 19:07:51 UTC, ketmar wrote: list slices are not random-access ranges, thus they can't be sorted in-place (this is what std.algorithm.sort does). so the only way is to convert list to array, sort it, and make a list from sorted array. probably not something you want.

Probably trivial Linux link problem that I've spent hours on.

2016-07-04 Thread WhatMeWorry via Digitalmars-d-learn
Just learning Linux. Got my first vibe/dub project which dies at: Compiling diet template 'index.dt'... Linking... /usr/bin/ld: cannot find -lsqlite3 collect2: error: ld returned 1 exit status I downloaded DUB's d2sqlite3 and built it fine. I've got sqlite3 on my system by default (came with

Probably a real simple compile-time reflection question?

2016-07-09 Thread WhatMeWorry via Digitalmars-d-learn
class C { this(){ _i = 0; _j = 0; } void setVar(int i) { _i = i; } int getVar() { return _i; } int _i; int _j; } writeln("C"); foreach( i, str; myClassMembers) { writeln("member ", i, " = ", str); TypeInfo ti = typeid(str); writeln("type id is ", ti);

How to pause terminal in D on Linux?

2016-07-23 Thread WhatMeWorry via Digitalmars-d-learn
What I thought would be trivial is becoming a nightmare. Can anybody set me straight. Thanks in advance. void writeAndPause(string s) { writeln(s); // writeln("Press any key to continue..."); // works fine on Windows // executeShell("pause");// works fine on

Re: Is there anything fundamentally wrong with this code?

2017-02-03 Thread WhatMeWorry via Digitalmars-d-learn
On Friday, 3 February 2017 at 18:37:15 UTC, Johan Engelen wrote: On Friday, 3 February 2017 at 17:20:43 UTC, WhatMeWorry wrote: [...] The error is in this line. Instead of assigning to the `postProc` at module scope, you are defining a new local variable and assigning to it.

Is there anything fundamentally wrong with this code?

2017-02-03 Thread WhatMeWorry via Digitalmars-d-learn
The code below compiles fine but I always get a run time abort with the error down below. Isn't the postProc at module scope so shouldn't the class instance always be around (ie not deallocated?) If it helps, this was translated from C++ code. Thanks. -file

A matter of propiety

2017-01-27 Thread WhatMeWorry via Digitalmars-d-learn
module_common import app; // Ugly? Bad? Better way? common_func() { static if (compileTimeFlag1) codeBlockA static if (compileTimeFlag2) codeBlockB static if (compileTimeFlag3) codeBlockC } I want to have many

simple static if / traits question...

2017-02-22 Thread WhatMeWorry via Digitalmars-d-learn
I'm doing conditional compilation using static ifs like so: enum bool audio = true; // if audio flag is present and set to true, add to code build static if ( (__traits(compiles, audio)) && audio) playSound(soundSys, BLEEP ); This works,

Re: DerelictFmodStudio not found...

2017-02-10 Thread WhatMeWorry via Digitalmars-d-learn
On Saturday, 11 February 2017 at 03:10:35 UTC, WhatMeWorry wrote: I followed the instructions for derelict.fmod. // Load the Fmod library. DerelictFmod.load(); // compiles fine. // Load the Fmod studio library. DerelictFmodStudio.load(); but the Studio load

DerelictFmodStudio not found...

2017-02-10 Thread WhatMeWorry via Digitalmars-d-learn
I followed the instructions for derelict.fmod. // Load the Fmod library. DerelictFmod.load(); // compiles fine. // Load the Fmod studio library. DerelictFmodStudio.load(); but the Studio load ..\common\derelict_libraries.d(122,5): Error: undefined identifier 'DerelictFmodStudio' In

Converting a Visual Studio Solution with many Projects into DUB package?

2016-08-16 Thread WhatMeWorry via Digitalmars-d-learn
I've got a large Visual Studio Solution which contains lots of Projects. Each project is a standalone D/OpenGL tutorial. I want to make it OS and IDE agnostic so it can be easily played with on Windows, Linux, and Mac OS so I thought it best to make it a dub package. I've been reading

is this a typographical bug?

2016-08-30 Thread WhatMeWorry via Digitalmars-d-learn
Error: module std.string import 'removeChars' not found, did you mean template 'removechars(S)(S s, in S pattern) if (isSomeString!S)'? Shouldn't it be removeChars? All the other library calls seem to be camelCased. Should i not bother to open a change request because this would cause too

May be a simple dub answer if my question even makes sense?

2016-09-23 Thread WhatMeWorry via Digitalmars-d-learn
I have D opengl/glfw3 program that I wrote which compiles and runs fine, but I always felt it was a bit of a Visual Studio hack. So I thought I'd start anew but this time use dub from the get go. So I did dub int...etc. And put my existing code into the app.d file. But when I try to

Re: May be a simple dub answer if my question even makes sense?

2016-09-25 Thread WhatMeWorry via Digitalmars-d-learn
On Sunday, 25 September 2016 at 00:52:26 UTC, Mike Parker wrote: On Saturday, 24 September 2016 at 16:51:47 UTC, WhatMeWorry wrote: [...] As long as they're public. Imports are private by default, meaning their symbols are only visible locally. Change it to: module derelict_libraries;

Stupid User error with DUB/Derelict runtime issue?

2016-10-05 Thread WhatMeWorry via Digitalmars-d-learn
Dub/Derelict is returning the following error at the D line: DerelictFT.load(); // Load the FreeType library derelict.util.exception.SharedLibLoadException@C:\Users\kheaser\AppData\Roaming\dub\packages\derelict-util-2.0.6\source\derelict\util\exception.d(35): Failed to load one or

  1   2   >