Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 09 Dec 2005
Offline Last Active Today, 09:14 AM

#5157904 will make help me?

Posted by Bregma on 03 June 2014 - 12:37 PM

An IDE will do it all automatically for you

If, by 'automatic' you mean manually constructing the primary dependencies.  Dragging and dropping pictures of words in a picture of a directory hierarchy instead of editing a text file.  It's really the same amount of work, just a different medium.


Both are also still much less work than the way OP appears to be doing stuff at present.

#5157854 will make help me?

Posted by Bregma on 03 June 2014 - 10:04 AM

No, make will not help you here.


The purpose of make is to rebuild only what has changed, and to make sure everything that depends on a change gets rebuilt (rebuild everything that's necessary, but no more).  You still need to specify dependencies somehow.  Much of the point of make is defeated if you have One Big Header that includes all other headers.


If you're using GNU make and the GNU compiler collection, you can use extensions that will calculate compile-time dependencies, eliminating much of the work:  that's how wrappers like the Linux kconfig system and the GNU autotools work:  you simply specifiy the translation units (generally .c or .cpp files) and the rest gets determined at build time.  Other wrappers like CMake reinvent that using their own separate codebase.  These will still give you build-time grief because of your "simplified" headers, but will be less work for you to maintain the dependencies.


You might also consider breaking your projects down into modules using static libraries, so each only needs to be rebuilt when the module changes and the public API is limited to the public library API:  this should simplify your link command lines and header structure in a good way, making any tight coupling manifest.


So, make on its own will not help you here, but using make in conjunction with wrapper tools developed over the last half century or so to solve your problems will definitely help solve your problems.  It's definitely worth your looking in to.

#5154802 Location of data in the class

Posted by Bregma on 20 May 2014 - 07:01 AM

was also curious if the same could be said for functions arguments,

Vector4(float _x, float _y, float _z, float _w);

Would all these be in the same order and sequential?

Definitely not.  Most early compilers for PDP and related architectures (VAX, PPC) always pushed arguments on the stack in reverse order.  SPARCs and IBM mainframes would always pass 4 float args like in the example above in registers.  I believe many currently-popular compilers will push the args on the stack in-order unless there are free registers, in which case one or more are passed in registers, depending on the optimization settings and link visibility.  Of course, the compile could choose to inline the entire function, in which case there are no parameters.


So, no, never ever depend on the arguments to a function being in the same order and sequential in memory.

#5154705 File Loading Adds Weird Characters to the end

Posted by Bregma on 19 May 2014 - 04:59 PM

shouldn't a text file which is basically just a really long char have the 0 at the end

A file on most modern operating systems is just a stream of bytes.  Technically there is not really such a thing as a 'text file', just a stream of printable characters mixed with line-end markers (like LF on Unix, or CR/LF on DOS) and storing null-terminated C strings in a file will make it unreadable by things that expect traditional text, like text editors.


So, no, string a null byte at the end of a string in a 'text file' would be unexpected.  The conversion to C-syle strings needs to be done when the file is read by a C program (or Pascal-style strings when the file is read by a Pascal program, or....).

#5153991 Is coding games for touch screens difficult?

Posted by Bregma on 16 May 2014 - 06:56 AM

I spent a couple years integrating touchscreen and multi-touch gestures into software.  There are a few aspects to consider.


(1) Most people expect single touches to act much like mouse events.  Touch down/up are like button down/up and in between are like drag events.  If that's all you want, your toolkit should take care of it.  The main difference is the target:  people expect to be able to drag window pane content using a touch in a way they don't with a mouse.


(2) Single-touch complex ("stroke") gestures.  You can handle those yourself (using the above), or use a third-party library like $1.  Note that this sort of thing generally lacks discoverability, but I guess it depends on your game design.


(3) Multi-touch gestures.  If you're smart you will use your toolkit to handle these and simply receive gesture begin/update/end events like you do with any other input.  If you're ambitious, you can write your own gesture recognizer to integrate individual touch events over the time and space domains and worry about the combinatorics yourself.


There are some cool non-gesture multi-touch things you can do with touchscreens.  Imagine a version of Pong where the paddle appears where you put your fingers, and three fingers can make a curved paddle for trick shots.

#5149352 Do Giant Eyeballs with Tentacles Appear Too Much?

Posted by Bregma on 25 April 2014 - 05:22 AM

I see them everywhere, and now you tell me you're adding them to games too?

#5149136 copy/assignment/move constructors and private data

Posted by Bregma on 24 April 2014 - 05:17 AM

But... keep in mind the need to grab the private parts of another object is a code smell very indicative of poor design.  You might want to re-think the single purpose of your class(es) or their interface(s) before your project grows much more.

#5148110 What is the point of blocking sockets?

Posted by Bregma on 19 April 2014 - 06:21 AM

Apart from toy programs - is there a use for blocking sockets?

Using a blocking socket is a common and sane way to implement a server.  In fact, it's pretty rare that you need non-blocking sockets in my experience.


Almost all servers I've had the pleasure of working with use socket multiplexing and blocking sockets.  The code is simpler and less error-prone.  Unless you've written erroneous code, it's not possible to block indefinitely on a read, because you only read when the multiplexor (select()/poll()/epoll()/kqueue() etc) indicates data is available.

#5147380 c++ oo syntax behind the scenes behavior

Posted by Bregma on 16 April 2014 - 10:29 AM

If you add more virtual functions, the class size does not grow though.

That can be a little misleading.  The size of objects (class instances) does not grow, but the vtable size changes, and maybe even its layout changes.  That's important to know, because it's an ABI change and the not infrequent cause of subtle and inexplicable runtime failures.


This sort of thing shows up as a problem if, for example, you add a virtual function to a header file and rebuild a program, but do not rebuild a DLL that also uses the header file.  Bam!

#5146378 I have some new habits.

Posted by Bregma on 11 April 2014 - 01:34 PM

Now, how would you express units in programming where you could also convert between them?

If you're using C++, user-defined literals are the way to go.

#5146377 What path to take in programming?

Posted by Bregma on 11 April 2014 - 01:27 PM

Don't assume you get job training, get a job, then retire and die.  Life is short: make it wide.  Stay in school, get a broad and unfocused education.  Learn.


I graduated some time ago, and I'm now working in a field and using technologies that weren't even dreamed of when I was in university.  Focus now on learning as much as you can about as much as you can, worry about the job training you'll need in your just when you finish your education and the job you fall in to has been created.

#5145142 Duel or Multi-boot Operating Systems - Windows OS

Posted by Bregma on 07 April 2014 - 01:21 PM

It is my experience that multi-boot is a cheap solution, and that getting dedicated hardware for the job is better if you can afford it.  If you're doing this professionally, don't waste time with multi-boot systems.


Multiboot systems work.  Dedicated systems work better.

#5143547 Linux development...

Posted by Bregma on 31 March 2014 - 01:43 PM

OH btw how are you all finding these libs to add to the development kits? I am lost on these...

package manager (apt-get irrlicht-dev)

You're using Mint, which is based on Ubuntu, which is a Debian derivative. Debian uses the "deb" package format -- a standard way of packaging software and declaring all the necessary dependencies.

Unlike, say, Windows in which there is no such thing as a standardized way of distributing software, most Linux distributions stick to providing all software in a single way (although different distros use different ways -- there is no "there" there in GNU/Linux).

On a Debian-derived system, the package is the "deb" and there are several tools to use debs. The most fundamental one is "apt" and you'll see instructions for downloading and installing packages from the command line using the "apt-get" command. The apt-get command will select a named package from your configured sources and download that package and all other packages required to make it work, and install them. If you always use this tool, your system will never get in to a broken state.

If you start up your Mint system, open a terminal, and type "sudo apt-get install libirrlicht-dev" the system will find, download, and install the Irrlicht development package (which contains header files and link libraries) and the libirrlicht1.8 package (the runtime DSOs, or shared libraries) required to develop against Irrlicht. You can see more information on that package by using the command "apt-cache show libirrlicht-dev", and you can see what files were installed using the command "dpkg -L libirrlicht-dev".

The installation command must be run as the superuser (a privileged administrative user) because it installs the packages system-wide. That's what the 'sudo' command does.

These are all basic commands you just need to learn. There is a learning curve for any system, including the one(s) you already know. It's no harder to do things on a GNU/Linux system than on any other system, don't let your prejudgement fool you.

Tip: to find other development packages, for example, the SDL2 packages, use "apt-cache search libsdl2" to search. The standard Debian naming convention is to prefix a library package with "lib" and suffix a development package with "-dev".

#5143522 Linux development...

Posted by Bregma on 31 March 2014 - 11:32 AM

I need some recommendations for IDE under Linux.
QtCreator? If I remember right the UI wasn't to friendly to get a simple C++ project working....

I think you're probably mistaken. Try it.

How do I install the latest drivers for this GPU? From what I can tell the latest don't support the X1300?

I don;t know much about Mint, but they'll have the command line available to you from which you can just do an "sudo apt-get update; sudo apt-get upgrade" and that will make sure the latest tested drivers are installed. I strongly recommend using drivers that have not been tested and packaged in the Ubuntu archives, that's a good way to brick your system if you're not an expert.

What is X11? Do I need it?

X11 in this context is the display server: it's the software responsible to drawing everything to your video screen. You don't need it: most servers run without video displays. If you want to make graphical games, however, you will probably want it.

I would like to use Irrlicht also but couldn't get that working either.

That's a little vague. Perhaps there are errors or something?

So I am not liking the experience so far... Not trouble free at all....

Here's quick rule of thumb: get everything from your distro unless they don't have it. If they don't have it, as a beginner, you probably don't need it yet.

Hope to overcome the sour taste of this and enjoy coding on Linux but need some serious help!!!

Welcome to the dark side. We have the answers.

#5142977 MSVS's preprocessor vs gcc's preprocessor

Posted by Bregma on 28 March 2014 - 08:30 PM

Bregma, on 26 Mar 2014 - 2:15 PM, said:

I think the header files may be set up to build under MSVC, so the #ifdefs may be set incorrectly. What if you add -DGLAPI to the command line?

When I did that I got this but I don't know how to send all my errors to a file. I know how to use fprint in c to send output to a file but I don't know about errors:

I googled how to redirect stderr and stdout in the DOS command line for you.  I'm not sure if you're using the DOS command line or a POSIX-style shell (like MinGW32), but either way they're the same: >out.log 2>&1.  You put that at then end of your compile command to capture the diagnostics.  Can be a lifesaver.


From your description I really suspect there is a different set of predefined macros supplied by the different compilers, and that some header file is making an invalid assumption about the meaning of them.  You plan of attack should be to grep (search) through all of the header files to find one (or more) line(s) where GLAPI is #defined, then figure out which combination of macros is required to get it defined correctly.  It is normal for different compilers to have different sets of predefined macros; it's one of the things that makes preprocessing actually useful.


You can get a list of predefined macros from GCC using the -dM switch (from the GCC manual: touch foo.h; cpp -dM foo.h).  I seem to recall MSVC has a similar thing.  I suspect the culprit may be something like #ifdef _WIN32 used incorrectly (but don't quote me on the macro, it's just an example).


Good luck.