<?xml version="1.0" encoding="ISO-8859-1"?>

<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
	<channel>
		<title>3D Buzz - C and C++</title>
		<link>http://www.3dbuzz.com/vbforum/</link>
		<description>All discussions pertaining to programming using the C or C++ languages! Get advice, or give some of your own!</description>
		<language>en</language>
		<lastBuildDate>Thu, 09 Sep 2010 04:38:42 GMT</lastBuildDate>
		<generator>vBulletin</generator>
		<ttl>60</ttl>
		<image>
			<url>http://www.3dbuzz.com/vbforum/images/misc/rss.png</url>
			<title>3D Buzz - C and C++</title>
			<link>http://www.3dbuzz.com/vbforum/</link>
		</image>
		<item>
			<title><![CDATA['Learning Engine'?]]></title>
			<link>http://www.3dbuzz.com/vbforum/showthread.php?184675-Learning-Engine&amp;goto=newpost</link>
			<pubDate>Thu, 09 Sep 2010 01:32:59 GMT</pubDate>
			<description><![CDATA[I'd like to try my luck at learning a decent amount of C++/OpenGL implementation, etc, and I figure one of the best way to do it is between video reference and actually 'doing'. The other way would be having a partner throughout at least one project, for the sake of learning from someone more...]]></description>
			<content:encoded><![CDATA[<div>I'd like to try my luck at learning a decent amount of C++/OpenGL implementation, etc, and I figure one of the best way to do it is between video reference and actually 'doing'. The other way would be having a partner throughout at least one project, for the sake of learning from someone more experienced... of course. Though generally unlikely to get such a productive benefit. :) For some reason, I feel as if the OpenGL videos are a bit... rushed after they start getting into the inner-workings of the structure, to the point Joel's more concerned with getting through the video than spending time explaining things, so I get a bit lost trying to follow what does what, when, and why. In some cases, at least.<br />
<br />
Not at all to say that the videos aren't excellent; using it as a reference or a means of getting something functional  into application materials, I couldn't imagine a better structure. But, I'm not sure if it's just me and how my mind's working with (Or perhaps against) the videos, or what it happens to be, but I just finished up with Particle Engine structure (Which I, of course, can't get to work properly due to no textures) and... to be perfectly honest, half the code I re-read from the Particle Engine, I don't really too well understand after creating the controls.<br />
<br />
Creating the controls, I understand from beginning to end, and after a little fiddling, I figured out what the &quot;hack&quot; Joel put into play with the AddControl functionality did, and decided to... advance it, a little bit to fit my wants for it.<br />
<br />
I can't make a whole lot of sense of the Emitter or Particle classes, for some reason. I understand from the variables what they do, and what the functions are supposed to do, but... something about the code itself isn't registering, as far as how I can use it later, in what other ways (As in, if I wanted to create my -own- file later... how does all of that work, that might be useful for me?).<br />
<br />
So, I'm thinking that if I can find a non-scripting Engine that allows me to see the actual standardized code behind the scenes, I can get some ideas for how to implement different project ideas. Are there any freebie-type engines out there that might be of particular use to me in this goal?</div>

 ]]></content:encoded>
			<category domain="http://www.3dbuzz.com/vbforum/forumdisplay.php?217-C-and-C">C and C++</category>
			<dc:creator>PDI247</dc:creator>
			<guid isPermaLink="true">http://www.3dbuzz.com/vbforum/showthread.php?184675-Learning-Engine</guid>
		</item>
		<item>
			<title>Normal Shader, Magic numbers</title>
			<link>http://www.3dbuzz.com/vbforum/showthread.php?184670-Normal-Shader-Magic-numbers&amp;goto=newpost</link>
			<pubDate>Wed, 08 Sep 2010 14:50:09 GMT</pubDate>
			<description>Hello, 
 
I have a question regarding the magic numbers in the fragment shader of normal map. 
 
 
Code: 
--------- 
vec3 nNormal = normalize ((texture2D (bumpMap, Texcoord).xyz * 2.0) - 1.0); 
--------- 
so we are reading the normal data from a texture and then we multiply it by 2.0 and then we...</description>
			<content:encoded><![CDATA[<div>Hello,<br />
<br />
I have a question regarding the magic numbers in the fragment shader of normal map.<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">vec3 nNormal = normalize ((texture2D (bumpMap, Texcoord).xyz * 2.0) - 1.0);</code><hr />
</div> so we are reading the normal data from a texture and then we multiply it by 2.0 and then we subtract the whole thing from 1.0. why?<br />
<br />
is it because we are trying to limit the range? <br />
<br />
Thanks,</div>

 ]]></content:encoded>
			<category domain="http://www.3dbuzz.com/vbforum/forumdisplay.php?217-C-and-C">C and C++</category>
			<dc:creator>hamol3d</dc:creator>
			<guid isPermaLink="true">http://www.3dbuzz.com/vbforum/showthread.php?184670-Normal-Shader-Magic-numbers</guid>
		</item>
		<item>
			<title>Choice Decisions</title>
			<link>http://www.3dbuzz.com/vbforum/showthread.php?184667-Choice-Decisions&amp;goto=newpost</link>
			<pubDate>Wed, 08 Sep 2010 06:16:46 GMT</pubDate>
			<description><![CDATA[Shortly after I went through all the ASCII C++ game videos (Ending with the implementation of the Mage & Fireball), I went back and started from scratch to create my own project, using 3D Buzz's structure as somewhat of a model so to speak (Although I think about four lines of their code, excluding...]]></description>
			<content:encoded><![CDATA[<div>Shortly after I went through all the ASCII C++ game videos (Ending with the implementation of the Mage &amp; Fireball), I went back and started from scratch to create my own project, using 3D Buzz's structure as somewhat of a model so to speak (Although I think about four lines of their code, excluding the game loop, was actually included in my version), of how it should operate. Now, during the videos, they mentioned that they were going to set it up in such a way that it would be rather easy to allow the user to select from more than just a Mage, using more than just a Fireball. I agree with that concept - that it's easy to add to; but I'm curious if I did it the right way.<br />
<br />
When developing a basic character creation screen (Choose your Name, Age, Class, etc), what is the best method of implementing the class? Would you have the player decide a class, and then, based on that class, use if/else statements to determine which 'new Class' is created ('new Mage', etc), or is there a better, more efficient way to do it?<br />
<br />
While on that topic, is the best method of having the user decide using Arrays, filled with the class choices?<br />
<br />
Ex:<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">string Class[2];<br />
Class[0] = Mage;<br />
Class[1] = Warrior;</code><hr />
</div> Output Character Creator:<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">for (int i = 0; i &lt; 2; i++)<br />
&nbsp; &nbsp; cout &lt;&lt; i + 1 &lt;&lt; &quot;: &quot; &lt;&lt; Class[i] &lt;&lt; endl;</code><hr />
</div> Input Construction:<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">int x = 0;<br />
cin &gt;&gt; x;<br />
string pClass = Class[x - 1];</code><hr />
</div> What I did was have arrays allow decisions; when the user saved, they'd save out the users' data mostly in numbers. These numbers being the index of each of their options (Mage Class would save out as 0, for example). When the user loaded the character again, the program would pull out the index chart. It would pull the information out of the file (0), then it would say something like... <br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">pClass = Class[x];</code><hr />
</div> The only thing that wasn't saved out as a number was the name, since they manually added that, themselves.<br />
<br />
What I'm looking to do is attempt to get myself to a state of mind, where I'm... at least partially comfortable with the concept of developing a mid-scale, and eventually a large-scale project, with the best structure and optimization as presently possible (At least for me). Thus, I'm trying to see where to begin, more or less.<br />
<br />
That in mind, am I overcomplicating this, undercomplicating it, or is this accurate? Any tips for the future?</div>

 ]]></content:encoded>
			<category domain="http://www.3dbuzz.com/vbforum/forumdisplay.php?217-C-and-C">C and C++</category>
			<dc:creator>PDI247</dc:creator>
			<guid isPermaLink="true">http://www.3dbuzz.com/vbforum/showthread.php?184667-Choice-Decisions</guid>
		</item>
		<item>
			<title>How do I return value/values when using recursion?</title>
			<link>http://www.3dbuzz.com/vbforum/showthread.php?184651-How-do-I-return-value-values-when-using-recursion&amp;goto=newpost</link>
			<pubDate>Mon, 06 Sep 2010 22:51:56 GMT</pubDate>
			<description><![CDATA[I'm am stuck yet again. What I have here is a multidimensional array containing characters. What I want to do it if a flood fill (http://en.wikipedia.org/wiki/Flood_fill) of it. Canvas is the array, posX and posY are the original position of the letter you chose, old_letter is the letter you picked...]]></description>
			<content:encoded><![CDATA[<div>I'm am stuck yet again. What I have here is a multidimensional array containing characters. What I want to do it if a <a href="http://en.wikipedia.org/wiki/Flood_fill" target="_blank">flood fill</a> of it. Canvas is the array, posX and posY are the original position of the letter you chose, old_letter is the letter you picked and new_letter is what you want it to be turned into. Flag is just whether you wanted a 4 directional or 8 directional floodfile. My confusion is.... what do I return? In the end what I want is the canvas with the old letters turned into two.<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">void floodFill(char canvas[NUM_COLS][NUM_ROWS], int posX, int posY, char old_letter, char new_letter, int flag)<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (!(0 &lt;= posX &amp;&amp; posX &lt; NUM_COLS) || !(0 &lt;= posY &amp;&amp; posY &lt; NUM_ROWS))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //return canvas;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; if (canvas[posX][posY] == new_letter)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  // return canvas;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; canvas[posX][posY] = new_letter;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (flag == 1)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; floodFill(canvas, posX+1, posY, old_letter, new_letter, flag);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; floodFill(canvas, posX-1, posY, old_letter, new_letter, flag);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; floodFill(canvas, posX, posY+1, old_letter, new_letter, flag);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; floodFill(canvas, posX, posY-1, old_letter, new_letter, flag);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; floodFill(canvas, posX+1, posY, old_letter, new_letter, flag);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; floodFill(canvas, posX-1, posY, old_letter, new_letter, flag);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; floodFill(canvas, posX, posY+1, old_letter, new_letter, flag);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; floodFill(canvas, posX, posY-1, old_letter, new_letter, flag);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; floodFill(canvas, posX+1, posY+1, old_letter, new_letter, flag);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; floodFill(canvas, posX+1, posY-1, old_letter, new_letter, flag);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; floodFill(canvas, posX-1, posY+1, old_letter, new_letter, flag);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; floodFill(canvas, posX-1, posY-1, old_letter, new_letter, flag);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } <br />
&nbsp; &nbsp; &nbsp; &nbsp; }&nbsp;  <br />
}</code><hr />
</div> p.s. i know i have the function as void func... but that's temporary.</div>

 ]]></content:encoded>
			<category domain="http://www.3dbuzz.com/vbforum/forumdisplay.php?217-C-and-C">C and C++</category>
			<dc:creator>Rico</dc:creator>
			<guid isPermaLink="true">http://www.3dbuzz.com/vbforum/showthread.php?184651-How-do-I-return-value-values-when-using-recursion</guid>
		</item>
		<item>
			<title>Video Training</title>
			<link>http://www.3dbuzz.com/vbforum/showthread.php?184646-Video-Training&amp;goto=newpost</link>
			<pubDate>Mon, 06 Sep 2010 08:37:10 GMT</pubDate>
			<description>Hi  
 
I am new to 3D Buzz. Firstly your training is awesome!. Secondly if I want to purchase the 3D Buzz training for C++ how do I get your training clipse to my country of South Africa? Once I have purchased them are the available for download or shipping. Streaming is a bit of a problem since my...</description>
			<content:encoded><![CDATA[<div>Hi <br />
<br />
I am new to 3D Buzz. Firstly your training is awesome!. Secondly if I want to purchase the 3D Buzz training for C++ how do I get your training clipse to my country of South Africa? Once I have purchased them are the available for download or shipping. Streaming is a bit of a problem since my internet connection at the moment is a bit unstable.:D</div>

 ]]></content:encoded>
			<category domain="http://www.3dbuzz.com/vbforum/forumdisplay.php?217-C-and-C">C and C++</category>
			<dc:creator>gfxrelay</dc:creator>
			<guid isPermaLink="true">http://www.3dbuzz.com/vbforum/showthread.php?184646-Video-Training</guid>
		</item>
		<item>
			<title>FPS Amusement (OpenGL)</title>
			<link>http://www.3dbuzz.com/vbforum/showthread.php?184643-FPS-Amusement-(OpenGL)&amp;goto=newpost</link>
			<pubDate>Mon, 06 Sep 2010 01:21:37 GMT</pubDate>
			<description><![CDATA[As most of you probably know, in the videos, they end up with 80 FPS... or about, when running their program. 
 
Amusingly, I end up with somewhere in the millions FPS using this function. I'm wondering if I'm doing something wrong ... and it did this before, too; I just didn't let it bother me too...]]></description>
			<content:encoded><![CDATA[<div>As most of you probably know, in the videos, they end up with 80 FPS... or about, when running their program.<br />
<br />
Amusingly, I end up with somewhere in the millions FPS using this function. I'm wondering if I'm doing something wrong ... and it did this before, too; I just didn't let it bother me too much. I just figure it would be nice to 'discover' what it is I'm doing wrong with it.<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">GLvoid Application::DisplayFPS()<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; static long LastTime = SDL_GetTicks();<br />
&nbsp; &nbsp; &nbsp; &nbsp; static long Frames = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; static GLfloat FPS = 0.0f;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int NewTime = SDL_GetTicks();<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (NewTime - LastTime &gt; 100)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; float NewFPS = (float)Frames + float(NewTime - LastTime) * 1000.0f;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FPS = (FPS + NewFPS) / 2.0f;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; char Title[80];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sprintf(Title, &quot;Engine 1.0 - %.1f&quot;, FPS);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SDL_WM_SetCaption(Title, NULL);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; LastTime = NewTime;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Frames = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; Frames++;<br />
}</code><hr />
</div> </div>

 ]]></content:encoded>
			<category domain="http://www.3dbuzz.com/vbforum/forumdisplay.php?217-C-and-C">C and C++</category>
			<dc:creator>PDI247</dc:creator>
			<guid isPermaLink="true">http://www.3dbuzz.com/vbforum/showthread.php?184643-FPS-Amusement-(OpenGL)</guid>
		</item>
		<item>
			<title><![CDATA[Passing an array from an "int main(argc, char*argv[])" function to another.]]></title>
			<link>http://www.3dbuzz.com/vbforum/showthread.php?184630-Passing-an-array-from-an-quot-int-main(argc-char*argv-)-quot-function-to-another.&amp;goto=newpost</link>
			<pubDate>Sat, 04 Sep 2010 19:37:11 GMT</pubDate>
			<description><![CDATA[I'm having a little problem with passing an array to another function. Within the "main(argc, char*argv[])" function, I used an ifstream to pull data from a file and a for-loop to store the list of numbers/characters into a multidimensional array. Now that that array is ready... I don't know what...]]></description>
			<content:encoded><![CDATA[<div>I'm having a little problem with passing an array to another function. Within the &quot;main(argc, char*argv[])&quot; function, I used an ifstream to pull data from a file and a for-loop to store the list of numbers/characters into a multidimensional array. Now that that array is ready... I don't know what to do to make it available to other functions.<br />
<br />
Is there a way to get around this? If it's hard to understand what I'm asking I can send you a copy of my code.</div>

 ]]></content:encoded>
			<category domain="http://www.3dbuzz.com/vbforum/forumdisplay.php?217-C-and-C">C and C++</category>
			<dc:creator>Rico</dc:creator>
			<guid isPermaLink="true">http://www.3dbuzz.com/vbforum/showthread.php?184630-Passing-an-array-from-an-quot-int-main(argc-char*argv-)-quot-function-to-another.</guid>
		</item>
		<item>
			<title>SDL OpenGL Further Functionality Questions</title>
			<link>http://www.3dbuzz.com/vbforum/showthread.php?184615-SDL-OpenGL-Further-Functionality-Questions&amp;goto=newpost</link>
			<pubDate>Fri, 03 Sep 2010 13:53:55 GMT</pubDate>
			<description><![CDATA[-+-+-+- Introduction  -+-+-+- 
 
Naturally, being new to OpenGL causes all kinds of questions ... and a sense of eagerness to learn things, at the same time. Especially after seeing even just some of the functionality 3D environments have to offer. It's been a blast so far, buuuut... I hunger for...]]></description>
			<content:encoded><![CDATA[<div><font size="3">-+-+-+- Introduction  -+-+-+-</font><br />
<br />
Naturally, being new to OpenGL causes all kinds of questions ... and a sense of eagerness to learn things, at the same time. Especially after seeing even just some of the functionality 3D environments have to offer. It's been a blast so far, buuuut... I hunger for more knowledge while I continue to allow the texture issues to marinate!<br />
<br />
So far, I've gotten myself into crazy glitch-like functionality while trying to develop my own little UI structure, and I've learned a bit from it; enough so that I'm actually able to get myself out of most self-induced glitches I've weaseled myself into by this point, without completely destroying code in the process.<br />
<br />
All that aside, I had a few questions about further functionality for SDL / OpenGL... and I know I've been posting quite a bit lately, so I thought the best plan of action would be to post all my questions into one thread.<br />
<br />
<font size="3">-+-+-+- Table of Contents -+-+-+-</font><br />
1. Scrolls for List Boxes<br />
2. List Boxes &lt;= Drop Boxes<br />
3. Mouse Wheel Catcher<br />
4. Control Placement<br />
5. User Input Controls<br />
6. Resolution Adjustments<br />
7. UI Screen Switching<br />
<br />
<font size="3">-+-+-+- Scrolls for List Boxes -+-+-+-</font><br />
<br />
I added a bunch of List Box items to see what would happen. To no real surprise, what ended up happening was that the list options ran down the page, even after the list box stopped. This, of course, means that there is no way to 'scroll' through a long-ish list of options. My question here is, how exactly would one go about adding a scroll-type functionality to list boxes?<br />
<br />
<font size="3">-+-+-+- List Boxes &lt;= Drop Boxes -+-+-+-</font><br />
<br />
Adding to that, I was wondering if, after the scroll functionality was implemented, would it be possible to start using list boxes -as- drop boxes, or would it be best to try to implement drop boxes themselves? If it would be better to implement drop boxes themselves, any suggestions on where to look for information to get a better idea of what I'd need to construct 'em?<br />
<br />
<font size="3">-+-+-+- Mouse Wheel Catcher -+-+-+-</font><br />
<br />
Any suggestions on how to track whether or not the mouse wheel was turned? I notice that in the videos, they take into account the middle mouse -button- ... but I don't believe that includes scrolling.<br />
<br />
<font size="3">-+-+-+- Control Placement -+-+-+-</font><br />
<br />
In one of the videos, it's mentioned that in a normal application, you'd place controls a particular way, instead of just slapping them onto the screen. Which, of course, makes sense... but I'm wondering what the best way to do this would be.<br />
<br />
What I started doing was dividing width by 2 and subtract the width of the control in order to place two controls in the middle of the screen, or divide width by width and add a certain number to get objects to the left side of the screen, or just taking width and subtracting it by the width of the control, minus a little more to space it from the right side ... and the same rules apply to height.<br />
<br />
Is there, as I suspect, a better/more appropriate way to organize controls?<br />
<br />
<font size="3">-+-+-+- User Input Controls -+-+-+-</font><br />
<br />
Back when they were using wxWidgets in the Sprite-Based game, the videos created functionality for the users to supply a width and a height for the level editor. As far as I've seen so far, that's the only form of input control the videos cover; and I'm wondering if there's a place I could learn more about input controls for SDL / OpenGL.<br />
<br />
A couple of examples would be controls to allow number input for RGB values, in the case of allowing users to change the colors of the cube, themselves (Instead of using sliders), or perhaps a window at the bottom of the screen, like a console, more or less, for users to input commands that way.<br />
<br />
The first thing that comes to my mind is that I'd literally have to have the program check to see if a key was pressed, and if it was, it gets written into a control box of some sort. When the user hits enter, it deletes the text from that box and re-draws it into the actual console box. Of course, having the little cursor piece and making it blink would be more or less a tick, flickering alpha on and off.<br />
<br />
But, that's why I'm asking questions, is because I'd like to learn the best way to do things, if possible.<br />
<br />
<font size="3">-+-+-+- Resolution Adjustments -+-+-+-</font><br />
<br />
I started toying with the aspect of resolutions earlier, and realized that when I went from 1024x768 and ran it in full screen, and then changed to 1280x1024, nothing changed on the application screen. I'm not really sure at this point if I actually expected it to change or not; on one side, I expected it to. The sizes of the buttons didn't change with the change of resolution, which would -suggest- that they would automatically be smaller. On that same token, though... custom controls are clearly, thoroughly, under the programmer's control as far as what they do and don't do.<br />
<br />
Anyone have any resources or similar to toss me in the right direction to resize buttons, etc, to fit resolution adjustments?<br />
<br />
<font size="3">-+-+-+- UI Screen Switching  -+-+-+-</font><br />
<br />
I wanted to verify and get a couple of additional opinions from people on this topic... if I recall correctly, they mentioned that, before you draw -anything-, you're supposed to clear the buffers, and then worry about drawing. It makes sense, of course. But, I believe that'd only be upon initial run, and the rest of the time, it would just be re-drawing... but that does cause me a little difficulty in understanding the concept of switching from one UI screen to another, as would be normal in almost any 3D application these days.<br />
<br />
To be perfectly honest, it has me a little puzzled, as far as how it would work. The controls would be completely different on 'page two', and function differently, which is natural in most cases. To me, it sounds like it would be something to create its own class for; but, I've been told before that I get a little overzealous with class-creating. Suggestions?</div>

 ]]></content:encoded>
			<category domain="http://www.3dbuzz.com/vbforum/forumdisplay.php?217-C-and-C">C and C++</category>
			<dc:creator>PDI247</dc:creator>
			<guid isPermaLink="true">http://www.3dbuzz.com/vbforum/showthread.php?184615-SDL-OpenGL-Further-Functionality-Questions</guid>
		</item>
		<item>
			<title>SDL OpenGL Window Functionality</title>
			<link>http://www.3dbuzz.com/vbforum/showthread.php?184612-SDL-OpenGL-Window-Functionality&amp;goto=newpost</link>
			<pubDate>Thu, 02 Sep 2010 22:55:31 GMT</pubDate>
			<description><![CDATA[Ahead of time, I apologize if this is covered in the OpenGL tutorials. 
 
More or less, I'm wondering if anyone has any tips on how exactly to obtain the user's resolution, make the program fullscreen (No title bar, etc; fully covering the screen), and/or changing the mouse appearance, it'd be much...]]></description>
			<content:encoded><![CDATA[<div>Ahead of time, I apologize if this is covered in the OpenGL tutorials.<br />
<br />
More or less, I'm wondering if anyone has any tips on how exactly to obtain the user's resolution, make the program fullscreen (No title bar, etc; fully covering the screen), and/or changing the mouse appearance, it'd be much appreciated.<br />
<br />
I tend to have a 'habit' of testing things in fullscreen mode, since that's how I usually expect it to look. However, my experiences with testing in fullscreen were with Windows API and DirectX. In this case, I'm using SDL and OpenGL; two languages of which are, of course, a very different breed from the first two.<br />
<br />
As far as the mouse appearance goes... well, that would just be a fun thing to play around with, of course.<br />
<br />
Suggestions?</div>

 ]]></content:encoded>
			<category domain="http://www.3dbuzz.com/vbforum/forumdisplay.php?217-C-and-C">C and C++</category>
			<dc:creator>PDI247</dc:creator>
			<guid isPermaLink="true">http://www.3dbuzz.com/vbforum/showthread.php?184612-SDL-OpenGL-Window-Functionality</guid>
		</item>
		<item>
			<title>Organization: Moving functions to different .cpp files (help please)</title>
			<link>http://www.3dbuzz.com/vbforum/showthread.php?184601-Organization-Moving-functions-to-different-.cpp-files-(help-please)&amp;goto=newpost</link>
			<pubDate>Wed, 01 Sep 2010 18:02:37 GMT</pubDate>
			<description><![CDATA[So, I'm building this cool little game as part of a project in school and my professor told me to organize the code better and simplify the functions because the final project grade counts readability. So, I figured I'd just move related functions (like new_game(), save_game(), and load_game()) to...]]></description>
			<content:encoded><![CDATA[<div>So, I'm building this cool little game as part of a project in school and my professor told me to organize the code better and simplify the functions because the final project grade counts readability. So, I figured I'd just move related functions (like new_game(), save_game(), and load_game()) to their own .cpp and header files. I thought when I set function prototypes in a header file, included the header in both main.cpp and the corresponding .cpp file, and moved the functions over to the .cpp file, that it would be the same as setting it in main.cpp. Basically, I thought it was an extension. Instead, I'm getting an error every time I try to call the functions from main.cpp.<br />
<br />
Here's my prototypes:<br />
<br />
void newGame(civStats&amp;);<br />
void loadGame_new(civStats&amp;,vector&lt;Adventurer&gt;&amp;,vector&lt;  Mage&gt;&amp;);<br />
void saveGame_new(civStats&amp;, vector&lt;Adventurer&gt;&amp;, vector&lt;Mage&gt;&amp;);<br />
<br />
civStats is a struct. Adventurer is a class. Mage is an inherited class of Adventurer. I store class objects in a vector and pass them by reference to different functions for (fstream) saving and loading purposes. Everything works fine in main.cpp.<br />
<br />
However, when I move those prototypes to NewSaveLoad.h and move the functions to NewSaveLoad.cpp, I get the following error when I try to call them from main:<br />
<br />
&quot;expression must have (pointer-to-) function type&quot;<br />
<br />
Any ideas?</div>

 ]]></content:encoded>
			<category domain="http://www.3dbuzz.com/vbforum/forumdisplay.php?217-C-and-C">C and C++</category>
			<dc:creator>bustaballs</dc:creator>
			<guid isPermaLink="true">http://www.3dbuzz.com/vbforum/showthread.php?184601-Organization-Moving-functions-to-different-.cpp-files-(help-please)</guid>
		</item>
		<item>
			<title>OpenGL Text Issue</title>
			<link>http://www.3dbuzz.com/vbforum/showthread.php?184593-OpenGL-Text-Issue&amp;goto=newpost</link>
			<pubDate>Wed, 01 Sep 2010 02:42:03 GMT</pubDate>
			<description><![CDATA[Anyone happen to know what site and/or exact bitmap was used in the VTM for OpenGL's Adding Text functionality? 
 
Regardless of what I try to do to the bitmap I can create using this site's program: 
http://www.lmnopc.com/bitmapfontbuilder/ 
 
or a couple of others, I can't seem to get the program...]]></description>
			<content:encoded><![CDATA[<div>Anyone happen to know what site and/or exact bitmap was used in the VTM for OpenGL's Adding Text functionality?<br />
<br />
Regardless of what I try to do to the bitmap I can create using this site's program:<br />
<a href="http://www.lmnopc.com/bitmapfontbuilder/" target="_blank">http://www.lmnopc.com/bitmapfontbuilder/</a><br />
<br />
or a couple of others, I can't seem to get the program to work. Yes, the image is 250x250, and there are 16 characters on each row, and there are 16 columns.<br />
<br />
The result generates white and gray squares. And I've tried moving the image around to different folders inside the solution folders. Nothing changes.<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">GLvoid GLEngine::Initialize(GLint width, GLint height)<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; Light::Initialize();<br />
&nbsp; &nbsp; &nbsp; &nbsp; FontTexture = new Texture(&quot;data/font.tga&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; BuildTextureFont();<br />
}</code><hr />
</div> <div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">GLvoid GLEngine::BuildTextureFont(GLvoid)<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; FontBase = glGenLists(256);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; glBindTexture(GL_TEXTURE_2D, FontTexture-&gt;TexID);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; glEnable(GL_BLEND);<br />
&nbsp; &nbsp; &nbsp; &nbsp; glBlendFunc(GL_SRC_ALPHA, GL_ONE);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; for (int i = 0; i &lt; 256; i++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; float cx = (float)(i % 16) / 16.0f;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; float cy = (float)(i / 16) / 16.0f;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; glNewList(FontBase + i, GL_COMPILE);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; glBegin(GL_QUADS);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; glTexCoord2f(cx,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 1 - cy - 0.0625f);&nbsp; &nbsp; &nbsp; &nbsp; glVertex2i(0, FontSize);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; glTexCoord2f(cx + 0.0625f,&nbsp; &nbsp; &nbsp; &nbsp; 1 - cy - 0.0625f);&nbsp; &nbsp; &nbsp; &nbsp; glVertex2i(FontSize, FontSize);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; glTexCoord2f(cx + 0.0625f,&nbsp; &nbsp; &nbsp; &nbsp; 1 - cy);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; glVertex2i(FontSize, 0);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; glTexCoord2f(cx,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 1 - cy);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; glVertex2i(0, 0);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; glEnd();<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; glTranslated(FontSpace, 0, 0);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; glEndList();<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
}</code><hr />
</div> <div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">GLvoid GLEngine::DrawText(GLint x, GLint y, const char *text, ...)<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; char Text[256];<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; va_list ap;<br />
&nbsp; &nbsp; &nbsp; &nbsp; va_start(ap, text);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; vsprintf_s(Text, text, ap);<br />
&nbsp; &nbsp; &nbsp; &nbsp; va_end(ap);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; glEnable(GL_TEXTURE_2D);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; glEnable(GL_BLEND);<br />
&nbsp; &nbsp; &nbsp; &nbsp; glBlendFunc(GL_SRC_ALPHA, GL_ONE);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; glBindTexture(GL_TEXTURE_2D, FontTexture-&gt;TexID);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; glMatrixMode(GL_MODELVIEW);<br />
&nbsp; &nbsp; &nbsp; &nbsp; glPushMatrix();<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; glLoadIdentity();<br />
&nbsp; &nbsp; &nbsp; &nbsp; glTranslatef((float)x, (float)y, 0);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; glListBase(FontBase - 32);<br />
&nbsp; &nbsp; &nbsp; &nbsp; glCallLists((GLsizei)strlen(Text), GL_BYTE, Text);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; glMatrixMode(GL_MODELVIEW);<br />
&nbsp; &nbsp; &nbsp; &nbsp; glPopMatrix();<br />
}</code><hr />
</div> <div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">GLvoid GLEngine::SetOrtho(GLsizei width, GLsizei height)<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; glViewport(0, 0, width, height);<br />
&nbsp; &nbsp; &nbsp; &nbsp; glMatrixMode(GL_PROJECTION);<br />
&nbsp; &nbsp; &nbsp; &nbsp; glLoadIdentity();<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; gluOrtho2D(0, width, height, 0);<br />
}</code><hr />
</div> Global variables to sum it up:<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">const int FontSize = 10;<br />
const int FontSpace = 7;</code><hr />
</div> </div>

 ]]></content:encoded>
			<category domain="http://www.3dbuzz.com/vbforum/forumdisplay.php?217-C-and-C">C and C++</category>
			<dc:creator>PDI247</dc:creator>
			<guid isPermaLink="true">http://www.3dbuzz.com/vbforum/showthread.php?184593-OpenGL-Text-Issue</guid>
		</item>
		<item>
			<title>OpenGL Linker Error</title>
			<link>http://www.3dbuzz.com/vbforum/showthread.php?184583-OpenGL-Linker-Error&amp;goto=newpost</link>
			<pubDate>Tue, 31 Aug 2010 16:23:12 GMT</pubDate>
			<description><![CDATA[The .tga Texture importer, I seem to be having difficulty with. 
 
 
Code: 
--------- 
#include "texture.h" 
 
vector <Texture *> Texture::Textures; 
 
Texture::Texture(string filename, string name)]]></description>
			<content:encoded><![CDATA[<div>The .tga Texture importer, I seem to be having difficulty with.<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">#include &quot;texture.h&quot;<br />
<br />
vector &lt;Texture *&gt; Texture::Textures;<br />
<br />
Texture::Texture(string filename, string name)<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; Textures.push_back(this); // Generates Linker Error<br />
}<br />
<br />
Texture::~Texture()<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; for (vector &lt;Texture *&gt;::iterator it = Textures.begin(); it != Textures.end(); it++) // Generates Linker Error<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ((*it) == this)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Textures.erase(it);<br />
}</code><hr />
</div> Pretty much, everything, as far as I can tell in my comparison between my version, and the video version, is correct... and supposed to work properly. However, when I comment both of those lines out, I can build it just fine; if I invoke either of them, I get the linker error.<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">Error&nbsp; &nbsp; &nbsp; &nbsp; 1&nbsp; &nbsp; &nbsp; &nbsp; error LNK2001: unresolved external symbol __imp___CrtDbgReportW&nbsp; &nbsp; &nbsp; &nbsp; texture.obj</code><hr />
</div> Here's some of the class structure:<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">#ifndef TEXTURE_H<br />
#define TEXTURE_H<br />
<br />
#include &lt;windows.h&gt;<br />
#include &lt;GL/gl.h&gt;<br />
#include &lt;GL/glu.h&gt;<br />
#include &lt;string&gt;<br />
#include &lt;vector&gt;<br />
#include &lt;fstream&gt;<br />
<br />
using std::string;<br />
using std::vector;<br />
using std::ifstream;<br />
<br />
class Texture<br />
{<br />
public:<br />
&nbsp; &nbsp; &nbsp; &nbsp; Texture(string filename, string name = &quot;&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; ~Texture();<br />
<br />
public:<br />
&nbsp; &nbsp; &nbsp; &nbsp; static vector &lt;Texture *&gt; Textures;<br />
};</code><hr />
</div> Throughout this post, I've pretty much just eliminated anything and everything except what seems to be the main problem and the header files, to show they're there.</div>

 ]]></content:encoded>
			<category domain="http://www.3dbuzz.com/vbforum/forumdisplay.php?217-C-and-C">C and C++</category>
			<dc:creator>PDI247</dc:creator>
			<guid isPermaLink="true">http://www.3dbuzz.com/vbforum/showthread.php?184583-OpenGL-Linker-Error</guid>
		</item>
		<item>
			<title>Intro to game dev tutorial help</title>
			<link>http://www.3dbuzz.com/vbforum/showthread.php?184574-Intro-to-game-dev-tutorial-help&amp;goto=newpost</link>
			<pubDate>Mon, 30 Aug 2010 19:55:07 GMT</pubDate>
			<description><![CDATA[I have been following the intro to game dev video tutorials as supplied by this website, but for some reason I have 12 similar errors that I just can't figure out. 
 
Error	1	error C2548: 'Sprite::Sprite' : missing default parameter for parameter 6	 
Error	2	error C2548: 'Sprite::Sprite' : missing...]]></description>
			<content:encoded><![CDATA[<div>I have been following the intro to game dev video tutorials as supplied by this website, but for some reason I have 12 similar errors that I just can't figure out.<br />
<br />
Error	1	error C2548: 'Sprite::Sprite' : missing default parameter for parameter 6	<br />
Error	2	error C2548: 'Sprite::Sprite' : missing default parameter for parameter 6<br />
Error	3	error C2548: 'Character::Character' : missing default parameter for parameter 10	<br />
Error	4	error C2548: 'Sprite::Sprite' : missing default parameter for parameter 6<br />
Error	5	error C2548: 'Character::Character' : missing default parameter for parameter 10<br />
Error	6	error C2548: 'Sprite::Sprite' : missing default parameter for parameter 6	<br />
Error	7	error C2548: 'Character::Character' : missing default parameter for parameter 10	<br />
Error	8	error C2661: 'Character::Character' : no overloaded function takes 3 arguments<br />
Error	9	error C2548: 'Sprite::Sprite' : missing default parameter for parameter 6	<br />
Error	10	error C2548: 'Character::Character' : missing default parameter for parameter 10<br />
	11	IntelliSense: default argument not at end of parameter list	<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">#ifndef SPRITE_H<br />
#define SPRITE_H<br />
<br />
#include &quot;DrawEngine.h&quot;<br />
#include &quot;Level.h&quot;<br />
<br />
// An enum allows to create an ID for classes sequentually (0, 1, 2).<br />
enum<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; SPRITE_CLASSID,<br />
&nbsp; &nbsp; &nbsp; &nbsp; CHARACTER_CLASSID,<br />
};<br />
<br />
// No point making a class for this as it's only holding 2 variables.<br />
struct vector<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; float x, y;<br />
};<br />
<br />
class Sprite<br />
{<br />
public:<br />
&nbsp; &nbsp; &nbsp; &nbsp; Sprite(DrawEngine *drawEngine, int s_index, float x = 1, float y = 1, int lives = 1, Level *l); // &lt;--- error underlines the &quot;1&quot; assigned with float x.<br />
&nbsp; &nbsp; &nbsp; &nbsp; ~Sprite();<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; vector getPosition();<br />
&nbsp; &nbsp; &nbsp; &nbsp; float getX();<br />
&nbsp; &nbsp; &nbsp; &nbsp; float getY();<br />
&nbsp; &nbsp; &nbsp; &nbsp; // This is for my enum as previously said, it returns a number as a class ID;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int classID;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; // Virtual allows any derived class the power to overide a base function.<br />
&nbsp; &nbsp; &nbsp; &nbsp; virtual void addLives(int num = 1);<br />
&nbsp; &nbsp; &nbsp; &nbsp; int getLives();<br />
&nbsp; &nbsp; &nbsp; &nbsp; bool isAlive();<br />
&nbsp; &nbsp; &nbsp; &nbsp; // This returns a bool to say whether the sprite has moved or not.<br />
&nbsp; &nbsp; &nbsp; &nbsp; virtual bool move(float x, float y);<br />
<br />
protected:<br />
&nbsp; &nbsp; &nbsp; &nbsp; // I need a pointer to the drawengine as it will always be living in the game class.<br />
&nbsp; &nbsp; &nbsp; &nbsp; DrawEngine *drawArea;<br />
&nbsp; &nbsp; &nbsp; &nbsp; vector pos;&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; vector facingDirection;<br />
&nbsp; &nbsp; &nbsp; &nbsp; Level *level;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int numLives;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int spriteIndex;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; void draw(float x, float y);<br />
&nbsp; &nbsp; &nbsp; &nbsp; void erase(float x, float y);<br />
&nbsp; &nbsp; &nbsp; &nbsp; bool isValidLevelMove(int xpos, int ypos);<br />
};<br />
#endif</code><hr />
</div> Here is the function in the .cpp file<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">#include &quot;Sprite.h&quot;<br />
<br />
Sprite::Sprite(DrawEngine *drawEngine, int s_index, float x, float y, int lives, Level *l)<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; // Assigned a pointer to a pointer.<br />
&nbsp; &nbsp; &nbsp; &nbsp; drawArea = drawEngine;<br />
&nbsp; &nbsp; &nbsp; &nbsp; pos.x = x;<br />
&nbsp; &nbsp; &nbsp; &nbsp; pos.y = y;<br />
&nbsp; &nbsp; &nbsp; &nbsp; spriteIndex = s_index;<br />
&nbsp; &nbsp; &nbsp; &nbsp; numLives = lives;<br />
&nbsp; &nbsp; &nbsp; &nbsp; classID = SPRITE_CLASSID;<br />
&nbsp; &nbsp; &nbsp; &nbsp; // This means it starts out looking to the right.<br />
&nbsp; &nbsp; &nbsp; &nbsp; facingDirection.x = 1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; // This means it is NOT looking up.<br />
&nbsp; &nbsp; &nbsp; &nbsp; facingDirection.y = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; level = l;<br />
}</code><hr />
</div> I'm not sure what to do, the same thing happens in the character class.<br />
<br />
Thanks for any help.</div>

 ]]></content:encoded>
			<category domain="http://www.3dbuzz.com/vbforum/forumdisplay.php?217-C-and-C">C and C++</category>
			<dc:creator>CharlieGrimes</dc:creator>
			<guid isPermaLink="true">http://www.3dbuzz.com/vbforum/showthread.php?184574-Intro-to-game-dev-tutorial-help</guid>
		</item>
		<item>
			<title>Array Input C Code</title>
			<link>http://www.3dbuzz.com/vbforum/showthread.php?184573-Array-Input-C-Code&amp;goto=newpost</link>
			<pubDate>Mon, 30 Aug 2010 19:23:50 GMT</pubDate>
			<description><![CDATA[I'm currently working on a C code program for my research, which involves formation flying of spacecraft. All of my input comes from a text file and I'm trying to clean it up a little. I have to input adjacency matrix for all the spacecraft. AKA I need to input and store NxN matrix, where N in the...]]></description>
			<content:encoded><![CDATA[<div>I'm currently working on a C code program for my research, which involves formation flying of spacecraft. All of my input comes from a text file and I'm trying to clean it up a little. I have to input adjacency matrix for all the spacecraft. AKA I need to input and store NxN matrix, where N in the number of spacecraft.<br />
<br />
Ex: N = 2<br />
Matrix = <br />
0 1<br />
1  0<br />
<br />
Ex: N = 3<br />
Matrix =<br />
0 1 1<br />
1  0 1<br />
1  0 1<br />
<br />
Currently I just have to list all the matrix components on a separate line (N=2 means the matrix is on 4 lines of the text file) and this is not very intuitive for larger numbers of spacecraft. <br />
<br />
Is there a way to use sscanf dynamically to read in N number of integers on a line?<br />
<br />
So for N = 2 or 3 it would do the equivalent of these<br />
<br />
N = 2<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">sscanf(line, &quot;%d %d&quot;, array[0][0], array[0][1])<br />
sscanf(nextLine, &quot;%d %d&quot;, array[1][0], array[1][1])</code><hr />
</div> N = 3<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">sscanf(firstLine, &quot;%d %d %d&quot;, array[0][0], array[0][1], array[0][2])<br />
sscanf(seondLine, &quot;%d %d %d&quot;, array[1][0], array[1][1], array[1][2])<br />
sscanf(thirdLine, &quot;%d %d %d&quot;, array[2][0], array[2][1], array[2][2])</code><hr />
</div> Any help is appreciated, Thanks.</div>

 ]]></content:encoded>
			<category domain="http://www.3dbuzz.com/vbforum/forumdisplay.php?217-C-and-C">C and C++</category>
			<dc:creator>popes</dc:creator>
			<guid isPermaLink="true">http://www.3dbuzz.com/vbforum/showthread.php?184573-Array-Input-C-Code</guid>
		</item>
		<item>
			<title>Beginner question: How do I test for overflow?</title>
			<link>http://www.3dbuzz.com/vbforum/showthread.php?184571-Beginner-question-How-do-I-test-for-overflow&amp;goto=newpost</link>
			<pubDate>Mon, 30 Aug 2010 19:17:59 GMT</pubDate>
			<description>I have started another thread  (http://www.3dbuzz.com/vbforum/showthread.php?184534-Beginner-with-array-and-loop-issues)and and building n the code. 
 
I need to test for overflow and I think I have the code right. What I want to do is convert a base 10 number to 16 and check for overflow. I check...</description>
			<content:encoded><![CDATA[<div>I have started another <a href="http://www.3dbuzz.com/vbforum/showthread.php?184534-Beginner-with-array-and-loop-issues" target="_blank">thread </a>and and building n the code.<br />
<br />
I need to test for overflow and I think I have the code right. What I want to do is convert a base 10 number to 16 and check for overflow. I check by add the first two hex numbers together and if the result is greater than 15 then overflow occurs.<br />
<br />
The thing is... how do I check if this works? Might be kind f a dumb question but how does this work? (i.e. what number can i input into my program to test the function)</div>

 ]]></content:encoded>
			<category domain="http://www.3dbuzz.com/vbforum/forumdisplay.php?217-C-and-C">C and C++</category>
			<dc:creator>Rico</dc:creator>
			<guid isPermaLink="true">http://www.3dbuzz.com/vbforum/showthread.php?184571-Beginner-question-How-do-I-test-for-overflow</guid>
		</item>
	</channel>
</rss>
