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!


fastcall22

Member Since 04 Feb 2008
Offline Last Active Today, 01:40 AM

Posts I've Made

In Topic: Is it pronounced "tomato" or is it pronounced "tomato"?

Yesterday, 09:50 AM

Okay. I'm not able to add a poll to an existing thread, so just make reply with your answer:


How do you pronounce "Tomato"?

A. "Tomato"
B. "Tomato"
C. Other

In Topic: Rate my Game Loop

16 April 2015 - 02:17 PM

Rating:
★★☆☆☆ (2 of 5 stars)

Does not handle the spiral of death.
Would not recommend stepping time with programmer again.

---

In addition to what others have said, you may want to consider the case when the simulation can't keep up and must sacrifice updates to keep the simulation going. Otherwise, the simulation will grind to a halt.

In Topic: FastCall Is Alll

16 April 2015 - 11:06 AM

omg dsm-senpai noticed me ohmy.png

It was written in response to dsm's affection to trigraphs. I figured, why stop at trigraphs? Here's teh code. There's still room for "improvement," but whatever:

http://ideone.com/1lnIcm
#include <iostream>
#include <vector>
#include <sstream>
#include <algorithm>
#include <string>
#include <iterator>
 
#define mod %
#define div /
#define mul *
#define add +
#define sub -
#define insert <<
#define extract >>
#define shl <<
#define shr >>
#define bor |
#define band &
#define bxor ^
#define bnot ~
#define ptr *
#define assign =
#define equal_to ==
#define addr_of  &
#define open_paren (
#define open_bracket [
#define open_brace {
#define open_angle <
#define less_than <
#define close_paren )
#define close_bracket ]
#define close_brace }
#define close_angle >
#define greater_than >
#define comma ,
#define call ()
#define member .
 
#define block_begin {
#define block_end }
#define stop ;
 
int main open_paren int argc comma char ptr ptr argv close_paren
block_begin
	using namespace std stop
	string line stop
 
	while open_paren
		cout insert "\n> " insert flush and
		getline open_paren cin comma line close_paren close_paren
	block_begin
		istringstream stream open_paren line close_paren stop
		auto vec assign vector open_angle int close_angle open_paren
			istream_iterator open_angle int close_angle open_paren stream close_paren comma
			istream_iterator open_angle int close_angle call
		close_paren stop
 
		sort open_paren
			vec member begin call comma
			vec member end call
		close_paren stop
 
		cout insert '[' stop
		if open_paren vec member size call close_paren block_begin
			copy open_paren
				vec member begin call comma
				vec member end call sub 1 comma
				ostream_iterator open_angle int close_angle open_paren
					cout comma ", "
				close_paren
			close_paren stop
			cout insert vec member back call stop
		block_end
		cout insert ']' insert endl stop
	block_end
block_end
stdin:
9 4 -3 4 0 7 8
-3 4 7 10 9 6
4 3 1 5 7


stdout:
> [-3, 0, 4, 4, 7, 8, 9]

> [-3, 4, 6, 7, 9, 10]

> [1, 3, 4, 5, 7]

>

In Topic: Constant Buffers Disappearing

14 April 2015 - 07:59 PM

How are you setting up your constant buffer? Are you filling it with DeviceContext.MapSubresource and are you attaching it to the shader via DeviceContext.VertexShader.SetConstantBuffer?
Is it disappearing randomly during the program, or before the very first frame?

In Topic: How would I convert a number into binary bits, then truncate or enlarge their...

12 April 2015 - 11:56 AM

Well, I thought so too... But when I write the number itself to the file, it is writing the ASCII value to the file. I assumed it might do the same thing even when I store it in a bit container


There's a difference between stream << uint32 and stream.write(reinterpret_cast<const char*>(&uint32),sizeof(uint32)), regardless of whether or not you open a stream in binary or text mode.

In text mode, new lines are translated to a unified format: Any combination of 0x0D and 0x0A (windows, mac, and unix line endings) are translated to just 0x0A (IIRC).
In binary mode, there are no newline translations: "\r\n" remains as 0x0D 0x0A.

If you actually want to read and write binary data, then use stream.write/read:
int main() {
    unsigned short val = 1234; // (0x04D2)

    ofstream fs("out",ios::binary);

    fs << val << '\n';
    fs.write(reinterpret_cast<const char*>(&val),sizeof(val));
}

/* out contains (on a little-endian machine):
HEX                     ASCII
31 32 33 34 0A D2 04    1234.Ò.
*/

PARTNERS