[QUOTE=Funley;34772928]Is it possible in XNA to load an image from the hard drive, not from the Content files and still get the file as a Texture2D.[/QUOTE]
Yep, Texture2D.LoadFromFile
[QUOTE=NovembrDobby;34772986]Yep, Texture2D.LoadFromFile[/QUOTE] That simple? Oh i love XNA.
[QUOTE=Flubadoo;34771912]But why is it necessary in the context of the program? When figuring out the number of rows, how does it add anything to it?[/QUOTE]
The number of rows seems to be already figured out, the loop is there so that the contents of the loop will be executed once for every row. It seems like it's printing rows of asterisks or something. So if there are 5 rows, it will execute that loop body 5 times and print 5 rows of asterisks.
[QUOTE=Bumrang;34760659]What's the name of the visual studio extension that shows the entire page of code on the right and a box highlighting what section of code you are looking at right now?[/QUOTE]
[URL="http://visualstudiogallery.msdn.microsoft.com/d0d33361-18e2-46c0-8ff2-4adea1e34fef/"]Productivity Power Tools [/URL]
[QUOTE=Parakon;34748637]Ok so i figured out the dynamically naming bit. But i'm still having trouble, now my collision isn't picking anything up.
Where the bullet is made and put into an array:
[code]bullet = _root.attachMovie("bullet", "bull", _root.getNextHighestDepth());
bulletArray.push(["bull"+b])
b+=1[/code]
Enemy getting hit:
[code] for (i = 0; i < _root.bulletArray.length; ++i)
{
if (this.hitTest(_root.bulletArray[i]))
{
_root.bulletArray[i]._x = -1000;
_root.bulletArray[i].dead = true;
this.hp -= 5;
}
}[/code][/QUOTE]
Still need help with this, I know i'm just missing something completely. But i've been trying to fix this for fucking days now.
Basically it only checks the first bullet, and wont check the next until the first is destroyed, so if you miss the games broken.
[QUOTE=Topgamer7;34777238][URL="http://visualstudiogallery.msdn.microsoft.com/d0d33361-18e2-46c0-8ff2-4adea1e34fef/"]Productivity Power Tools [/URL][/QUOTE]
Thanks, but I have Express edition, and it only works on Professional and above. Any alternative?
Got a little problem with fullscreen applications in java.
We're making fullscreen games in school now.
At first I made a ScreenManeger that has a static method to enter fullscreen. That one is called OldGui.
Then we had to make a GameFrame class extending JFrame that NewGui now extends.
As far as I can see it's the same code just a different setup.
Clicking on the JPanel will spawn 6000 sprites that animate and move aroundin both of the Guis.
OldGui: 79-81ms to paint them all.
NewGui: Ranging from 11-200ms to paint them all. Also throws a
"java.lang.ClassCastException: [S cannot be cast to [I" exeption.
Why it only happens in NewGui I have no idea, since they both use the same classes in the game package.
If anyone want to check it out, this is the netbeans project: [url]http://dl.dropbox.com/u/99717/Sprites.zip[/url] (Source files are in the Sprites/src folder)
In C++, if an object (rather than a pointer to an object) is passed to a function, does it really create a copy of that object as it does with primitives?
SFML has a lot of functions that take objects as arguments, should I be worrying about memory usage with the objects being copied? Or do they get destroyed automatically at the end of the function...
[QUOTE=MegaJohnny;34784720]In C++, if an object (rather than a pointer to an object) is passed to a function, does it really create a copy of that object as it does with primitives?
SFML has a lot of functions that take objects as arguments, should I be worrying about memory usage with the objects being copied? Or do they get destroyed automatically at the end of the function...[/QUOTE]
It does indeed, however SFML takes in object references as arguments which means only its reference is passed.
I.E
blah(class & classReference){}
[QUOTE=MegaJohnny;34784720]In C++, if an object (rather than a pointer to an object) is passed to a function, does it really create a copy of that object as it does with primitives?
SFML has a lot of functions that take objects as arguments, should I be worrying about memory usage with the objects being copied? Or do they get destroyed automatically at the end of the function...[/QUOTE]
Be careful if you're passing 'heavy' objects around, like textures and images. You'll want to make sure you're passing those by ref or const reference.
[QUOTE=MegaJohnny;34784720]In C++, if an object (rather than a pointer to an object) is passed to a function, does it really create a copy of that object as it does with primitives?
SFML has a lot of functions that take objects as arguments, should I be worrying about memory usage with the objects being copied? Or do they get destroyed automatically at the end of the function...[/QUOTE]
References are kinda like pointers but they aren't pointers, and if you think about storing them you're thinking about them in the wrong way. They function as an "alias" for the object that is being passed.
If the function takes a reference, you just pass the object like this f(obj); and a refererence to that object gets passed automatically.
You don't have to worry about anything since it happens automatically, but it's nice to know if the function passes a copy(nothing) or a reference (&) before you use it to avoid debugging problems.
I made this post in WAYWO but I think it's more suitable here:
[QUOTE=Bumrang;34781783]That would've been no use for me, the tutorial that I used for the base of the program wouldn't quite fit with breakout.
I used [URL="http://www.gamefromscratch.com/page/Game-From-Scratch-CPP-Edition.aspx"]this[/URL] for starting my game but it all just spiraled down in the end.
Why did I use it?
Well, for me it was kinda like this: Lets say you have an idea for something to draw. You get out a piece of paper and get a pen but, you just can't put your pen down and actually start it.
Same here, I didn't know which part of the program to start with. My last game (Pong) was a complete monstrosity [sp] at least it was a full pong game even with changing ball speeds [/sp]. I had EVERYTHING in main.cpp. That's right, no classes. Not only that, but the movement didn't depend on time or framerate. So when I got off the slow laptop I was developing on and got on my desktop I couldn't even see the ball :v:.
[B]So Facepunch, when you start a new game, what's the first thing you start with? That's pretty much all I need to start again right now.[/B][/QUOTE]
Choose your library of choice. (i.e SFML)
[B]Game Manager[/B](your main loop goes in this class, as with everything else), your main.cpp should only contain creating this class and calling its Run() function.
[B]GameStates[/B] ([url]http://gamedevgeek.com/tutorials/managing-game-states-in-c/[/url])
IntroState
PlayState
MenuState
...
which contains these functions
-Init
-Input
-Update
-Draw
-Cleanup
[B]Frame limiter(FPS)[/B] and pass frame delta time to update. SFML limits your framerate automatically but for physics and stuff you have to calculate the deltatime manually(curtime - lasttime)
Implement a [B]base entity[/B] class.
Make game.
[B]Google[/B] everything, and look at articles explaining this subject. Browse forums for inspiration, i.e gamedev.net.
[QUOTE=Topgamer7;34777238][URL="http://visualstudiogallery.msdn.microsoft.com/d0d33361-18e2-46c0-8ff2-4adea1e34fef/"]Productivity Power Tools [/URL][/QUOTE]
Are there any other usefull plugins such as this one?
How does one rotate Normals in GLSL in order to have lightning correct in moving objects?
[QUOTE=JohnnyOnFlame;34789096]How does one rotate Normals in GLSL in order to have lightning correct in moving objects?[/QUOTE]
We need more detail than that. You're most likely gonna need a matrix.
Also, I need to address this.
[b]THIS:[/b]
[img]http://static.ddmcdn.com/gif/lightning-gallery-7.jpg[/img]
[b]IS NOT THE SAME AS THIS:[/b]
[img]http://ak7.picdn.net/shutterstock/videos/41845/preview/stock-footage-close-up-of-tungsten-light-bulb-being-turned-off-to-with-soft-ambient-light-remaining.jpg[/img]
[QUOTE=JohnnyOnFlame;34789096]How does one rotate Normals in GLSL in order to have lightning correct in moving objects?[/QUOTE]
You generate a rotation matrix from the object's orientation.
If you're lazy you can take the upper-left 3x3 of the model/view matrix, but that will only work if you don't have any skew or nonuniform scale.
[QUOTE=ROBO_DONUT;34789166]You generate a rotation matrix from the object's orientation.
If you're lazy you can take the upper-left 3x3 of the model/view matrix, but that will only work if you don't have any skew or nonuniform scale.[/QUOTE]
This is the "What do you need help with" thread, so if he needs help with his spelling, I will provide.
[QUOTE=Bumrang;34779199]Thanks, but I have Express edition, and it only works on Professional and above. Any alternative?[/QUOTE]
Not especially, not for express at least, as express doesn't support addons. It's microsoft's gotcha for trying to get you to upgrade, along with limited mfc support and a ton of other shit.
If you're in school, go to dreamspark, sign up with your school email, and get the full version.
[QUOTE=ROBO_DONUT;34789166]You generate a rotation matrix from the object's orientation.
If you're lazy you can take the upper-left 3x3 of the model/view matrix, but that will only work if you don't have any skew or nonuniform scale.[/QUOTE]
That worked, thanks alot!
(No, I'll not use any skew/uniform stuff, I'll use fixed meshes.)
Could you expand a little more? When I googled them all I got was some pastebin classes, no actual explanation.
I marked it for you:
[QUOTE=AtomiCasd;34788472]Choose your library of choice. (i.e SFML)
Game Manager(your main loop goes in this class, as with everything else), your main.cpp should only contain creating this class and calling its Run() function. [B]So the only thing in main would be the Run() function and that's it? Really? Neat.[/B]
GameStates ([url]http://gamedevgeek.com/tutorials/managing-game-states-in-c/[/url])
IntroState [B]expand[/B]
PlayState [B]on[/B]
MenuState [B]these[/B]
...
which contains these functions
-Init
-Input
-Update [B]expand on all of these as well, no luck with google, just like the last ones.[/B]
-Draw
-Cleanup
Frame limiter(FPS) and pass frame delta time to update. SFML limits your framerate automatically but for physics and stuff you have to calculate the deltatime manually(curtime - lasttime)
Implement a base entity class. [B]When I googled this all I got was people asking how to make one, not what it is.[/B]
Make game.
[B]Google[/B] everything, and look at articles explaining this subject. Browse forums for inspiration, i.e gamedev.net.[/QUOTE]
I'm trying to learn how to create associations between objects in OOP. Say I have this diagram:
[img]http://gabrielecirulli.com/p/20120221-002555.png[/img]
Basically, any Workplace may have any number of Employees but an Employee may not work at more than one Workplace at the same time.
What is the correct way to implement this in an object-oriented programming language?
My guess is that the Workplace class should manage an array (or possibly a dynamic list) of Employee instances and expose methods to add or remove employees, which would naturally map them to said array.
An Employee object, on its side, would have to be added to a Workplace object.
Now that I think of it, though, there's a problem with the fact that the relationship from Employee to Workplace is not enforced in that multiple Workplaces could have the same instance of Employee added to them. How could I avoid that situation? Is my whole idea correct?
Hey, I have a project in college to do, basically it's a program where it asks questions to user and user has to choose 1 out of 4 answers.
So my quetion is: How or where should I stor - Question,Right answer, option1, option2, option3 and perhaps some more things. Should I use some kind of database? or can it be stored in text file which would be somehow read? I am using netbeans and it's java btw. Any ideas/suggestions?
[QUOTE=TerabyteS_;34800261]I'm trying to learn how to create associations between objects in OOP. Say I have this diagram:
[img]http://gabrielecirulli.com/p/20120221-002555.png[/img]
Basically, any Workplace may have any number of Employees but an Employee may not work at more than one Workplace at the same time.
What is the correct way to implement this in an object-oriented programming language?
My guess is that the Workplace class should manage an array (or possibly a dynamic list) of Employee instances and expose methods to add or remove employees, which would naturally map them to said array.
An Employee object, on its side, would have to be added to a Workplace object.
Now that I think of it, though, there's a problem with the fact that the relationship from Employee to Workplace is not enforced in that multiple Workplaces could have the same instance of Employee added to them. How could I avoid that situation? Is my whole idea correct?[/QUOTE]
I'd say giving the Workplace a list/array/map of Employee and give the Employee a single Workplace variable.
The method to add an employee in the Worplace should have an Employee as a parameter. The Workplace could then check that the employee.workplace == null.
[QUOTE=Zyx;34800448]I'd say giving the Workplace a list/array/map of Employee and give the Employee a single Workplace variable.
The method to add an employee in the Worplace should have an Employee as a parameter. The Workplace could then check that the employee.workplace == null.[/QUOTE]
And then the workplace should do something like[B] employee.workplace = this;[/B]?
[QUOTE=TerabyteS_;34800618]And then the workplace should do something like[B] employee.workplace = this;[/B]?[/QUOTE]
[cpp]
//Method in the Workplace class
public void addEmployee(Employee employee)
{
if(employee.getWorkPlace() == null)
{
employees.add(employee);
employee.setWorkPlace(this);
}
}
//Method in the Employee class
public void setWorkPlace(Workplace workplace)
{
this.workplace = workplace;
}
[/cpp]
Of course Workplace should have a method to remove an employee that also sets that employees workplace to null.
Employees could also have a method that does the same thing.
So my program will make 100 random points scattered over a 2d surface.
From these points I need to generate shapes.
This is an illustration of the 2 phases I need my program to go through.
1.) Points
2.) generating shapes
I need the surface area to be limited to a certain amount (because the points at the edge can't expand forever)
Is there an algorithm associated with this that someone can name for me?
[IMG]http://i.imgur.com/fK5gg.png[/IMG]
[url]http://pastebin.com/v3bmNKk3[/url]
I know the formatting is all wonky since all of the endls are in the wrong places, but this C++ program only prints out two integers at most, any idea why?
[QUOTE=-Kesil-;34801357]So my program will make 100 random points scattered over a 2d surface.
From these points I need to generate shapes.
This is an illustration of the 2 phases I need my program to go through.
1.) Points
2.) generating shapes
I need the surface area to be limited to a certain amount (because the points at the edge can't expand forever)
Is there an algorithm associated with this that someone can name for me?
[IMG]http://i.imgur.com/fK5gg.png[/IMG][/QUOTE]
Look into Voronoi diagrams.
[editline]21st February 2012[/editline]
[url]http://en.wikipedia.org/wiki/Voronoi_diagram[/url]
[QUOTE=-Kesil-;34801357]So my program will make 100 random points scattered over a 2d surface.
From these points I need to generate shapes.
This is an illustration of the 2 phases I need my program to go through.
1.) Points
2.) generating shapes
I need the surface area to be limited to a certain amount (because the points at the edge can't expand forever)
Is there an algorithm associated with this that someone can name for me?
[IMG]http://i.imgur.com/fK5gg.png[/IMG][/QUOTE]
Look at Poisson disk sampling patterns for generating points.
The second picture is a [url=http://en.wikipedia.org/wiki/Voronoi_diagram]Voronoi diagram[/url]
Sorry, you need to Log In to post a reply to this thread.