965 karma · joined Aug 20, 2015 (11y ago) · 717 submissions
comment 4y ago · link · parent
In fact the whole thing then becomes a standalone function which takes Location and other relevant parameters and returns the computer sunrise/sunset values. Pure function and super easy to unit test.
If one needs to do a lot of "mockups" for your unit tests then maybe one needs to consider the API and class design. Removing needless coupling helps testability by removing the need to use mocks in the first place.
comment 4y ago · link · parent
Process separation and IPC natively using a library such as Qt is literally a few hundred lines of code.
comment 4y ago · link · parent
Well, ... the Qt3D is a higher level framework that isn't really relevant to the stuff I'm doing considering that I'm basically running my own "framework", i.e. my game engine that renders to my rendering surface.
In my use case what I really need is just to have Qt provide me a rendering surface with good performance (and ideally with working integration with the rest of the widget system) and then get out of the way.
comment 4y ago · link · parent
comment 4y ago · link · parent
I chose Qt because I'm already very familiar with it and I know that it can do so much stuff out of the box and I want the editor to work as any other app as much as possible, i.e. tooltips, shortcuts, cut/copy/paste keyboard focus etc.
So everything works fine (as long as you know Qt's quirks) except that:
OpenGL support is kind of a mess. You have QOpenGLWidget, QGLWidget,QOpenGLWindow, QGLwindow which can all support OpenGL rendering. The problem is that while QOpenGLWidget works nicely with the rest of the toolkit ( context menus etc) the Performance is very suboptimal. I found it to be an magnitude of order worse than just using a window. I'm sure there's something else going other than just FBO overhead.
Another problem related to this but not unique to Qt is how to render to multiple window surfaces but to keep to a nice framerate. If you use vsync on each surface your framerate will be your display sync divided by the # of your surfaces. If you don't vsync then you're running a busy loop and burn cycles in a busy loop. I've tried many ways to do this nicely and haven't found a perfect solution yet. Would be very happy to hear some suggestions. Currently I'm just adding a little thread delay to cap the CPU use but this creates little hiccups in animation sometimes.
15.
Show HN: 2D Game engine and editor for Windows and Linux(github.com ↗)
121 points · by ensiferum · 4y ago · 21 comments
comment 5y ago · link · parent
comment 5y ago · link · parent
You'll need to study the following.
* Computer science basics. The fundamental building blocks for computation. The bread and butter of algorithms and data structures. There's no way around this.
* You'll need to learn at least one or two programming languages in order to create actual computer programs and their related tooling.
* You'll need to learn at least one computational platform and its APIs and tools and generally how to build software for it. For example one of Windows, Linux, Android, Mac or web. Choose one.
* You'll need learn how to apply software to solving problems in any particular domain.
* You'll need to learn a ton a about the tools and practices of the trade. Distributed computing, databases, embedded, debugging, tools chains, design patterns, frameworks, APIs, libraries etc. Not all are applicable. What you should focus on depends on what what you want to work with and in which domain.
comment 5y ago · link · parent