[QUOTE=jA_cOp;16573869]strlen retrieves the amount of characters until the terminating null character, which is the length of the string :)[/QUOTE]
Ah... correct, the problem was not strlen it was my switch statement, thank you anyway. Now I have a problem of functions I wish to use on char's only working for const chars... Sigh..
[QUOTE=FerrisWheel;16576947]Ah... correct, the problem was not strlen it was my switch statement, thank you anyway. Now I have a problem of functions I wish to use on char's only working for const chars... Sigh..[/QUOTE]
You said that you are using C++
You may want to look into the <string> header and std::string class.
[QUOTE=t0rento;16577047]You said that you are using C++
You may want to look into the <string> header and std::string class.[/QUOTE]
Yeah I've sorted it now, one last off-topic question. Is there a way to suspend for a key in SFML (without continuing to execute the code)?
[QUOTE=jA_cOp;16573869]strlen retrieves the amount of characters until the terminating null character, which is the length of the string :)[/QUOTE]
Can you not use the std::string.length() function?
[editline]10:12AM[/editline]
[QUOTE=Stickmoose;16568937]Vectors would be a way but it could be as simple as making an array of structs. When you want to render or update them you just loop through the array.[/QUOTE]
Thanks! I had lever learned Structs, are they basically public classes? With classes I couldn't render them in a loop because of scope issues.
[QUOTE=nos217;16577599]Can you not use the std::string.length() function?[/QUOTE]
Not with a character array.
Oh right my mistake.
[QUOTE=FerrisWheel;16577456]Yeah I've sorted it now, one last off-topic question. Is there a way to suspend for a key in SFML (without continuing to execute the code)?[/QUOTE]
sort of like a pause screen?
some pseudo code
[code]
for(;;)
{
if (SFML_KEY == WHATEVER)
{
break;
}
}
[/code]
EDIT: What'd I do wrong this time :P
[QUOTE=Pj The Dj;16569597]Planning on buying it then?[/QUOTE]
Why else would I have asked!
Yall would shit yourself if I really was a monkey
[QUOTE=FerrisWheel;16577456]Yeah I've sorted it now, one last off-topic question. Is there a way to suspend for a key in SFML (without continuing to execute the code)?[/QUOTE]
One simple way:
[cpp]
void WaitForKey(sf::Key key)
{
sf::Event event;
do
{
YourSFMLWindow.Display();
if(!YourSFMLWindow.GetEvent(event))
{
sf::Sleep(.01f);
continue;
}
}
while(Event.Type != sf::Event::KeyPressed && Event.Key.Code != key);
}
[/cpp]
I didn't try it, but it should work if you get it to compile :)
edit:
And you might want to at least handle sf::Event::Closed in addition to that.
[QUOTE=FerrisWheel;16573789]For the application i'm working on (C++), I need to count the amount of characters/length of a character array (strlen retrieves the max length, not how many characters placed), is there a way of doing this? Such as searching for a terminating character or such?[/QUOTE]
In C++, why do you have a character array in the first place, instead of std::string?
[QUOTE=nullsquared;16579674]In C++, why do you have a character array in the first place, instead of std::string?[/QUOTE]
If you don't need to do anything fancy with it, or you need to manipulate it somehow that std::string is not useful for doing, why have it as a string object?
Maybe he needs to format a string in the printf/sprintf style? I don't recall there being anything like that inside std::string.
Depending on what you are doing, regular character arrays and fancy 'wrappers' for them, both have their uses.
Can someone suggest me a human-editable file format that's easy to parse? I thought about using plain XML or maybe JSON.
I want to use it like that:
File type A -> Action A and Path A
File type B -> Action A and Path B
File Type C -> Action B which doesn't need a path
Then use XML or JSON?
I'm sure there are tons of alternatives I've never heard about. I only know XML, JSON and INI.
I suggest you grab a ready library for whatever format you decide to use, just to dodge the bugs you WILL have in the parser and save lots of time. Unless you want to try doing it yourself, of course by all means do it, but prepare to use a lot of time in to it. For example TinyXML is a nice and small parser written in C++, that parses the files in to [URL=http://en.wikipedia.org/wiki/Document_Object_Model]DOM (Document Object Model)[/URL] objects for reading and manipulating.
I want to make my own parser. It's more fun and it's always nice to learn something new.
After a few minutes on Wikipedia I think I'll use XML. Looks pretty easy to parse and to edit and it's perfect for what I need it.
Parsing files is easy as long as their format stays perfectly consistent. But when there's errors or the file format doesn't follow a specific standard or the standard has flexible syntax, you need a shitload of errorchecking to NOT overflow a buffer and crash your application.
I hope Fallout 3 doesn't have any save corrupting bugs to crash my save manager that I coded last week. I got the idea from my huge number of space-wasting-saves and Garrys hot-compiling post, to do a manager that tracks any changes in the FO3 quicksave.fos file and automatically copies the save to another directory when it changes, with a name similar to the normal saves in FO3. And when there's more than a specified number of saves in the directory it automatically deletes the oldest one when a new one is added, so you never have more than a specified amount of saves and they're all fresh. The application is coded in VC++ using MFC and displays a list of all the stored saves and also has hotkey functionality so that you can actually select a save while in game and copy it over the current quicksave and use the quickload button to load a stored save. But that can only work if you have a dual-monitor setup, like I do.
It's still under work though, and has a really stupid bug that I haven't been arsed to fix cause I don't use that feature of the program much. When you 'load' a stored save back to the game saves folder, the monitor thread detects the change in the file and attempts to store it once again, but fails because the file name that it puts together is already in use. And I still want to make it display the thumbnail from the save file on the dialog when you select a save from the list.
[b]Edit:[/b]
And here's how it currently looks:
[IMG]http://i25.tinypic.com/2cz5093.png[/IMG]
Why did I draw a lowercase 'e' and then an uppercase 'E' in the "CENSORED" sign.
Also I need to add support for sizing of the window.
A friend of mine is making an MORPG in torque.
[url]http://tallion.co.nr[/url]
Why censor your name?
[QUOTE=nos217;16581626]Why censor your name?[/QUOTE]
Because he's obviously so important
[editline]04:54PM[/editline]
"oh my god, your name is DAVE??!!?!"
HDR lighting pipeline is quite done for now:
[img]http://imgkk.com/i/Zc2dVu.png[/img]
[img]http://imgkk.com/i/qakXgJ.png[/img]
My name is Craig :3.
[editline]04:55PM[/editline]
Looking good Null, nice new icons. Are those affixed to a theme?
Hello Craig :)
Hey qurl :D.
[QUOTE=nos217;16581748] Are those affixed to a theme?[/QUOTE]
Yeah, every skin has its own set of icons/etc.
I don't remember those in the videos. Did you just add them?
[QUOTE=nos217;16581854]I don't remember those in the videos. Did you just add them?[/QUOTE]
Yeah, they're new. Courtesy of our tester/contributer, Eriks.
What a legend, is Eriks.
I have a question to you guys, when did you start to do "graphical programming"? After you've learned classes?
[QUOTE=AltSwebonny;16582155]I have a question to you guys, when did you start to do "graphical programming"? After you've learned classes?[/QUOTE]
You start when you feel comfortable in the langauge. Aka, when you learn classes and can use them comfortably.
Sorry, you need to Log In to post a reply to this thread.