If you "know" C++ (which you don't, but that's a different story), then picking up Java should be extremely easy.
I need help making a trainer for Vice City that works with Steam. I've been told to just replace the exe but that fucks stuff up for me. I've been playing with memory addresses all day using various programs and cant get anything to work
Help would be nice
By know, I mean know the basics. Not like particularly good knowledge like your high and mighty self. By annoying capitalization mean crap like the declarer for a string being String, instead of just string, and System.out.println having the capital S, little annoying things such as that. C++ is case sensitive, yes, but commands are in lower case. I guess saying case sensitive was a poor phrasing, I mean just having crap that requires capitalization.
Still didn't answer my question. java or C# being the better choice?
[QUOTE=redonkulous;21258388]By know, I mean know the basics. Not like particularly good knowledge like your high and mighty self.[/quote]
I don't know many things myself. I learn new trivia every time I use C++.
[quote]By annoying capitalization mean crap like the declarer for a string being String, instead of just string, and System.out.println having the capital S, little annoying things such as that. C++ is case sensitive, yes, but commands are in lower case. I guess saying case sensitive was a poor phrasing, I mean just having crap that requires capitalization.
[/quote]
This shows lack of understanding of the language. None of these are "commands". They're identifiers for functions, variables, and classes. Java programmers tend to follow a naming convention with UpperCaseClasses, lowerCaseFunctions() and lowerCaseVariables.
[quote]
Still didn't answer my question. java or C# being the better choice?[/QUOTE]
C# in general, Java for doing APCS stuff. That's what I do. Some C++ here and there, some C# somewhere else, and Java for all of the APCS stuff.
I'm trying to use a progress bar, and so far it works. But I'm trying to make it so when it finishes, a message box pops up. I did this:
[cpp]
if (progressBar1.Value == progressBar1.Maximum)
{
MessageBox.Show("Finished!");
timer1.Stop();
}
[/cpp]
Nothing happens when it finished. This is what I have for the timer to start the bar:
[cpp]
progressBar1.Increment(3);
label1.Text = "Loading " + progressBar1.Value.ToString() + "%";
[/cpp]
And there's just a button to start the timer.
Hm, that's weird. Where did you put that if statement? (meaning, are you sure it's in a spot that it's actually going to be checked?)
This might be helpful
[cpp]
private void Form1_Load(object sender, EventArgs e)
{
if (progressBar1.Value == progressBar1.Maximum)
{
MessageBox.Show("Finished!");
timer1.Stop();
}
}
[/cpp]
Now I'm pretty sure it's in the wrong place..
Yeah that's not useful. Put somewhere else where it's definitely going to be called, like the progress bar's own callback.
Ok, thanks. I got it working :smile:
:downsbravo:
Did it never occur to you that the Form's Load event would only fire once... when the form is loaded?
[QUOTE=turb_;21261052]:downsbravo:
Did it never occur to you that the Form's Load event would only fire once... when the form is loaded?[/QUOTE]
Wow thanks for the useful remark. Once again you assert your superior intellect by acting like a douche-bag.
[QUOTE=blankthemuffin;21261847]Wow thanks for the useful remark.[/quote]
You're welcome
[quote]Once again you assert your superior intellect by acting like a douche-bag.[/QUOTE]
No, just asserting common sense
[editline]05:22PM[/editline]
Alright, here's a brain buster for you FP, why can't I convert (both implicitly and explicitly through a cast) an array of KeyValuePairs to an array of objects?
[img]http://imgkk.com/i/3qm6.png[/img]
[QUOTE=turb_;21261886]Alright, here's a brain buster for you FP, why can't I convert (both implicitly and explicitly through a cast) an array of KeyValuePairs to an array of objects?
[img]http://imgkk.com/i/3qm6.png[/img][/QUOTE]
I'm not sure, but I think it's because KeyValuePairs are value types.
Everything (both structs and classes) inherits from object.
Oh well, I fixed it by casting it to object, not object[]
[QUOTE=turb_;21263249]Everything (both structs and classes) inherits from object.[/QUOTE]
Doesn't matter; object is a reference type, structs are a value type. Value types can be boxed and unboxed into an object (copied, essentially). This does not apply to arrays of value types, so you would need to create an object array of the same size and manually go through an box each element. Of course, you could always pass the array around as an object itself, since arrays are objects.
[QUOTE=nullsquared;21264881]Doesn't matter; object is a reference type, structs are a value type. Value types can be boxed and unboxed into an object (copied, essentially). This does not apply to arrays of value types, so you would need to create an object array of the same size and manually go through an box each element. Of course, you could always pass the array around as an object itself, since arrays are objects.[/QUOTE]
Ahh, makes sense now. Thanks
[QUOTE=blankthemuffin;21261847]Wow thanks for the useful remark. Once again you assert your superior intellect by acting like a douche-bag.[/QUOTE]
Thank you for understanding what I mean.
Why isn't this drawing the sprite?
it's there, and it doesn't tell me it can't find it
[cpp]
int main()
{
sf::RenderWindow App(sf::VideoMode(800, 600, 32), "Hangman: Programmer's edition");
const sf::Input& Input = App.GetInput();
sf::Image img;
if(!img.LoadFromFile("sprites/head.tga"))
{
MessageBox(NULL, "Error loading headsprite", "Error loading sprite part: head, located in 'sprites/head.png'.", MB_OK);
}
sf::Sprite Sprite;
Sprite.SetColor(sf::Color(0, 255, 255, 128));
Sprite.SetX(200.f);
Sprite.SetY(100.f);
Sprite.SetPosition(200.f, 100.f);
Sprite.SetRotation(30.f);
Sprite.SetCenter(0, 0);
Sprite.SetScaleX(2.f);
Sprite.SetScaleY(0.5f);
Sprite.SetScale(2.f, 0.5f);
Sprite.SetBlendMode(sf::Blend::Multiply);
Sprite.Move(10, 5);
Sprite.Rotate(90);
Sprite.Scale(1.5f, 1.5f);
Sprite.SetImage(img);
while (App.IsOpened())
{
sf::Event Event;
while (App.GetEvent(Event))
{
if (Event.Type == sf::Event::Closed)
App.Close();
if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Escape))
App.Close();
}
App.Draw(Sprite);
App.Display();
}
return EXIT_SUCCESS;
}
[/cpp]
also here's head.png
[IMG]http://i44.tinypic.com/2w2les4.png[/IMG]
You keep referring to it as head.png, but you're loading head.tga. Is this on purpose?
Also, the png you linked in your post doesn't render as anything in my browser at all (Opera). I'd try with another image just to see if that's the problem.
It renders on my Opera, it's just very very very faint.
Same solution as jA_cOp in the end though, png instead of tga when loading and try with a more obvious image, a bright red circle should do. Just to make sure nothing's wrong with the code.
[QUOTE=jA_cOp;21346322]You keep referring to it as head.png, but you're loading head.tga. Is this on purpose?
Also, the png you linked in your post doesn't render as anything in my browser at all (Opera). I'd try with another image just to see if that's the problem.[/QUOTE]
oh, sorry, the image is white, and also, i had a head.tga, to see if it was just the png's fault
[editline]10:38AM[/editline]
also, still doesn't work =(
Maybe try App.Clear(); before App.Draw(Sprite); ?
[editline]08:58PM[/editline]
I'm messing around with your code, commented out a few bits of this:
[cpp]
sf::Sprite Sprite;
Sprite.SetColor(sf::Color(0, 255, 255, 128));
Sprite.SetX(200.f);
Sprite.SetY(100.f);
Sprite.SetPosition(200.f, 100.f);
Sprite.SetRotation(30.f);
Sprite.SetCenter(0, 0);
Sprite.SetScaleX(2.f);
Sprite.SetScaleY(0.5f);
Sprite.SetScale(2.f, 0.5f);
Sprite.SetBlendMode(sf::Blend::Multiply);
Sprite.Move(10, 5);
Sprite.Rotate(90);
Sprite.Scale(1.5f, 1.5f);
Sprite.SetImage(img);
[/cpp]
And the sprite showed up. [del]So you're probably moving it off screen somewhere.[/del]
[editline]09:01PM[/editline]
Sprite.SetBlendMode(sf::Blend::Multiply); is breaking it, comment it out and it should work.
Why are you calling img.LoadFromFile twice? You should also return from main when loading fails to avoid subsequent uncaught errors.
It shouldn't break anything though - again I don't think the problem lies with your program.
(Unlike last time I can't test right now, but it sounds like gilly_54 already did)
was testing if the if condition was actually working
In your if statement, it has to run that function to be able to check it.
That means that when it gets past your if statement, the image is already loaded. You don't have to load it again.
I know
[editline]02:37PM[/editline]
Fixed it, removed the setting of the color of the sprite, and it was working
[QUOTE=raccoon12;21349513]Still didn't work
=(
current code:
code
[/QUOTE]
That code works here with ONLY Sprite.SetBlendMode commented out. Keep the rest uncommented and it should work - this way you will be able to set the color of your sprite.
Either way, what are you trying to achieve with those ~10 lines of code messing with the sprite? Or are you just testing out stuff...
I'm trying to make a hangman game, I've gotten pretty far so far
Except I don't feel like making a gui in sfml so I'm just going to use the cmdline
Not that I solved (sort of) anti-aliasing I'm having trouble with thicker lines. I've managed to draw them and it looks great except they are drawn too slowly. If I have any hope of this working real time it has to be faster because the framerate drops to 10 then it draws a line.
I currently have a loop that makes a circle based on the thickness parameter and then draws a thin line from every point on that circle to the same point with an offset based on the ending point of the line.
I'll post the function that does what I just explained.
[cpp] protected void DrawThickLine(Line line, Color color, float thickness) {
Vector2 offset=new Vector2(line.end.X - line.start.X,line.end.Y - line.start.Y);
thickness /= 2;
float i = (float)-thickness;
while (i < thickness) {
float y = (float)Math.Sqrt(thickness * thickness - i * i);
Vector2 coord1 = new Vector2((i + line.start.X), (line.start.Y + y));
Vector2 coord2 = new Vector2((i + line.start.X), (line.start.Y - y));
DrawLine(new Line(coord1, coord1 + offset), color, 1);
DrawLine(new Line(coord2, coord2 + offset), color, 1);
i += thickness / 1f;
}
}[/cpp]
Is there a faster way? I even made a version of the DrawLine function that doesn't anti-alias the pixels and it's still slow as hell.
Sorry, you need to Log In to post a reply to this thread.