Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!

1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Member Since 13 Jun 2001
Offline Last Active Today, 05:55 AM

#5137877 No Low Level Programming is better ?, Please explain this then ?

Posted by Madhed on 10 March 2014 - 12:54 PM

My head hurts...

#5136792 Choosing a Fast WebGL Sprite Renderer

Posted by Madhed on 06 March 2014 - 07:55 AM

Have a look at Pixi.js. It supports WebGL and falls back automatically to canvas. And it's pretty fast.


Here's a Benchmark: http://www.goodboydigital.com/pixijs/bunnymark/

#5136396 Providing a download link

Posted by Madhed on 04 March 2014 - 04:50 PM

You can use the php function readfile() to output file contents into the http response stream.

You would use this on a url that the user can only access when logged in.

You should also use header() to set the correct mime type and tell the browser to prompt the user to download the file (instead of opening it in the browser)

header("Content-type: application/octet-stream"); 
header("Content-disposition: attachment; filename=test.zip");  

#5135408 How to get good fast?

Posted by Madhed on 28 February 2014 - 11:05 AM

There really is no shortcut to becoming good at anything,

Set yourself realistic goals and keep a steady but achievable curriculum.

Surround yourself with persons who are better than you at whatever you want to learn.

Never become satisfied with your skillset and don't snub your nose at other people's ideas.

After all, how are you going to learn something new when all you accept are opinions you already hold.

Throw yourself out there and don't be afraid of failure.

#5131331 Auto update systems - yes or no

Posted by Madhed on 14 February 2014 - 11:49 AM

I like when programs check for a new version on startup and give you the chance to automatically download and install or postpone the update.

#5131308 Is my code efficient?

Posted by Madhed on 14 February 2014 - 10:33 AM

You could eliminate the odd variable like this: 

do {
    // ...stuff
} while (max_stars % 2 == 0);

Then you also don't need to inlcude stdbool.h


I think the condition is pretty self explanatory. Alternatively you could factor this expression out into a function is_odd()


Also you probably want to check if max_stars is greater than zero.

#5129922 Thread-safe unique sequential index per class

Posted by Madhed on 08 February 2014 - 03:25 PM

The problem here is that in a multi threaded environment different classes could be assigned the same index, right?

So I guess the AtomicInteger wold be the right solution, no? Am I missing something?


Edit: Should have read the code first...


Edit2: What about static initialization blocks? I haven't done extensive java programming but they seem like a better solution. Initialization is done *once* the class is first loaded. They are thread safe.

#5129262 Alpha Blend in DirectX?

Posted by Madhed on 06 February 2014 - 03:36 AM

Disable z-writing when drawing the alpha shapes.

#5128189 How do I increment a shared pointer?

Posted by Madhed on 02 February 2014 - 10:41 AM

Well, there's shared_ptr::get which returns the underlying raw pointer.


So I guess you could do (didn't test this): i.get()[5] = 10;


But I suggest you don't use shared_ptr-to-array.

#5128181 How do I increment a shared pointer?

Posted by Madhed on 02 February 2014 - 10:27 AM

That's not possible.


What are you trying to accomplish?


Why don't you use a std::vector instead of a plain array? i.e a shared_ptr to a std::vector

#5126125 640x512, is it safe?

Posted by Madhed on 24 January 2014 - 10:15 AM

I use 640x480 as a desktop resolution



#5125846 Database modeling

Posted by Madhed on 23 January 2014 - 06:09 AM

I found that thinking in normalised relational terms has a striking similarity to data oriented coding techniques.

#5124906 Are mutexes really fool-proof?

Posted by Madhed on 19 January 2014 - 03:18 PM

I'm not familiar with SDL but I suppose their codebase is not the problem here. The problem must be within your code. Which parts access the mutex and the shared memory?

#5124897 Are mutexes really fool-proof?

Posted by Madhed on 19 January 2014 - 02:48 PM

I've since replaced it with an SDL mutex. When that didn't work I used Win32 mutexes


In what way did it not work?

#5123137 8-Bit track feedback!

Posted by Madhed on 12 January 2014 - 03:46 PM

Sounds good. Not really 8-bit though? Reminds me more of the style of tracker based music from Unreal and Deus Ex.