Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 09 Jan 2001
Offline Last Active Yesterday, 04:46 AM

#5286132 Yo dawg, I herd u liek gd.net

Posted by MarkS on 10 April 2016 - 08:36 AM

I'm going to don my tinfoil hat and say that that wasn't made by any administrator here...

#5264126 Looking for a free 2D engine

Posted by MarkS on 29 November 2015 - 11:35 AM

I haven't used it, but Godot Engine looks quite powerful and it's free.

#5262077 Member function pointers?

Posted by MarkS on 14 November 2015 - 09:24 PM

If you use C++11 onward, you  should use std::function and combine it with std::bind.

class AnotherObject
   std::function<void(void)> callback;

class TestObject
   void MyFunction() {};

int main()
   AnotherObject ao;
   ao.callback = std::bind(&TestObject::MyFunction, &ao);

#5261217 How hard it is to live from games as indie developer?

Posted by MarkS on 09 November 2015 - 03:26 PM

I remember reading an article written by the lead programmer of an indie project on iOS. His project (not a game) was an overnight sensation with over 10,000 downloads. The amount of money he made through those sales totaled something like $300 USD.
I wish I kept the link!sad.png

#5260936 Connecting to SQL Server

Posted by MarkS on 07 November 2015 - 03:55 PM

Please quit posting the same thing over and over. The servers are having difficulty at the moment. Give it time to update.

#5260343 bmp Loader class

Posted by MarkS on 03 November 2015 - 11:36 AM

What I do for storing images/textures is keeping them in a format of my own. Of course, that's probably not useful to you but, why not post it?

To add to what Alundra said...

You start by making up a header format. It doesn't have to be long or complicated:
image_width : 4 bytes
image_height : 4 bytes
bytes_per_pixel : 1 byte
In code, it would be:
struct image_header{
long image_width;
long image_height;
char bytes_per_pixel;
To write the file, you write out the correct number of bytes for each header field and then the image data from your buffer. I prefer not to make assumptions about integer size and thus header size. "long" may or may not be 4 bytes, depending in the platform, but can be guaranteed to be no less than four bytes. Always explicitly write out the correct number of bytes per field and never rely on "sizeof(image_header)" when reading the file. On some 64-bit systems, "long" might be 8 bytes, in which case reading or writing "sizeof(long)" will not get you what you expect.

Reading is the reverse of writing.

#5259998 How do I re-size a binary file?

Posted by MarkS on 01 November 2015 - 10:24 AM

Why are you trying to resize "Batman Arkham Asylum" assets?

That is interesting...

#5259949 bmp Loader class

Posted by MarkS on 31 October 2015 - 07:15 PM

Yes bmp sucks but I feel so close. This code works perfectly with bmp only one flaw when I try to free the pixels I get heap corruption. !!! 
The only reason I use this format because I dont want to overload my head with compression and decompression, as I understand and correct me if am wrong everything else including targa uses compression.

Compression is optional in TGA files. I've never used it.

#5259910 bmp Loader class

Posted by MarkS on 31 October 2015 - 02:09 PM

There is also DevIL to consider.

#5259895 bmp Loader class

Posted by MarkS on 31 October 2015 - 11:24 AM

First off, I wouldn't recommend using BMP as a texture storage and loading format. Ideally, you'd create your own format, but barring that, I'd use TGA. It is far easier to load as the format just makes sense. BMP is highly screwed up, as you've noticed. The pixels are not stored as you would expect. Padding *may* be added per scanline, which makes looking at the file with a hex editor all but useless.


If you are insistent on using BMP, do some studying:






It is not a programmer-friendly format.

#5259811 How to get angle for 360 degrees for a line

Posted by MarkS on 30 October 2015 - 05:15 PM

I'll let Dijkstra answer: http://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/EWD831.html

Well, yes, such as it applies to computers and programming. I was thinking about how math is taught in school.

#5259628 Confused at rotating an object around a transformed circle

Posted by MarkS on 29 October 2015 - 03:12 PM

You need to scale your object radius in the Update function by the same amount you scale the path.

Changing this:
obj[i].y				= obj[i].radius * Math.sin(angle);
To this:

obj[i].y				= (obj[i].radius * 0.3) * Math.sin(angle);
Fixed the problem.

#5259366 Game development with assembly. Where to start?

Posted by MarkS on 27 October 2015 - 10:18 PM

For the past few days I have been learning assembly and I was wondering how to display graphics on the screen.
I'm doing this just for fun because I feel like I'm starting to burn out on my main game project and I thought I would do something fun like learn assembly. However displaying text on a console wasn't very exciting for me. So I'm taking it to the next level.
So, does anyone know how to start game development with assembly?
thanks happy.png

Why do you want to do this? What do you hope to gain? Yes, there is still the ability to write optimized assembly, but you can write just as optimized code and write it far quicker in a higher level language with today's compilers. I certainly recommend learning assembly, but for no other reason than to know what is going on behind the scenes. It's a step up from writing code directly in binary. It's like learning how to fix an engine to get your driver's license.

#5258187 Why didn't somebody tell me?

Posted by MarkS on 20 October 2015 - 03:41 PM

Lessie if I can explain better: (or maybe just make it more confusing)

const int* type1; // non-const pointer to const int
int* const type2; // const pointer to non-const int

int value1 = 1 * 2; // 2
int value2 = 2 * 1; // also 2

typedef int* IntPtr;
const IntPtr type3; // const pointer to non-const int
IntPtr const type4; // ALSO const pointer to non-const int

const int onePlusOne = 1 + 1;
int value3 = onePlusOne * 2; // 4
int value4 = 2 * onePlusOne; // 4

#define INT_PTR int*
const INT_PTR type5; // non-const pointer to const int!
INT_PTR const type6; // const pointer to non-const int

// of course if the * isn't there, suddenly const is commutative
const int type7; // const int
int const type8; // ALSO a const int

I'm still lost. Maybe I'm reading your example as compilable code and it's not? type1 - 8 are not used with value1 - 4, so I'm lost on the math issue. How does const int vs. int const change the way the compiler calculates the mathematical expressions?

#5258011 Problems writing a BMP exporter

Posted by MarkS on 19 October 2015 - 05:12 PM

Its kind of funny how those two modes work, they have basically an entire complete PNG or JPEG file where the pixel data should be. (you can read in a JPEG file, stick it inside of a bitmap container in memory, and send it to GDI and it will render it)

Most likely to get around patent issues.