Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

798 Good

About ontheheap

  • Rank
  1. ontheheap

    Happy pride everyone!

    This type of crap makes my blood boil. Hopefully those scumbags will at least lose their jobs for this, but I doubt it. Maybe someday we'll live in a society where we all have respect and compassion for fellow humans.. I doubt I'll live to see it, but someday...
  2. ontheheap

    how to split a string in c++?

    There's boost tokenizor and boost string algorithm. Example: #include <iostream> #include <string> #include <vector> #include <boost/tokenizer.hpp> #include <boost/algorithm/string.hpp> using namespace std; using namespace boost; int main() { // here's a string in the format you described, plus // two empty vectors v1 and v2 string text = "A,B,C::D,E,F"; vector<string> v1; vector<string> v2; // tokenize the string by the "::" character // and get an iterator to the first tokenizer result char_separator<char> sep("::"); tokenizer<char_separator<char>> tokens(text, sep); tokenizer<char_separator<char>>::iterator it = tokens.begin(); // split (defined in algorithm/string.hpp will tokenize // the string pointed to by it and store each token in // the specified container split(v1, string(*it), is_any_of(","), token_compress_on); ++it; split(v2, string(*it), is_any_of(","), token_compress_on); } Edit: Added links.
  3. ontheheap

    Learning Physics

    Have you checked out Khan Academy? He has a bunch of short video lectures on all sorts of topics, including physics lectures on everything from projectile motion to electromagnetism (basically what you would cover in two semesters of physics).
  4. ontheheap

    Quick question in SDL

    Make sure your main function is defined as: int main( int argc, char* argv[] ) Make sure you are linking against SDL.lib and SDLmain.lib Edit: Fixed the wrong version of "your" above ;)
  5. ontheheap

    Correct game C++ OOP impl. in main?

    Quote:Original post by Sneftel Everyone who posted in this thread needs to read about the bike shed. That was great. "... the amount of noise generated by a change is inversely proportional to the complexity of the change." =)
  6. ontheheap

    using string to trim filename from path

    Quote:Original post by SelethD I tried system.io.path, and its not working for me. I need simply to know how to remove the text from a String after the last occuring '/' What do you mean "its not working" for you? Please post the relevant code. I suppose you could do it with String.LastInstanceOf and String.SubString.
  7. ontheheap

    using string to trim filename from path

    Quote:Original post by SelethD I am new to C# and I have never used the String class much. I have a complete path in a String String myPath = "C:\\directory\\subdirectory\\file.dat"; what can i do with myPath to get it to hold the data... "C:\\direcotory\\subdirectory\\" Thanks for your help, I have googled this and all I find is a buch of VB stuff. Check out System.IO.Path. I believe the method is GetDirectoryName.
  8. ontheheap

    c++ sending keypresses to website

    Look into InternetExplorer objects in VBScript. Example: Set IE = CreateObject("InternetExplorer.Application") IE.Visible = False IE.Silent = True IE.Navigate "http://www.google.com" Do While IE.Busy Loop IE.Document.f.q.Value = "gamedev" IE.Document.f.submit() Do While IE.Busy Loop IE.Visible = True
  9. ontheheap

    Need text wrapping code

    A comment system we use at work has limitations on the number of characters that will fit on a line, as well as the number of lines that will fit on a screen. I wrote an HTA script to make posting the comments easier. Here's my text-wrapping code.. written in VBScript so should be easy to follow and translate to whatever language you need. Each line gets stored as a new array entry, then the array can be looped through and a new line started at the beginning of each element. Function WrapComment() strComment = UCase("CLRC Updated by " & mainform.workerNumber.value & ", " & mainform.comment.value) strComment = Replace(strComment, vbCrLf, " ") strDirtyComment = "" strWrapText = "(((%%%WRAPTEXT.$$--</ br>--$$.WRAPTEXT%%%)))" arrWordsTmp = Split(strComment," ") intRunningLength = 0 intWrapLength = LineSizeCLRC ' Any single word (that is, block of characters without a space) that is ' longer the the line size get broken up into words the size of 1 line tmpStr = "" For Each Word In arrWordsTmp If Len(Word) => intWrapLength Then ' figure out how many lines it will take up numOfLinesNeeded = Len(Word) / intWrapLength temp = Round(numOfLinesNeeded) If temp < numOfLinesNeeded Then numOfLinesNeeded = temp + 1 Else numOfLinesNeeded = temp End If // Break the long word up into chunks that will fit on a clrc comment line For t = 1 To numOfLinesNeeded if t = numOfLinesNeeded Then tempStr = tempStr + Mid(Word, ((t-1)*intWrapLength)+1,intWrapLength) else tempStr = tempStr + Mid(Word, ((t-1)*intWrapLength)+1,intWrapLength) + " " end if Next Else tempStr = tempStr + Word + " " End If Next tempStr = Trim(tempStr) arrWords = Split(tempStr," ") arrTrailingCharacters = Split(tempStr," ") For x = LBound(arrTrailingCharacters) To UBound(arrTrailingCharacters) arrTrailingCharacters(x) = " " Next For x = LBound(arrWords) To UBound(arrWords) intRunningLength = intRunningLength + Len(arrWords(x) & " ") If intRunningLength = intWrapLength Then arrTrailingCharacters(x) = strWrapText intRunningLength = 0 End If If intRunningLength => intWrapLength And x > 0 Then arrTrailingCharacters(x-1) = strWrapText intRunningLength = Len(arrWords(x) & " ") End If Next For x = LBound(arrWords) To UBound(arrWords) strDirtyComment = strDirtyComment & arrWords(x) & arrTrailingCharacters(x) Next arrDirtyComment = Split(strDirtyComment, strWrapText) i = 0 For Each commentLine In arrDirtyComment ReDim Preserve CommentArray(i) CommentArray(i) = commentLine i = i + 1 Next If i = 0 Then ReDim Preserve CommentArray(0) CommentArray(0) = "" End If End Function
  10. OMG I would have liked to have known about this site when I took physics last semester! I didn't really understand anything in the book we used.
  11. ontheheap

    when to get a Wii

    Quote:Original post by CyberSlag5k Quote:Original post by Thevenin Is it true that you can play and browse online with the Wii for free (using an existing internet connection)? That Microsoft Live subscription nonsense was/is rediciously overpriced. I believe it costs $5 to active the browser, but after that it's free. Though I think right now the browser is in beta mode, and is free for the time being. Don't quote me on that, though. Yeah, it's supposedly going to cost 500 Wii points ($5.00 USD) but it's free until June 2007. Right now it's just a trial version, with the final version available in March.
  12. ontheheap

    Wii remote... on the PC?

    I've tried out DarwiinRemote on my Macbook (in OSX). It worked ok (it was a little hard to control the pointer). I'm downloading the software on wiiscript right now to check it out. Edit 1: Meh. My WiiMote is able to connect to Windows but none of the GlovePIE scripts work. I'm having trouble getting the BlueSoleil bluetooth software working (which seems to be the recommended software if MS bluetooth doesn't work with Glove). Oh well, I'll spend more time on this later to see if I can get it working. [Edited by - ontheheap on December 23, 2006 1:13:29 PM]
  13. ontheheap

    Am I and idiot or is programming just hard

    You declare buymenu() as returning type int, but you have no return statement. I'm surprised it even compiles. VC++ Express issues an error. Based on what buymenu() does, I think you should make its return type void. Or, you could get the user's input within buymenu() and then as then return the menu option selected. void buymenu() { // stuff return; } Or: int buymenu() { // stuff int choice; cin >> choice; return choice; }
  14. ontheheap

    WiiMote with candles no sensor bar

    Quote:Original post by Alpha_ProgDes Quote:Original post by Michalson I would try this but I already have my Wii turned on to make this post. Is there a WiiBoard or do you use the WiiMote to type? WiiMote with OnScreen keybord. It has that "intellitype" thing where it guesses what word you want as you input letters. It's pretty easy to "type" on, but it would be much better if you could just use a wireless keyboard.
  15. ontheheap

    Help - please make my game idea not suck..

    Event Two reminds me of one of the American Gladiator game called Assault. It was one of my favorite games on the show.
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!