This is the first time I've ever visited the programming section and the first page of this thread has made me respect it.
Kudos, fellow FP'ers.
[QUOTE=Smashmaster;21950265]Why[/QUOTE]
Don't listen to him, he doesn't know what he's talking about.
Playing them on separate threads is perfect, especially for multiplayer games.
[QUOTE=FerrisWheel;21953676]Can you explain what you mean by this? I'm new to sockets.[/QUOTE]
Don't worry about it, he's wrong. Incoming data is buffered for you by the OS, and since you are using TCP, packet loss is also handled for you. What that means is, when you read data from a socket you're actually reading from an internal buffer. If the buffer doesn't contain at least the number of bytes you requested, the read operation will block until the data arrives or until a set timeout (which could be 0, aka non-blocking socket).
[QUOTE=Smashmaster;21949914]I'm coding a 2D game engine in Java and OpenGL. Right now I'm working on it's sound system, and my current plans are to have it play each sound on its own thread, so that there's no limit on the number of sounds you can have playing at once. Is this good practice, or should I rethink how this is going to work?[/QUOTE]
I just use separate threads so that I can have sounds that don't block the current process of things, and that I can have them 'overlap' per say.
[editline]lolcocks[/editline]
Just make sure they die or you'll have a lot of excess memory usage.
[code]
package engine;
import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.Clip;
import javax.sound.sampled.LineEvent;
import javax.sound.sampled.LineListener;
public class SoundPlayer extends Thread implements LineListener{
private String resourceFileURL = "";
private Clip clip;
private AudioInputStream inputStream;
private boolean loopStream = false;
public SoundPlayer(String url, boolean loop){
this.resourceFileURL = url;
this.loopStream = loop;
}
public void run() {
try {
this.clip = AudioSystem.getClip();
this.inputStream = AudioSystem.getAudioInputStream(SoundPlayer.class.getResourceAsStream(this.resourceFileURL));
clip.addLineListener(this);
clip.open(inputStream);
clip.start();
if(this.loopStream){
clip.loop(2);
}
} catch (Exception e) {
e.printStackTrace(System.out);
}
}
@SuppressWarnings("unchecked")
@Override
public void update(LineEvent arg0) {
if(((Comparable<String>) arg0.getType()).compareTo("Stop") == 0){
try{
this.clip.stop();
this.inputStream.close();
} catch (Exception e){
e.printStackTrace(System.out);
}
}
}
}
[/code]
My first suggestion there is to use a rectangle class that has an intersect checking function to avoid that clusterfuck there.
[QUOTE=CPPNOOB;21989330]My first suggestion there is to use a rectangle class that has an intersect checking function to avoid that clusterfuck there.[/QUOTE]
It did have one.
Tank1.Bounds.Intersect or something like that but it doesn't work right.
Maybe I'll write my own.
Does anyone have an OSX development experience? I'm planning around with Obj-C and I have a question,
[img]http://grab.by/grabs/48a2a1cba0e0da9435ca1f0f3126c9b2.png[/img]
What's that called and how do I create it. :downs:
I think it's UIAlertView but I'm not entirely sure.
[editline]10:22PM[/editline]
UIAlertView is for cocoa touch.
[url]http://www.journey-of-flight.com/bh_xcode/how-to/0032_Three_Button_Confirm_Dialogs/index.php[/url]
Looks something like that. Might be wrong; I don't use Obj-C or a Mac :)
Quick question guys, how do I draw polygons in XNA?
[QUOTE=ZeekyHBomb;22001302][url=http://www.riemers.net/eng/Tutorials/XNA/Csharp/Series3/Triangle_strip.php]Triangle Strips[/url][/QUOTE]
What the fuck? I need all this shit...
[code] MyOwnVertexFormat[] vertices = new MyOwnVertexFormat[12];
vertices[0] = new MyOwnVertexFormat(new Vector3(-20, 0, 10), new Vector2(-0.25f, 25.0f));
vertices[1] = new MyOwnVertexFormat(new Vector3(-20, 0, -100), new Vector2(-0.25f, 0.0f));
vertices[2] = new MyOwnVertexFormat(new Vector3(2, 0, 10), new Vector2(0.25f, 25.0f));
vertices[3] = new MyOwnVertexFormat(new Vector3(2, 0, -100), new Vector2(0.25f, 0.0f));
vertices[4] = new MyOwnVertexFormat(new Vector3(2, 1, 10), new Vector2(0.375f, 25.0f));
vertices[5] = new MyOwnVertexFormat(new Vector3(2, 1, -100), new Vector2(0.375f, 0.0f));
vertices[6] = new MyOwnVertexFormat(new Vector3(3, 1, 10), new Vector2(0.5f, 25.0f));
vertices[7] = new MyOwnVertexFormat(new Vector3(3, 1, -100), new Vector2(0.5f, 0.0f));
vertices[8] = new MyOwnVertexFormat(new Vector3(13, 1, 10), new Vector2(0.75f, 25.0f));
vertices[9] = new MyOwnVertexFormat(new Vector3(13, 1, -100), new Vector2(0.75f, 0.0f));
vertices[10] = new MyOwnVertexFormat(new Vector3(13, 21, 10), new Vector2(1.25f, 25.0f));
vertices[11] = new MyOwnVertexFormat(new Vector3(13, 21, -100), new Vector2(1.25f, 0.0f));
vertexBuffer = new VertexBuffer(device, vertices.Length * MyOwnVertexFormat.SizeInBytes, BufferUsage.WriteOnly);
vertexBuffer.SetData(vertices);
vertexDeclaration = new VertexDeclaration(device, MyOwnVertexFormat.VertexElements);
device.DrawPrimitives(PrimitiveType.TriangleStrip, 0, 10);[/code]
...just to draw some rectangles? :eng99:
Well, for a rectangle you'll of course only need 4 vertices.
I just downloaded Visual c++ 2010 express and I want ClearType.
How can I enable ClearType?? I've searched everywhere: The msdn forum, google and things like that.
I need help.
Compwhizii it should be an AlertSheet.
[QUOTE=Dlaor;22001610]What the fuck? I need all this shit...
[code] MyOwnVertexFormat[] vertices = new MyOwnVertexFormat[12];
vertices[0] = new MyOwnVertexFormat(new Vector3(-20, 0, 10), new Vector2(-0.25f, 25.0f));
vertices[1] = new MyOwnVertexFormat(new Vector3(-20, 0, -100), new Vector2(-0.25f, 0.0f));
vertices[2] = new MyOwnVertexFormat(new Vector3(2, 0, 10), new Vector2(0.25f, 25.0f));
vertices[3] = new MyOwnVertexFormat(new Vector3(2, 0, -100), new Vector2(0.25f, 0.0f));
vertices[4] = new MyOwnVertexFormat(new Vector3(2, 1, 10), new Vector2(0.375f, 25.0f));
vertices[5] = new MyOwnVertexFormat(new Vector3(2, 1, -100), new Vector2(0.375f, 0.0f));
vertices[6] = new MyOwnVertexFormat(new Vector3(3, 1, 10), new Vector2(0.5f, 25.0f));
vertices[7] = new MyOwnVertexFormat(new Vector3(3, 1, -100), new Vector2(0.5f, 0.0f));
vertices[8] = new MyOwnVertexFormat(new Vector3(13, 1, 10), new Vector2(0.75f, 25.0f));
vertices[9] = new MyOwnVertexFormat(new Vector3(13, 1, -100), new Vector2(0.75f, 0.0f));
vertices[10] = new MyOwnVertexFormat(new Vector3(13, 21, 10), new Vector2(1.25f, 25.0f));
vertices[11] = new MyOwnVertexFormat(new Vector3(13, 21, -100), new Vector2(1.25f, 0.0f));
vertexBuffer = new VertexBuffer(device, vertices.Length * MyOwnVertexFormat.SizeInBytes, BufferUsage.WriteOnly);
vertexBuffer.SetData(vertices);
vertexDeclaration = new VertexDeclaration(device, MyOwnVertexFormat.VertexElements);
device.DrawPrimitives(PrimitiveType.TriangleStrip, 0, 10);[/code]
...just to draw some rectangles? :eng99:[/QUOTE]
You could always write a little method to add a vertex at a point you pass it, that'd be easier than those long lines of code each time you want to add a new one :P
I'm working on an FTP Program in VB.NET 2008 and I have the following lines of code that don't seem to work. They are all in my public class "ftpSession"
[code]Private clientIP As String = Nothing[/code][code] Dim dataIP As IPAddress = Dns.Resolve(clientIP), AddressList(0)
Dim dataHost As New IPEndPoint(dataIP, Int32.Parse(dataPort))[/code]With that, I seem to be getting the error "Value of type 'System.Net.IPHostEntry' cannot be converted to 'System.Net.IPAddress'" on the Dns.Resolve where I am dimensioning my dataIP object. Can anyone help me out here?
[QUOTE=compwhizii;21995692]Does anyone have an OSX development experience? I'm planning around with Obj-C and I have a question,
[img]http://grab.by/grabs/48a2a1cba0e0da9435ca1f0f3126c9b2.png[/img]
What's that called and how do I create it. :downs:
I think it's UIAlertView but I'm not entirely sure.
[editline]10:22PM[/editline]
UIAlertView is for cocoa touch.[/QUOTE]
it's called NSGiveUpNow, part of the NSMacDevSucks namespace.
[highlight](User was banned for this post ("Trolling / shitposting" - birkett))[/highlight]
[QUOTE=andersonmat;22003193]Compwhizii it should be an AlertSheet.[/QUOTE]
[QUOTE=Chris220;21999470][url]http://www.journey-of-flight.com/bh_xcode/how-to/0032_Three_Button_Confirm_Dialogs/index.php[/url]
Looks something like that. Might be wrong; I don't use Obj-C or a Mac :)[/QUOTE]
Thanks.
[QUOTE=pondefloor;22006750]it's called NSGiveUpNow, part of the NSMacDevSucks namespace.[/QUOTE]
Oh, you make me laugh! With your disgusting avatar, stupid opinions, and needless angry putdowns. You sure are a big man, and I'm sure no one messes with you!
[QUOTE=TheBoff;22007525]Oh, you make me laugh! With your disgusting avatar, stupid opinions, and needless angry putdowns. You sure are a big man, and I'm sure no one messes with you![/QUOTE]
all of my "opinions" (as you call them) are actually throughly-proven facts. i'm pretty calm, too.
[QUOTE=pondefloor;22006750]it's called NSGiveUpNow, part of the NSMacDevSucks namespace.[/QUOTE]
A throughly proven fact!
[QUOTE=TheBoff;22007525]Oh, you make me laugh! With your disgusting avatar, stupid opinions, and needless angry putdowns. You sure are a big man, and I'm sure no one messes with you![/QUOTE]
He has the balls to say what we're all thinking.
[QUOTE=layla;22008786]He has the balls to say what we're all thinking.[/QUOTE]
You don't speak for me. I'm not a dickhead, see.
We'll, I'm not doing a great job of showing it at the moment, but :/
[QUOTE=TheBoff;22008864]You don't speak for me. I'm not a dickhead, see.
We'll, I'm not doing a great job of showing it at the moment, but :/[/QUOTE]
I agree with you, but I just let him/her/them get on with it.
Responding to them is just gonna spark off another argument; no point!
^ He's got the right idea
"What do you need help with?"
[url=http://www.facepunch.com/showthread.php?t=939847]This please.[/url]
[QUOTE=Poodle;21960174]Don't listen to him, he doesn't know what he's talking about.
Playing them on separate threads is perfect, especially for multiplayer games.[/QUOTE]
Are you kidding me? A thread per sound? That's a terrible idea.
[editline]09:21AM[/editline]
A single thread for your sound engine, yes.
I need a way for APNGs to show their animation in my Java program.
[QUOTE=Chris122990;22016861]I need a way for APNGs to show their animation in my Java program.[/QUOTE]
Googled 'APNG format' and clicked the first link...
Found this [url]https://wiki.mozilla.org/APNG_Specification[/url]
It appears it contains all of the information you could possibly need to make the program read and display all of the frames.
Sorry, you need to Log In to post a reply to this thread.