Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

1360 Excellent

About dilyan_rusev

  • Rank
  1. I don't really get your logic, but for all things Microsoft, you should look it up on MSDN.   https://msdn.microsoft.com/en-us/library/windows/desktop/ms648009%28v=vs.85%29.aspx
  2. The only thing that can go wrong is the HINSTANCE you pass. In the call to LoadBitmap, you use (HINSTANCE)GetWindowLong(WindowMain, GWL_HINSTANCE) By default, that would be the HINSTANCE you passed to WNDCLASS/WNDCLASSEX you registered before you created the HWND via CreateWindow/CreateWindowEx. The association is the class name.   With FindResource, you obtain the HINSTANCE via GetModuleHandle(NULL) which is used to get the HINSTANCE of the exe that started the process.   In the rare case that these two differ (e.g. the code is split between EXE and DLL-s), you should call LoadBitmap with GetModuleHandle(NULL).
  3. I haven't tried it, but my guess would be that you'd have to re-create the window and its renderer.
  4. dilyan_rusev

    Getting error when receiving with SDLNet

    This is the reason I like using std::vector and it's data() accessor. Priceless when you have to work with Win32.
  5. dilyan_rusev

    Generic Installer - Cross Platform

    I do not think such a thing is possible.   TLDR:   Operating systems are different and they handle software installation in a different fashion. Next-next installers are a very Windows thing. Other OS-es handle adding software quite differently. Do not belive that there is a magic pill that will help you distribute your software in a uniform way (well, apart from Steam maybe). At the very least, users of different OS-es *expect* that adding software will be done differently.   The details:   On Windows: the classic is to use Windows Installer (a.k.a. .msi) many companies use WIX, an abstraction over WI. It is free, and also open source, if you care about that. some use InstallShield many use the Nullsoft installer (NSIS) - also free and open source you can write your own from scratch, it is relatively easy (if you have even modest Win32 experience). Time consuming if you haven't written an installer before. On Linux dstributions - there is no such a thing as universal installer :) They all go out of their way to make it difficult to provide binary packages that can survive more than a few releases/years, let alone compatible across distributions. There are alternatives to WI, such as .deb and .rpm, but I would recommend against going that route if you depend on other packages being installed, as packages get split or renamed over the years. Most software that works even after decades is to basically statically link against everything and do not depend on OS filesystem layout besides ~ and your installation directory. Also, limit your use of OS libraries to the bare minimum - prefer building all dependencies on your own and bundle them with your app (as you would on Windows). Plan to include a shell script that will force the loader to use your libraries instead of the system libraries (as they will be built with a different compiler version, etc).   If you want graphical installer for Linux - there used to be the Loki installer, but I'd recommend to try Steam and link to their libraries. It will be easier for both you and your users.   I've never owned a Mac, so I can't say anything about that.
  6. dilyan_rusev

    C# becoming obsolete ?

    It really depends on what you want to do.   For game development, C# + WinForms is the easiest way to integrate with native code (if you're writing an editor or just need a lot of P/Invoke).   For business applications, C# + WinForms isn't dead either. Visual Studio's WinForms designer makes it easy to very quickly write small utility applications, which is ofthen what IT departments would do, especially for state institutions.   WPF can achieve impressive visuals, but suffers from internal Microsoft power struggels (the guys that do tools vs the guys that do the OS). If it is updated to more easily support newer DX withouth the Windows Runtime, I guess it will be used even more.   All the flashy news are for web technologies, and Microsoft try to follow with ASP.NET MVC. Last time I wrote a site with MVC, I was impressed with how easy it was. You get ORM + template engine + great debugging experience. Recentely, they've been going to the world of "stuff happeing automagically if you follow The Convention". Whether or not you like that is a matter of preference. In my opinion, their web stack is a good piece of technology, and it has its following.   ASP.NET WebForms is dated technology.  People hate on it too much, IMO. Still, a few years ago it was VERY popular, and lots and lots of sites were written using it. Which means they'll have to be supported. Also, some .NET CMS-es were based on WebForms. I guess they've isolated those parts over the years, but that means even more sites depend on WebForms. Again, my own opinion is that this is not a very good implementation, but the idea of reusable components is a good one.   When it comes to databases... I haven't done that in years. What most people around me use these days are either ORMs that are related to the framework/language of their choice, or a very small population of very vocal hipsters that use alternative storages, like MongoDB. IMHO most sites can do with SQLite, but many people want to engineer big and complicated setups for sites with less than a thousand visitors a month.  My advice would be: get familiar with basic SQL syntax. You don't need to be a wizard or anything, but if you use an ORM, you will have to go down to SQL when debugging. Also, regardless of what database engine you use, the basic SQL is mostly the same. When you are at it, take some time to look at MongoDB - it is the most popular alternative storage in my dev circle.   In summary: .NET ain't dead yet. If you work with .NET, you'll be most likely doing business apps/sites or supporting such. This is not bad, as it is usually a very stress-free job that pays well.   If you want to do web, forget two years of studying. Start writing simple sites ASAP and learn on the go. Blog would do - the ability to write blog posts & comments in a site is a nice test to see if you can handle security (logging in, setting up https), storage (can go with simple files, any SQL engine, or the new document storages), templates and client-side programming. When you do a veeeery simple blog post, do one-pager site (e.g. https://onepagelove.com/) and make it mobile-friendly with responsive design. If you pull these off, you're ready for 99% of web development jobs. Plus, you've immediately hireable, as you have something to show for your words.
  7. IIRC, an variable of an empty struct would also be at least one bit, beacuse the stardard says every variable must be addressable (via the & operator). I do not remember if it is one bit or whatever the compiler decides, though.   x86 can and does process 8 bits via the original A, B and C registers, this is used for casting between ints of different size, IIRC. Also, nothing stops you from using bitwize operations to store and extract bits from an unsigned integral type. As others have said, vector<bool> is supposed to do that for you; the implementation depends on unique values being a power of 2; you store with bitwize | (result is assigned to storage) and extract with bitwize & (result is tested flag if present).
  8. dilyan_rusev

    Porting my game to Linux

    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.
  9. 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.
  10. 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.
  11. dilyan_rusev

    Windows Dialog Background Color

    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     You seem to always return FALSE, which doesn't look good to me.
  12. 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 minify your 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.
  13. dilyan_rusev

    C# .Net Open Source

    I haven't got the time yet to take a look at what's been open-sourced, but the advantage of Mono over .NET is, and has always been, that it can be embedded in your app. No messy installations, just copy-paste a lot of files into your game directory. A lot of people underestimate installers/uninstallers :)   I'm curious what will follow. Making VS free for "non-enterprise users" (in the Connect() videos they said small companies and indie devs are OK) is an awesome move. If they invest in clang for windows apps (mainly for the clang tools), it would be really awesome.
  14. dilyan_rusev

    Programming a website?

    The classical resource for learning web technologies is w3schools (http://www.w3schools.com/). Start with the html5 and css3 tracks, then do the javascript track, as advised by alexw.   Then, you will need to learn frameworks that will make your life *a lot* easier. A must-know is twitter bootstrap (http://getbootstrap.com/). It basically eliminates the need to write your own css (but you still have to know how it works in order to tweak small things).   For simple sites, that's all you are going to need. If you need a little bit more complicated stuff, get familiar with XMLHttpRequest (https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest - mozilla's site is another great resource for web-related technologies) - this is the backbone of the modern web (in tandem with responsive design, which bootstrap will mostly handle for you). Then you may want to get familiar with jQuery/jQueryUI - do not learn it, just browse the demoes to know what is possible. The popular kid on the block these days for javascript is called anglular js (https://angularjs.org/), so you might want to learn that if you need more complicated web site (99% of people don't, although they they it might be kewl to sprinkle some useless crap to slow down their web site on slower smartphones, which are still prevalent). Still, it doesn't hurt to know what is possible with Angular.   This, mind you, is all on the client - defines the look&feel of your web site. The backend, however, is a different beast. ASP.NET MVC is a good start, since Microsoft have a ton of tutorials and it is easy to get started. If you don't like it, there's Django (if you are familiar with Python), Rails (if you prefer Ruby), CakePHP (if you are familiar with PHP), and.. I'm not a Java person, but I've heard of Spring. Pick the one whose programming language you are most familiar with and you'll find a lot of tutorials online.   Remember, you don't need complicated and fancy stuff just because everybody else is doing it.   Firebug is your best buddy for client web development :)   Now, these are more more complicated advices, so you might want to ignore them at first. Make your site work fast, make it work beautifully on smartphones/tablets via responsive design and don't overuse javascript. Web sites are fast if you do stuff with CSS, not Javascript, and also if you don't use AJAX for everything (if at all). Learn about bundling and minifying javascript/css, learn to use spritesheets with CSS for your images (if you are curious, look at the images in facebook). The goal, just like game programming, is to reduce the number of requests the browser makes to the server for files. The less files the browser has to download, the better. If something is static, put it in CDN. If parts of your site are static, cache them (different serves use different technologies to achieve this).
  15. TL;DR; - No Java in Visual Studo; whether Java or C# is simpler/faster is arguable; C# is definitely better for cross-platform development   Java is not an option for Visual Studio, C# is. Java has some great and free IDEs - like Eclipse, for example.   Java's runtime is older, and its many implementations have had much longer time for optimization. Even Anders Hejlsberg admits that .NET's CLR is a bit behind on optimizations compared to Java's runtime implementations. Only recently they've added SIMD via RyuJit.   C# is... a mix between C++ and Java. The concept of using a virtual machine, everything is an object, runtime type safely, etc, are all there. However, much like C++, C# allows you to go under the hood with unsafe, fixed, staticalloc, value types, P/Invoke, raw pointers, etc. It is not as efficient as C++, but at least you don't have to implement custom allocators for most of the things you do, as allocation for .NET (and I believe Java) is already (almost) a memory pool for everything.   When you consider the more mature runtime(s) of Java and the ability for static allocation in C#... it is not easy to judge which is faster.   The same goes for language beginner-friendliness. Java's been around for ages, and has stayed mostly the same. It is rock-solid language that has a lot of good, established books for it. Books of such quality are somewhat lacking for .C#. On the other hand, C# has been evolving to reduce boilerplate and make easy things easy, so it's constantly been getting easier. As a result of that, however, C# has a ton of features and keywords. Some things can be done 3 or 4 ways. Both Java and .NET have duplicating libraries as part of the standard package (it is worse with Java, as it has been around for longer); some basic things are missing in the Core Java, so you must use third-party libraries   While Java is complie-once-run-everywhere... that doesn't hold up in real life. Only Core Java is supported on Android. SWT, one of the UI frameworks, some libraries (SWT) are quite buggy on some OS-es and slow to adapt new features. You can't embed Java in your application, while, with Mono, that is often done in games. Much less often than JavaScript or Lua, but still quite doable.   With Xamarin, C# is much, much more portable than Java. When you say "cross-platform" - what does that mean? Mac/Linux/Windows? There's much more - Android, Windows Phone, iOS, BlackBerry, all the gaming consoles. You can use C# almost everywhere (I'm not a licensed PS4 dev, so I don't know if Mono compiles there) - whether directly via .NET, or embedded via , or via Xamarin's tools. Java can be seen on all major desktop and server OS-s, and on some embedded devices. To say that Android has Java is.. not correct. It is not a licensed implementation, and only Core Java works there; Java 8 is not supported, and Java 7 is supported only on KitKat+ devices AFAIK.   I love both languages/environments. They are nice, modern, productive, evolving for the better (mostly). Since you've mentioned Visual Studio - use C#. You can use MonoGame, SharpDX, Unity, etc.
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!