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!


dilyan_rusev

Member Since 24 Nov 2006
Offline Last Active May 03 2015 11:52 PM

Posts I've Made

In Topic: Porting my game to Linux

20 January 2015 - 05:59 PM

I watched this a while ago and find it useful:

 

It explains what Valve recommends. Mostly, SDL2 libraries handle most of the OS/DirectX stuff, and OpenGL replaces Direct3D. Also, one advise I've found on my own: if your game is not too complex, you can do almost all the work on Windows. Booting to a Linux distro just to make sure it compiles and runs properly has been my strategy so far for small personal projects.


In Topic: So I think I'm fairly comfortable with C++ but..

19 January 2015 - 05:58 AM

If you are comfortable with developing only for Windows, the combination of Direct2D, WIC and DirectWrite is very powerful. It is COM-based, so things like Microsoft::WRL::ComPtr will come in handy.

 

The DirectXTK that @NightCreature83 linked to tries to emulate XNA in C++ with Direct3D11.

 

The big difference between Direct2D & friends and SDL/SFML/DirectXTK is

  • the ability to easily draw complicated high-quality geometrical shapes
  • the ability to (relatively) easily draw high-quality text with advanced Photoshop-like effects (shadow, outlines, gradients, etc)

If you don't need these things (like most 2D games), then SDL/SFML and DirectXTK will all work quite well.

 

It is also worth noting that both SFML and SDL offer much simpler APIs than the DirectX (Direct2D, WIC, DirectWrite, Direct3D11 + DirectXTK).

 

Regardless of which API you choose, if you program on Windows with Visual Studio, OutputDebugString is your friend :)

 

For beginners, I think 3D is an overkill. It is much easer to find 2D assets and 2D artists, also the programming part is much easier; you need almost no math.


In Topic: How can I create an installer for my game?

23 December 2014 - 06:01 AM

You can do that, or you can write your own. It's all resources, registry settings, temp files, running other installers and public Windows API.

 

If you want to do the installer quickly, use Inno or NSIS. In case you are curious how it works on the inside, or you want to heavily customize the UI, you might have to roll your own.


In Topic: Windows Dialog Background Color

08 December 2014 - 05:21 AM

I don't know about the rest of the code, but the DlgProc in what you posted above seems wrong.

 

http://msdn.microsoft.com/en-us/library/windows/desktop/ms645469(v=vs.85).aspx

 

 

Return value

...

Typically, the dialog box procedure should return TRUE if it processed the message, and FALSE if it did not. If the dialog box procedure returns FALSE, the dialog manager performs the default dialog operation in response to the message.

 

You seem to always return FALSE, which doesn't look good to me.


In Topic: General question: how to keep JavaScript organized

24 November 2014 - 02:25 AM

JavaScript is usually bound to HTML documents. Much like in C++ where you #include your headers, in HTML you <script> them. The browser reads the file top-down (again, much like C++).

 

It is a very bad idea to make the browser download a lot of files, so you usually bundle and minifyyour JavaScript.

 

It is very rare to split your code like in Java where every class gets its own file. When you write a bit more complex code, you usually wrap it inside anonymous function which you immediately execute to avoid naming conflicts. Assigning the result of the function is kind of.. weird. You usually strive to put code together, you would only do that if you wanted to expose something as public API - and this is rare in JavaScript (unless you were writing a library).

 

If you really wanted the module systems where JS files themselves include other JS, you would use RequireJS. I haven't looked into their code, but the idea is trivial: you dynamically append a <script> into your <head> and wait until the browser downloads and parses the file (much like you would add an <img>). RequireJS is relatively popular, has tools to optimize your JS (understand: minify and bundle), and you are likely to find answers to your questions at StackOverflow, and also has surprisingly good documentation. 

 

You didn't say what your project is. Is it browser-based (then just include the <script>-s in the appropriate order), or is it embedded (node, chromium)? How you make script files reference each other depends on how JS is hosted. In any case, since everything in JS is an object, the so described "modules" are just functions where you expose public API by adding it to this (e.g. this.killGoblins = function() {..}), or, if you really needed classes, using the prototype syntax (var goblin = function() {}; goblin.prototype = { object literal };). In most cases, you don't really need classes, you use duck typing. In JS, you've got a lot of free functions just because you don't really need classes and objects most of the time.

 

How I organize my code depends very much on what I'm doing. Is it a web site? Then follow whatever the framework I'm using dictates. Is it a game? If I can do it in a single file, I would. If the code is bigger, then depend on the <script> order in my JS files (usually located in /js or similar). It may sound horrible to you, but I try to do the simples possible thing first. Plus, in JS, you rarely have to have explicit types.

 

If you want your code to be more organized and be closer to what you are used to from strongly-typed languages, take a look at TypeScript. I has modules, supports including (and then bundling) multiple files, etc.


PARTNERS