SgtMe 46 Veteran Poster Featured Poster

Whoops solved it all by myself. Sorry guys.

SgtMe 46 Veteran Poster Featured Poster

Have another problem with an OBJ model format converter I'm making. As a test, I want to read in data from an OBJ file, and write it out in a different format, and then the other way around.
The problem I currently have is that I want it to be able to recognise comment files and write them without any modification. I am using istream to open the file and read the lines, but I need a way of testing whether or not the line starts with a #.
Also, I need help with reading it into a string.

Bits and pieces of my code so far:
A line with vertices (ie. "v 0.165906 -0.073740 0.414549") will have the v and the first space removed (by removing the first 2 chars), and split at the spaces, with the following code:

Vert_Out SplitVerts(string data, int id)
{
     //variable defs
     string in_data = data;
     string middle_data = "";
     string array_data[3];
     double out_data [3];
     //remove 'v' and space
     middle_data = in_data.erase(0, 2);
     //split data
     stringstream split(middle_data);
     string token;
     //i for loop
     int i = 0;
     //feed split into array
     while(split>>token){
                         array_data[i] = token;
                         i++;
     }
     //use struct for output vertex
     Vert_Out vert;
     //vert order num, [x-val, y-val, z-val] [from array]
     vert.id = id;
     vert.x = array_data[0];
     vert.y = array_data[1];
     vert.z = array_data[2];
     //return vert for use
     return vert;
}

The data is stored in the following struct:

struct Vert_Out
{
       //Vert order number, x-val, y-val, z-val
       int …
SgtMe 46 Veteran Poster Featured Poster

Also, 1 squared is 1 ;)

SgtMe 46 Veteran Poster Featured Poster

I'm not sure. Now that I think about it, you could put all the text into one long string with newlines character etc., and then print the whole thing, then clear the screen and print the updated set. Probably would still flicker though.

If the game was just a complete text game, it depends. They may still have used a GUI, but they probably just used the console. Something like "Dwarf Fortress" (youtube it) is an example of what I mean. Still not sure though, you'd have to try things.

Best bet if your making a game that needs to update quickly is just to use a graphics library to make a 2D game with very basic sprites. If you can use the DirectX SDK well, then go with that. Allegro is also very good for 2D.

Hope this helps :)

SgtMe 46 Veteran Poster Featured Poster

OK...I'll have a quick look.

1. If you want to print all the data:
eg.
cout<<"Student: "<<name<<"Class: "<<class<<"Average Score: "<<avg_score<<endl;

2. If you want to make it into a table, you could just use whitespace, or you can use ASCII to draw up a table, like using the (-), (_), (=), (|) and (¦) characters.

3. Not sure about this one. My recent experiences are that my programs crash if I try to use a pointer to an array ID that doesn't exist, ie:

int bob[3]
bob[3] = 234
//True IDs for bob array are: 0, 1, 2

Make sure that you have enough room in the array to enter the student data. Had a quick look over your code and think this may be the problem, but I could only have quck look.

Hope this helps :)

SgtMe 46 Veteran Poster Featured Poster

I don't think you can do that with the console. You would need to use a GUI or graphics lib.

SgtMe 46 Veteran Poster Featured Poster

Ingedients:
1. Effort
2. Ability
3. Willingness
4. Sense of hard work
5. More effort

Recipe:
1. Using your effort and your ability, make sure you are willing to make use of a good sense of hard work to code a program, or come up with an idea for one.
2. For great touch and positive ratings, add more effort.
3. THEN YOU CAN COME AND B*TCH ON THIS FORUM!

SgtMe 46 Veteran Poster Featured Poster

Whoops! Sorry prvnkmr449! Didn't notice you were writing a reply as well. Ah well :)
Also: even if it does count as a simple error, it's unavoidable. It's the same reason why people will get someone else to proof read a letter.

SgtMe 46 Veteran Poster Featured Poster

Firstly, you need to check your loop in the main function. Look where you write CalcAverage(). This needs to be inside a loop, so that you can run it for all students. Currently, it's just doing the calculations for one.
Secondly, yes you would could use a loop like that to print the data. In this situation, I would use variable i and increment each loop to print out the test scores. This would be best, seeing as it would support variable amounts of pupils.
Also, I would like to thank you on the fact that you have put in a great amount of effort before calling for help. You don't want to know how many times people have just demanded help :|

If you need anything else just ask :)

SgtMe 46 Veteran Poster Featured Poster

Just some input:

-Using a struct is the best idea. However, watch out if you make a function that
returns with a type of said struct.
-In the struct, you may want to use "string tellNum" (don't forget to include the string header!) instead, as some people (like me) put a space between the area code and the phone number. This would also work for mobiles, where a few people put '+44' instead of '0'.

Hope this helps and good luck :)

SgtMe 46 Veteran Poster Featured Poster

How about using the dos command rename? Consider this pseudocode (yes, I love pseudocode):

main function{
    print("enter old path")
    input>>old_path
    print("enter new path")
    input>>new_path
    system("pause")
    system("rename ", old_path, new_path)
    print("complete")
    }

I would give you a proper code, but I'm working back into console based C++, after spending 2 years in python. I want to learn more C++ than I originally did. Here's a couple of links:

http://www.computerhope.com/renamehl.htm
http://www.computing.net/answers/programming/dos-commands-in-c/9449.html
(on the second link, the second post should give you an idea)

Hope this helps :)

SgtMe 46 Veteran Poster Featured Poster

Checking out Kieran's code: works fine. Just a couple of points. When it asks for your body weight, is that kilograms or what? Good job guys :)

SgtMe 46 Veteran Poster Featured Poster

:D :D :D :D Thank you very much! My program is working! Unfortunately, I am eternally indebted to you :'(
Thanks :)

SgtMe 46 Veteran Poster Featured Poster

Nah I'm not making an importer. I'm just converting the data to a custom format and back as a test :)
Can you give me an example of the structs? I can comfortably use structs I just don't understand what you want me to do.
Thanks for your help :)

SgtMe 46 Veteran Poster Featured Poster

Hi just a simple n00b question.
I need to split a string (from a .obj 3D model format) into a list of three doubles (the vertices).

example string: v 0.200006 -0.093641 0.584690

I want to make it into an array of (for example): {0.200006, -0.093641, 0.584690}

I can get rid of the 'v' and the space at the beginning, but I need to split the three vert position values using the spaces in the middle. That would probably go into an array, which I would write to a file after modification.

Thanks for your time :)

Pseudo-code:

function SplitVerts(data){
     string OutData = data
     OutData = OutData.remove(first 2 chars)
     OutData = OutData.split(" ")
     OutData = string(outdata)
     ...
     return OutData
}
SgtMe 46 Veteran Poster Featured Poster

On msn, some of my contacts do not appear online, even when I know they are, and they cant see me either. Others cant recieve my messages, but they appear to send ok. And no, we havent blocked eachother, were not choosing to appear offline or anything else, so dont say 'you need to choose to appear online'. This also happens on my INQ1 mobile on 3, which has mobile msn on the brew os. It happens with the same contacts. Please help! Thanks.

SgtMe 46 Veteran Poster Featured Poster

Google has plenty of those.

SgtMe 46 Veteran Poster Featured Poster

Actually ColSanders, I did NOT write that, so don't quote me for it ;) The reason I say this is because YOU CAN DISTRIBUTE THE APPS ON THE APP STORE. IT IS LEGAL! You send them your C++ code, and an automated piece of software runs it through some program, and then through the iPhone SDK, so the app is (technically) legally built. You then have the correct file type for your app. Then, you can either sign up to the app store and distribute it there (costs), or you can publish through zimusoft. If you take the Zimusoft route, all that happens is that you get free distribution in exchange for them having the developer name. It's all legal, and you build native apps.
Should have done some research... ;)

SgtMe 46 Veteran Poster Featured Poster

Hi all.

Before I say any more, I am a compete noob at JavaScript. I have been attempting to learn some though.

I want to make some Windows 7/Vista sidebar gadgets, so, as a practise, I am making a very simple calender. It uses a CSS to draw up a background image, which works fine. The manifest is fine, and it installs. I made a javascript to get the date, and I linked it into the base HTML source file. In the javascript, I have a section that uses "document.write()". When I start the gadget, however, I just see the background image and no text.

I opened the JavaScript with 'Microsoft Windows Based Script Host', which gives me an error saying that 'document' is undefined. I tried putting it directly into my HTML source file, but the same result occurs (no text, just the background image). From my understanding, 'document' means like the web-page or window (or something!) and doesn't need to be defined. Can someone point me in the right direction?

Here is the script (runs fine until "document.write()")

var months = new Array();
months[1] = "Jan"; months[2] = "Feb"; months[3] = "Mar";
months[4] = "Apr"; months[5] = "May"; months[6] = "Jun";
months[7] = "Jul"; months[8] = "Aug"; months[9] = "Sep";
months[10] = "Oct"; months[11] = "Nov"; months[12] = "Dec";

var thedate = new Date();
var day = thedate.getDay() + 1;
var month = thedate.getMonth() + 1;
document.write(day)
document.write(month)

Thanks :)

SgtMe 46 Veteran Poster Featured Poster

I'd say it was 50-50. iPhone has a bigger/better market, but it is expensive to develop for (if you want full functionality available by using the iPhone SDK with Objective-C). Alternatively, you can use Dragonfire SDK (C++), which has limited capabilities, but you can still make great apps with it. Android is (IMO) harder to program with, but it has much cheaper development tools (many are free) and distribution is very low cost. If I had to choose though, I would take DragonfireSDK for iPhone. However, if you make successful, popular iPhone apps, what's to say you couldn't make android versions?

SgtMe 46 Veteran Poster Featured Poster

Thanks I've got it working now.
Looks like you've solved the case again, Vega!
;)

SgtMe 46 Veteran Poster Featured Poster

Or how about Python, using PyGame, or further that with PyOpenGL through PyGame?

SgtMe 46 Veteran Poster Featured Poster

nah I have the latest drivers and a pretty recent DirectX. Anyhoo I managed to solve it...somehow :o

SgtMe 46 Veteran Poster Featured Poster

Aaah thanks again Vega :) You some kinda super hero or somethin'? ;)

SgtMe 46 Veteran Poster Featured Poster

OK cheers Vega :)
I'll have to look 'em up 'cos I'm not very good with lists.

SgtMe 46 Veteran Poster Featured Poster

I want to make an array (using the built-in array module), to create an array made up of classes. All the objects in the array will be the same class, but I want to be able to append new classes on the end and read the values.
Thanks in advance.

SgtMe 46 Veteran Poster Featured Poster

Oh damn Crunchie. I have been using CCleaner to clean the registry but only occasionly. At it backs it up first.

SgtMe 46 Veteran Poster Featured Poster

I did a search with Bobbi Flekmans's tool, but it didn't turn out anything. I think it's gone then. Thanks for the help guys :)

SgtMe 46 Veteran Poster Featured Poster

Well is it alright if I have 2 anti-virus at once? Cos SUPERantispyware I just use for scans. Only avast and McAfee are actual real-time antivirus.
I tried Malwarebytes nearer the start of my problem, and that didn't turn anything out. I managed to stop the DLL process the other day and delete so I should be OK.
Still, I'll have a look in the registry and see if somethings still there.
Thanks guys :)

SgtMe 46 Veteran Poster Featured Poster

As I write this to you, I am feeling relieved, as I have just managed to come out on top of a heavy virus situation. I downloaded a file, and, unkown to McAfee (I now have, Avast, McAfee and SUPERantispyware, it contained a virus. This installed a few more viruses and some spyware. I have removed everything except one thing.
Twikelaguzeya. It has a DLL called usojahoz.dll. I have renamed the DLL so it cannot open (I think :o ), and told it not to open on startup (using CCleaner), but this takes no effect as I think there is a registry value making it open on startup and changing the settings again! Can someone give me some suggestions of where to find it? Sorry I'm a bit of a noob with the registry (Google turned out nothing for either the application name or dll file).

Thanks muchly for your time :)

SgtMe 46 Veteran Poster Featured Poster

OMG thanks! I was going to buy it soon, but I've put in for a spare serial...thanks muchly!

SgtMe 46 Veteran Poster Featured Poster

look. go post in the correct forum. This is general game dev, not a programming language. looks like C++ to me, so post in the C++ forum. Also, code snippets are for completed, working snippets that other can use. This is the sort of thing you put in code tags in a forum post.

SgtMe 46 Veteran Poster Featured Poster

Thts k :)

SgtMe 46 Veteran Poster Featured Poster

You what now? If you want serial codes to upgrade trial versions, look yourself. It's kinda illegal as well.

SgtMe 46 Veteran Poster Featured Poster

use google. if you are using dev-c++ then use the package manager/update downloader.

SgtMe 46 Veteran Poster Featured Poster
SgtMe 46 Veteran Poster Featured Poster

http://msdn.microsoft.com/en-us/library/dd370990(VS.85).aspx
Take a look at this MSDN page. If you scroll down a little bit it has all the details that you need. Example and source code, programming guide, getting started. API referece etc. I took me literally 30 seconds to find this.

SgtMe 46 Veteran Poster Featured Poster

hmmm...your best bet for making a game engine is to use a new set of functions (such as collision, sound, graphics etc.) over existing libraries. For example, you could use OpenGL for the graphics, and use something like OpenAL for sounds. Collisions would need to be created purely by logic, either modifying existing code or making your own.
You could, for example, make an init. function for your game engine, which the programmer could call. But inside the game engine, this init. function would initialize all the libraries such as OpenGL and OpenAL or whatever. You could have sprite classes, model classes, and so on. All you really need to do is to make a new set of functions that incorporates all the other library functions, to make a game engine which has the power of all these libraries, but is a hell of a lot simpler to use.

SgtMe 46 Veteran Poster Featured Poster

What in particular do you not know about games in C++?

Graphics
-------------
Allegro (simple)
OpenGL (medium)
DirectX (hard)

GUI
-------------
Win32 API

Game Engines
-------------
DarkGDK
Irrlicht

Ideas
-------------
Game programming ideas wiki

May I warn you that you may find a difficult point in the middle of game programming. You have great ideas, but you aren't quite experienced enought to put them into practice. Start with the basics, and always think about what you need to know if you have a new game idea.

I hope you can get started with this.
Mark :)

SgtMe 46 Veteran Poster Featured Poster

C++ Forum please.

SgtMe 46 Veteran Poster Featured Poster

The question asked me, "Which OS do you think is best?" So I stated the ONE that I thought was best. Yes, it could be made muti-platform, but that was not the question -_-

SgtMe 46 Veteran Poster Featured Poster

Hi all.
When I try to run games on my computer, the window is in fullscreen mode, but the view doesn't cover the whole screen; as to say there are black bars on the left and right. I changed the ingame settings, but I can't get it back to where it used to be. You see, I started windows today, and I got a bug where the monitor suddenly goes bright and blurry. I have fixed this now, but I can't get the display settings back to where they were. I can get aspect ratios where the screen is covered, but then the game runs too slowly or the mouse cannot move quick enough.

Thanks for any help.
Mark

SgtMe 46 Veteran Poster Featured Poster

Windows, because it used by more people, with better support.

SgtMe 46 Veteran Poster Featured Poster

sorry im not sure on that front.

SgtMe 46 Veteran Poster Featured Poster

yeah, but surely there is no issue, as Tk and pygame are not interacting. I have used both together before.

SgtMe 46 Veteran Poster Featured Poster

wow! That's a huge project. Build it up in stages. Start with one drum, which is operated using the mouse. Then build it up with more drums (using classes) until you have the amount you want. Make a new program, again with just one drum, but copy all the draw functions etc. from the previous program. But in this program, write the logic for tracking movement. Then, copy that code into the first program when you have it done and make additional touches. As for a language, I'm not really sure.
Hope this helps.

SgtMe 46 Veteran Poster Featured Poster

try using:

import pygame
#and
from pygame.locals import *

Also use the

pygame.mixer.get_init()

function to see if the mixer is working

SgtMe 46 Veteran Poster Featured Poster

Other than that, downgrade(opinion). (Tech B)

I agree. I'm not upgrading to Python 3.x until there is full support for many of the modules.

SgtMe 46 Veteran Poster Featured Poster

i take it you installed the binary for your version of python?

SgtMe 46 Veteran Poster Featured Poster

What error do you get?