So Valve removed their v0001 interface for authentication? Is it not possible to do any cool stuff with the API now; like sending messages through steam? Or is there an alternative?
I got partway through writing a python API before realizing they had changed it.
Probably late.
I have a question, when making a 2D game you have to create a texture which will be the character.
XNA: When the character will just it will change the texture?(I say yes but I am not sure)
If in the game there are multiple weapons, there should a texture with the character holding the gun or how is that made ?
Been writing a Java parser that creates an XML file out of a SQL File. Everything works, just the created XML is only one gigantic line and this is bothering the fuck out of me.
The XML itself is valid, but the lack of line breaks makes it hard to read.
To write the XML file I used the DOM parser, as described [URL="http://www.mkyong.com/java/how-to-create-xml-file-in-java-dom/"][U]here[/U][/URL].
Anyone knows how to add at least line breaks to the file for easier reading?
Throw a few [B]System.lineSeparator()[/B] in your stream.
[QUOTE=BoowmanTech;43656697]I have a question, when making a 2D game you have to create a texture which will be the character.
XNA: When the character will just it will change the texture?(I say yes but I am not sure)
If in the game there are multiple weapons, there should a texture with the character holding the gun or how is that made ?[/QUOTE]
Make a second texture for the gun and draw that on top of the player?
I've got this code in C++:
[CODE]BOOL b = CopyFile("C:\\file.txt","C:\\intel\\file.txt",0);[/CODE]
Question is, how do I replace the first file.txt with a string? so for example, the program would ask me for the source file, put it into the copyfile function then copy it?
Like
[CODE]BOOL b = CopyFile("C:\\"main,"C:\\intel\\file.txt",0);[/CODE]
"main" being the variable or string?
[code]CopyFile(yourString, "C:\\intel\\file.txt",0);[/code]
[editline]25th January 2014[/editline]
In case you want to always prepend C:\ into the string,[code]CopyFile(std::string("C:\\") + yourString, "C:\\intel\\file.txt",0);[/code]
[editline]25th January 2014[/editline]
And if that doesn't work because it refuses to implicitly convert to char *, [code]CopyFile((std::string("C:\\") + yourString).c_str(), "C:\\intel\\file.txt",0);[/code]
[editline]25th January 2014[/editline]
It's been a while since I did anything with std::string
[QUOTE=esalaka;43664084][code]CopyFile(yourString, "C:\\intel\\file.txt",0);[/code]
[editline]25th January 2014[/editline]
In case you want to always prepend C:\ into the string,[code]CopyFile(std::string("C:\\") + yourString, "C:\\intel\\file.txt",0);[/code]
If I put the string straight int
[editline]25th January 2014[/editline]
And if that doesn't work because it refuses to implicitly convert to char *, [code]CopyFile((std::string("C:\\") + yourString).c_str(), "C:\\intel\\file.txt",0);[/code]
[editline]25th January 2014[/editline]
It's been a while since I did anything with std::string[/QUOTE]
If I put the string into the copyfile functions I get:
[CODE]D:\Elliott\Documents\Programming\C++\win32copy\main.cpp|14|error: cannot convert 'std::string {aka std::basic_string<char>}' to 'LPCSTR {aka const char*}' for argument '1' to 'BOOL CopyFileA(LPCSTR, LPCSTR, BOOL)'|[/CODE]
?
[QUOTE=smidge146;43664152]If I put the string into the copyfile functions I get:
[CODE]D:\Elliott\Documents\Programming\C++\win32copy\main.cpp|14|error: cannot convert 'std::string {aka std::basic_string<char>}' to 'LPCSTR {aka const char*}' for argument '1' to 'BOOL CopyFileA(LPCSTR, LPCSTR, BOOL)'|[/CODE]
?[/QUOTE]
That means "it refuses to implicitly convert to char *", so call .c_str() on the string.
[QUOTE=esalaka;43664084]And if that doesn't work because it refuses to implicitly convert to char *, [code]CopyFile((std::string("C:\\") + yourString).c_str(), "C:\\intel\\file.txt",0);[/code][/QUOTE]
[QUOTE=Z_guy;43664179]That means "it refuses to implicitly convert to char *", so call .c_str() on the string.[/QUOTE]
Ok I have no changed my code to:
[CODE]BOOL b = CopyFile((location).c_str(),(destination).c_str(),0);[/CODE]
Is that correct?
[QUOTE=smidge146;43664197]Ok I have no changed my code to:
[CODE]BOOL b = CopyFile((location).c_str(),(destination).c_str(),0);[/CODE]
Is that correct?[/QUOTE]
As far as I can tell, yes.
[QUOTE=smidge146;43664197]Ok I have no changed my code to:
[CODE]BOOL b = CopyFile((location).c_str(),(destination).c_str(),0);[/CODE]
Is that correct?[/QUOTE]
No need for the brackets around location and destination, though.
location.c_str() is enough
New to using Visual C# (and [b]still[/b] a novice to C#/C++), so apologies if I sound [b]completely[/b] dumb.
[img]http://puu.sh/6xByH.jpg[/img]
How exactly would I code the Health to have a formula with the inputted numbers? (The formula would be 150 + (19 * (STR + (STR Gain * Level))) ) Having it rounded to the nearest numbers would also be nice!
In the input events for the boxes (you should be taken to it if you double click on them), you can do something along the lines of:
healthtext.string = Math.round(150 + (19 * (STR + (STR Gain * Level)))).ToString()
Apologies if that's a bit vague, haven't used it in a while.
Here is something a bit more detailed. I haven't used C# in a while either so fix the naming.
[code]
textbox1.TextChanged += UpdateLabel(); //May have a type with args, ether use that or just be lazy like me and wrap it with a lambda.
textbox2.TextChanged += (args) => { UpdateLabel(); }
textbox3 ...
private void UpdateLabel()
{
//Handle these for empty textboxes and non-numeric characters.
int str = textbox1.Text.ToString()
int strGain ..
int level ..
label5.Text = 150 + (19 * (str + (strGain * level.text))).ToString()
}
[/code]
[editline]26th January 2014[/editline]
Ahh too much python, put the top part in the form load or something and add semicolons.
[QUOTE=chaz13;43665995]In the input events for the boxes (you should be taken to it if you double click on them), you can do something along the lines of:
healthtext.string = Math.round(150 + (19 * (STR + (STR Gain * Level)))).ToString()
Apologies if that's a bit vague, haven't used it in a while.[/QUOTE]
[QUOTE=reevezy67;43666054]Here is something a bit more detailed. I haven't used C# in a while either so fix the naming.
[code]
textbox1.TextChanged += UpdateLabel(); //May have a type with args, ether use that or just be lazy like me and wrap it with a lambda.
textbox2.TextChanged += (args) => { UpdateLabel(); }
textbox3 ...
private void UpdateLabel()
{
//Handle these for empty textboxes and non-numeric characters.
int str = textbox1.Text.ToString()
int strGain ..
int level ..
label5.Text = 150 + (19 * (str + (strGain * level.text))).ToString()
}
[/code]
[editline]26th January 2014[/editline]
Ahh too much python, put the top part in the form load or something and add semicolons.[/QUOTE]
Both do seem a tiny bit vague (no offense!), so I'll just post what the code looks like:
[code]using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void textSTR_Click(object sender, EventArgs e)
{
}
private void textSTRGain_Click(object sender, EventArgs e)
{
}
private void textLevel_Click(object sender, EventArgs e)
{
}
private void textHealth_Click(object sender, EventArgs e)
{
}
private void inputSTR_TextChanged(object sender, EventArgs e)
{
}
private void inputSTRGain_TextChanged(object sender, EventArgs e)
{
}
private void inputLevel_TextChanged(object sender, EventArgs e)
{
}
private void outputHealth_Click(object sender, EventArgs e)
{
}
}
}[/code]
Going by reevezy67's sample (and again, more stupid things blabbing from my mouth):
1) Not sure where I should be placing those TextChanged lines (in public Form1?)!
2) When simply trying to add the void UpdateLabel code, it says it can't implicitly convert type 'string' to 'int', and "'int' does not contain a definition for 'text' and no extension method 'text' accepting a first argument of type 'int' could be found (are you missing a using directive or an assembly reference?)". Unless those first three lines you showed are what fixes the problem?
3) Forgot about the semicolons! Too much Python indeed, but I don't know anything about that language, so... :v:
If more snippets of code is needed for reference, let me know! And I do appreciate both of you for wanting to help.
If you're using Visual Studio and it generated those voids for you then you don't have to add anything.
Just call the update void inside the TextChanged voids, which could be something like:
[code]
void Update()
{
float STR = float.parse(textSTR.text);
float STRGain = float.parse(textSTRGain.text);
float level = float.parse(textlevel.text);
textHealth.text = Math.Round((150 + (19 * (STR + (STRGain * level))))).ToString();
}
[/code]
Edit: Should probably use float.TryParse
I think with tryParse it could be something like
[code]
void Update()
{
float STR = 0;
float STRGain = 0;
float level = 0;
float.TryParse(out STR, textSTR.text);
float.TryParse(out STRGain, textSTRGain.text);
float.TryParse(out level, textLevel.text);
textHealth.text = Math.Round((150 + (19 * (STR + (STRGain * level))))).ToString();
}
[/code]
[QUOTE=Hattiwatti;43666515]If you're using Visual Studio and it generated those voids for you then you don't have to add anything.
Just call the update void inside the TextChanged voids, which could be something like:
[code]
void Update()
{
float STR = float.parse(textSTR.text);
float STRGain = float.parse(textSTRGain.text);
float level = float.parse(textlevel.text);
textHealth.text = Math.Round((150 + (19 * (STR + (STRGain * level))))).ToString();
}
[/code]
Edit: Should probably use float.TryParse
I think with tryParse it could be something like
[code]
void Update()
{
float STR = 0;
float STRGain = 0;
float level = 0;
float.TryParse(out STR, textSTR.text);
float.TryParse(out STRGain, textSTRGain.text);
float.TryParse(out level, textLevel.text);
textHealth.text = Math.Round((150 + (19 * (STR + (STRGain * level))))).ToString();
}
[/code][/QUOTE]
Again, another dumb question, how do I call the update void?
Also, on the last four lines: 'System.Windows.Forms.Label' does not contain a definition for 'text' and no extension method 'text' accepting a first argument of type 'System.Windows.Forms.Label' could be found (are you missing a using directive or an assembly reference?)
(I assume calling the void fixes that problem)
For example:
[code]
private void inputSTR_TextChanged(object sender, EventArgs e)
{
Update();
}
[/code]
Oh yeah labels.
Then it would be textSomething.Content.ToString() I believe.
[editline]25th January 2014[/editline]
Ohh shit wait a minute my bad.
float.TryParse(out STR, inputSTR.text);
float.TryParse(out STRGain, inputSTRGain.text);
float.TryParse(out level, inputLevel.text);
You're not taking the values from labels ofc.
You could also change the void Update() to private void Update(object sender, TextChangedEventArgs e) and then go to the event list and change TextChanged to "Update", so you don't have all those different _textChanged functions making the code longer.
[QUOTE=Hattiwatti;43666805]For example:
[code]
private void inputSTR_TextChanged(object sender, EventArgs e)
{
Update();
}
[/code]
Oh yeah labels.
Then it would be textSomething.Content.ToString() I believe.
[editline]25th January 2014[/editline]
Ohh shit wait a minute my bad.
float.TryParse(out STR, inputSTR.text);
float.TryParse(out STRGain, inputSTRGain.text);
float.TryParse(out level, inputLevel.text);
You're not taking the values from labels ofc.
You could also change the void Update() to private void Update(object sender, TextChangedEventArgs e) and then go to the event list and change TextChanged to "Update", so you don't have all those different _textChanged functions making the code longer.[/QUOTE]
That's the only bit of code I need to call? Well that was a lot simpler than I thought, I figured it'd be something like "call Update();" or "Update.str;"... :v:
Decided to try the Content.ToString() method, but then comes a similar problem: 'System.Windows.Forms.TextBox' does not contain a definition for 'Content' and no extension method 'Content' accepting a first argument of type 'System.Windows.Forms.TextBox' could be found (are you missing a using directive or an assembly reference?)
This is how it looks right now:
[code]using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void textSTR_Click(object sender, EventArgs e)
{
}
private void textSTRGain_Click(object sender, EventArgs e)
{
}
private void textLevel_Click(object sender, EventArgs e)
{
}
private void textHealth_Click(object sender, EventArgs e)
{
}
private void inputSTR_TextChanged(object sender, EventArgs e)
{
Update();
}
private void inputSTRGain_TextChanged(object sender, EventArgs e)
{
Update();
}
private void inputLevel_TextChanged(object sender, EventArgs e)
{
Update();
}
private void outputHealth_Click(object sender, EventArgs e)
{
Update();
}
void Update()
{
float str = 0;
float strGain = 0;
float level = 0;
float.TryParse(out str, inputSTR.Content.ToString());
float.TryParse(out strGain, inputSTRGain.Content.ToString());
float.TryParse(out level, inputLevel.Content.ToString());
outputHealth.Content.ToString() = Math.Round((150 + (19 * (str + (strGain * level))))).ToString();
}
}
}[/code]
As I fixed, Content.ToString() is for labels, use .Text for text boxes.
[QUOTE=Hattiwatti;43667105]As I fixed, Content.ToString() is for labels, use .Text for text boxes.[/QUOTE]
Seems logical!
Then this happened:
[img]http://puu.sh/6xL0T.png[/img]
For all of the inputs.
[code] void Update()
{
float str = 0;
float strGain = 0;
float level = 0;
float.TryParse(out str, inputSTR.Text);
float.TryParse(out strGain, inputSTRGain.Text);
float.TryParse(out level, inputLevel.Text);
outputHealth.Content.ToString() = Math.Round((150 + (19 * (str + (strGain * level))))).ToString();
}[/code]
If you read the first error then you see what is wrong.
(inputSTR.Text, out str), not (out str, inputSTR.Text).
[QUOTE=Hattiwatti;43667443]If you read the first error then you see what is wrong.
(inputSTR.Text, out str), not (out str, inputSTR.Text).[/QUOTE]
Ah, apologies for that.
Also, it seems that Content.ToString shouldn't be used for outputHealth, rather it should be the same .Text as with the inputs, so now there aren't errors!
[img]http://puu.sh/6xNIw.jpg[/img]
[b][i]AND BY GOD'S NAME, IT WORKS[/i][/b]
(Except I had to change the formula slightly by subtracting one from the Level)
You're a life-saver, Hatt. <3 Sorry that you had to suffer through my stupidity!
(And thanks to the other two people who tried to help!)
[QUOTE=nos217;43607530]How is your cube stored? A list of points?[/QUOTE]
Never mind, I solved that one. Here's another question for you guys. I'm sure this one is even easier, but I can't figure it out. Let's say I have two lines:
[cpp]
struct Line {
vec3 point;
vec3 direction;
};
[/cpp]
"point" is simply a point on the line. Anyway, I want to find out the combination of one point from one line and one from the other which gives me the smallest distance between the points. Note that I explicitly want to know the points, I don't even care about the distance.
[editline]25th January 2014[/editline]
[QUOTE=Richy19;43623895]Does anyone know how I could check if a cube is colliding (inside of, intersect or contains) with a flat quad?
I know how to check if the quad is completelly inside the cube or if any of the quads corners is inside it but im not sure how to check for a situation like:
[IMG]http://i.imgur.com/d6WNERm.png[/IMG]
Where its intersecting, yet as none of the corners are inside I cant check against them[/QUOTE]
Use [URL=http://en.wikipedia.org/wiki/Hyperplane_separation_theorem]separating axis theorem[/URL]. [URL=http://gamedev.stackexchange.com/questions/44500/how-many-and-which-axes-to-use-for-3d-obb-collision-with-sat]Since you're in 3D, you need to check all the cross products of edges too.[/URL]
snip, got it
-snip-
[QUOTE=reevezy67;43650989]So Valve removed their v0001 interface for authentication? Is it not possible to do any cool stuff with the API now; like sending messages through steam? Or is there an alternative?
I got partway through writing a python API before realizing they had changed it.
Probably late.[/QUOTE]
do you mean in steamworks? because if you do, i don't understand what you mean, i'm sending messages just fine with my auto-reply thingy. or i could just be misunderstanding what you mean (i'm not sure what v0001 is, so)
It's not as much a direct coding problem, as much as a question for people here who might be more familiar with 3D engines.
I'm looking for a C++ 3D engine/library that supports some form of lighting (externally baked lightmaps/vertex lighting), has robust physics built in, and has developer tools. The project I need it for is non-commercial, and the game produced will not be released.
[QUOTE=bootv2;43676479]This week I decided to completely rewrite my game, since the code was quite shitty and unelegant.
I started working with pointers a lot in my rewrite, and somehow this statement: PlayerPaddleHandler* playerPaddle; causes visual studio to give me this error: [code]Error 3 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\users\tim\documents\visual studio 2013\projects\markanoid\markanoid\Engine.h 9[/code]
I have included the class, and put #pragma once on the first line of all headers.
The weird thing is, this happens with all classes, and it doesnt matter wether I declare the object as a pointer, or just an object.
ideas?[/QUOTE]
Can you show some more code? There must be something else going on causing this.
Sorry, you need to Log In to post a reply to this thread.