Jump to content

  • Log In with Google      Sign In   
  • Create Account


Jebbs

Member Since 30 Jul 2011
Offline Last Active Mar 06 2014 11:08 PM
-----

Topics I've Started

Method returning a constant

16 September 2012 - 11:03 PM

Hey guys!

I'm fairly new to C++, but when ever I see something I'm unsure about I always try to figure out what's happening. I've seen this a couple of times, but never used it.

[source lang="cpp"]type Foo() const{ return stuff;}[/source]

Why is it that the returned value should be a constant? Why wouldn't it be a constant already since in theory you shouldn't be able to alter it?

I feel kind of silly asking this since I am not that new to programming and I feel like this is something I should know, so go easy on me!

Game Development In D

15 August 2012 - 10:10 PM

Hey guys!

I recently stumbled upon the D language, and I really liked what I saw. I plan on learning the language for fun, but I was curious to see if there are any people out there making games with this spiffy language! Or perhaps just using it in general? I feel like the D language really has a lot of potential and wanted to know what others thought.

New to pointers

05 August 2012 - 04:33 PM

Hey guys!

I'm not new to programming, but it's been many years since I really used C++, and I don't think we even touched on pointers(it was in highschool). Anyways, I have some working code, but since I'm not a pointer expert I wanted to make sure that I was doing this correctly.

Currently, I'm working on a small prototype for a game to kind of help me get some basic ideas down as well as help me get back into the way C++ does things. I'm using SFML and my question really applies to how I have my game screens set up. In each game screen, it holds a pointer to the RenderWindow so that when Draw is called the RenderWindow would not have to be passed before each frame is drawn.

Since the RenderWindow will have its own destructor called all I do is set the pointer to 0. Is that all I really have to do?

Here's some code just to be certain.

This is not all my code, just the code in question. Like I said, I wanted to make sure that I'm doing this correctly. Everything compiles and it runs fine!

tl;dr

Is this an acceptable use of pointers?

class BasicGameScreen
{
	private:
	//Window used for Rendering
	sf::RenderWindow *MainApp;
	public:

		void Initialize(sf::RenderWindow &App)
		{
				  MainApp = &App;
		 }

		void :Draw()
		{
		  
			//drawing whatever
		    MainApp->Draw(Background);
		    MainApp->Draw(Sprite);
		}

		~BasicGameScreen()
		{
			 MainApp = 0;
		}
}

Aspect Ratio in 3D

10 February 2012 - 11:06 PM

Here's something I've always wondered about.

What kinds of things are going on when the same game is viewed in different aspect ratios? Is more of the scene present in widescreen than non-widescreen, or is the game written using one ratio and then scaled accordingly to match the new ratio?

I tried to look for this online, but I wasn't sure what to search for.

Thanks, guys!

PARTNERS