• What Do You Need Help With? V6
    7,544 replies, posted
Well I got it to rotate about a fixed point, still no luck with removing the trails [code]position_on_screen = (60,60) tank_turret_rotated = pygame.transform.rotate(tank_turret, turret_angle) turret_rect = tank_turret_rotated.get_rect() turret_rect.center = position_on_screen main_map.blit(tank_turret_rotated, turret_rect) screen.blit(main_map, (0,0)) pygame.display.flip()[/code] my automerge :c [editline]23rd June 2013[/editline] [QUOTE=ZeekyHBomb;41155576]blit both surfaces to the screen.[/QUOTE] oh god damn, thanks, it worked :v: didn't realize it was so simple
I'm having a problem loading materials with Assimp. I have the same model in two different formats: .obj and .smd. When I load the .obj file, it says it has found 6 textures. When I load the .smd file, it says it has found 5 textures. Now when I check the texture type (should be diffuse), .obj says it has found zero. There should be more. When I check the texture type in .smd it says it has found one. Again, there should be more. What could be causing this? Is there any way to get the texture from Assimp manually, or at least find out what texture type each material has?
Hey, so I'm a novice when it comes to python but I'm making a script to find tweets with a specific key word, "click" (a.k.a. find url, and open) a link in the tweet, and add an item to the cart (the link leads to a store). My first question is how can I tell Python to find a specific url for the desired tweet? I've already make Python find a tweet based on words it contains, but because I have no way of knowing the exact URL, how can I tell Python to go to the link? Thanks in advance
For the first time ever I'm going to do multiplayer in game. How it should work in client-server architecture? Clients should be sending key inputs to the server, and server returns positions, and all that stuff? Something like that?
[QUOTE=Sonic96PL;41162140]For the first time ever I'm going to do multiplayer in game. How it should work in client-server architecture? Clients should be sending key inputs to the server, and server returns positions, and all that stuff? Something like that?[/QUOTE] [url]http://gafferongames.com/networking-for-game-programmers/[/url] [url]https://developer.valvesoftware.com/wiki/Source_Multiplayer_Networking[/url] It depends on how you want to do it. Look up the Quake 3 and Tribes network models, they're pretty good.
Thank you. That's what I need.
I am trying to make my openGL program multi-class. Right now, I am having issues drawing even simple triangles. This is my code to draw them: [cpp]for(auto i : entities){ glBindBuffer( GL_ARRAY_BUFFER, i.first); glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, i.second); glDrawElements( GL_TRIANGLES,6, GL_UNSIGNED_INT,0); }[/cpp] I know it is using a static number, 6, because I am only using 6 elements right now. I'm not sure if this is how you are supposed to do openGL stuff, so I have a vector with VBOs and EBOs, which are tied together as one is connected to the other (these are the models). Is this right? The way I am loading the vertices and elements is this: [cpp]GLuint nvbo, nebo; glGenBuffers(1, &nvbo); glBindBuffer( GL_ARRAY_BUFFER, nvbo ); glBufferData( GL_ARRAY_BUFFER, sizeof(float) * vertnum, vertices, GL_STATIC_DRAW ); glGenBuffers(1, &nebo); glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, nebo); glBufferData( GL_ELEMENT_ARRAY_BUFFER, sizeof(GLuint) * elemnum, elements, GL_STATIC_DRAW); entities.push_back(GLuintPair(nvbo, nebo));[/cpp] Any idea what is going wrong? It's an access violation, so I am thinking the data is being loaded wrong.
What kind of variable is 'vertices' and 'elements'? [editline]24th June 2013[/editline] For my glBufferData I have [cpp]glBufferData (GL_ARRAY_BUFFER, vertices.size() * sizeof (glm::vec3), &vertices[0], GL_STATIC_DRAW);[/cpp] vertices is a vector of vec3's.
They are arrays of float and GLuint respectively. I tried using vectors, as you have, but to no avail. The array buffer stores both position and colour, if that matters. I changed the order of adding the vertices and generating the program, and it works now. Why do you have to bind buffers then generate program? Nevermind, realized that it's just binding the vertex attrib pointers. Thanks for the help.
[img]https://dl.dropboxusercontent.com/u/646325/phantomscrollbar.PNG[/img] Does anyone know why this tends to happen in .Net 4.0? I'm using AutoScroll, and it seems to happen if a scrollbar isn't in its uppermost position when it doesn't need to be scrollable anymore. The scrollbar in the screenshot isn't real and can't be interacted with. This happens on all Windows 7 machines I've tried and not on XP.
If I have a class within a class, would this: [cpp]class Foo{ }bar;[/cpp] be the same as this? [cpp]class Foo{ }; Foo bar;[/cpp]
Yes. If we're talking C++ at least. Also would be the case in a non-nested class.
[QUOTE=Barri167;41180060][img]https://dl.dropboxusercontent.com/u/646325/phantomscrollbar.PNG[/img] Does anyone know why this tends to happen in .Net 4.0? I'm using AutoScroll, and it seems to happen if a scrollbar isn't in its uppermost position when it doesn't need to be scrollable anymore. The scrollbar in the screenshot isn't real and can't be interacted with. This happens on all Windows 7 machines I've tried and not on XP.[/QUOTE] Are the headers/labels in a scrolling container or did you just put a scroll bar on the main level and scroll the content manually?
-snip
snip
-snip-
[QUOTE=Tamschi;41181121]Are the headers/labels in a scrolling container or did you just put a scroll bar on the main level and scroll the content manually?[/QUOTE] All of the headers and labels are on a panel which has autoscroll set to true. I'll probably end up adding a scrollbar and moving the content manually unless someone knows why this happens. But this isn't the first time I've run into this bug(?)
-snip- Nevermind, done.
I have somehow messed up eclipse so that the Java perspective doesn't open automatically on launch (when it used to), and there is a perspective selector I swear was not there before I can't get rid of. [IMG]http://i.imgur.com/62e0rRG.png[/IMG] [editline]26th June 2013[/editline] Nevermind, fixed it. I just had to close all perspectives.
I am not sure if I should post this here, forgive me if I post it in the wrong section... But, [url]http://www.cprogramming.com/c++book/?inl=nua[/url] is this a good book to get? I want to learn programming from 0, and I need a place where it explains all the functions and whatnot, thanks in advance.
Figure I might as well post this here as well. I'm having some issues P/Invoking (C#/native interop) a library on Linux x86_64, I think it's using the wrong calling convention because my parameters are placed backwards on the stack. Any help would be appreciated: [url]http://stackoverflow.com/q/17331418/1122135[/url]
New to C#(first actual language I'm trying to learn), following the HeadFirst C# book, and I'm stuck on this exercise. [code] private void button1_Click(object sender, EventArgs e) { if (checkBox1.Checked == true) { label1.BackColor = Color.Red; { if (label1.BackColor == Color.Blue == true) { label1.BackColor = Color.Red; } } } else { MessageBox.Show(" The box is not checked. "); } } } }[/code] I can get it to change from Blue to Red, but not vice-versa. Any advice?
[QUOTE=LtKyle2;41202861]New to C#(first actual language I'm trying to learn), following the HeadFirst C# book, and I'm stuck on this exercise. [code] private void button1_Click(object sender, EventArgs e) { if (checkBox1.Checked) { if (label1.BackColor == Color.Blue) { label1.BackColor = Color.Red; } else { label1.BackColor = Color.Blue; } } else { MessageBox.Show(" The box is not checked. "); } }[/code] I can get it to change from Blue to Red, but not vice-versa. Any advice?[/QUOTE] You don't have to do '== true' because an if statement is if(this is true) { do this } This should probably work. Also you might want to capitalize your colors (Color.BLUE, it isn't necessary though), as it's considered best practice to capitalize constants (unless I'm mistaken and this is only true for Java).
First, you don't need "== true" in any of your if statements. They're redundant. Second, align your brackets and remove the set on lines 6 and 11. Technically they're valid, but they're misleading, you'll always enter them since "label1.BackColor = Color.Red;" isn't any sort of condition or loop. Third, there's nowhere that you're setting label1.BackColor back to Color.Blue. Think about what conditions have to be met for you to change the color to Blue. [QUOTE=mobrockers;41203130]Also you might want to capitalize your colors (Color.BLUE, it isn't necessary though), as it's considered best practice to capitalize constants (unless I'm mistaken and this is only true for Java).[/QUOTE] Nope, the Color class ([url=http://msdn.microsoft.com/en-us/library/system.drawing.color.aspx]System.Drawing.Color[/url]) is part of the BCL and all the colors are defined as static properties (because "const" in C# is restricted to a handful of built-in types like int, byte, string, etc.). C# style best practice is different than Java's, nothing is ever supposed to be in all caps.
[QUOTE=LtKyle2;41202861]New to C#(first actual language I'm trying to learn), following the HeadFirst C# book, and I'm stuck on this exercise. I can get it to change from Blue to Red, but not vice-versa. Any advice?[/QUOTE] I'll give you an example. Assuming you want it to toggle it should be something like this. [code] { if (label1.BackColor == Color.Blue) { label1.BackColor = Color.Red; // if blue change to red. } else if(label1.BackColor == Color.Red) { label1.BackColor = Color.Blue; // if red change to blue. } else { //It was neither red or blue, set it to a default color or something. { } [/code] [editline]27th June 2013[/editline] [QUOTE=mobrockers;41203130] Also you might want to capitalize your colors (Color.BLUE, it isn't necessary though), as it's considered best practice to capitalize constants (unless I'm mistaken and this is only true for Java).[/QUOTE] Yeah it's java, don't capitalize the colors, I'm pretty sure that would break it.
Yay for making invalid assumptions :v:
the code I posted was what I copied before having another whack at it before posting. my bad. [QUOTE=reevezy67;41203208]I'll give you an example. Assuming you want it to toggle it should be something like this. [code] { if (label1.BackColor == Color.Blue) { label1.BackColor = Color.Red; // if blue change to red. } else if(label1.BackColor == Color.Red) { label1.BackColor = Color.Blue; // if red change to blue. } else { //It was neither red or blue, set it to a default color or something. { } [/code][/QUOTE] Thanks! Can't believe I missed something so simple. :/
-oops wrong thread-
[QUOTE=EpikMonster;41199993]I am not sure if I should post this here, forgive me if I post it in the wrong section... But, [url]http://www.cprogramming.com/c++book/?inl=nua[/url] is this a good book to get? I want to learn programming from 0, and I need a place where it explains all the functions and whatnot, thanks in advance.[/QUOTE] anyone .. ?
[QUOTE=robmaister12;41202549]Figure I might as well post this here as well. I'm having some issues P/Invoking (C#/native interop) a library on Linux x86_64, I think it's using the wrong calling convention because my parameters are placed backwards on the stack. Any help would be appreciated: [url]http://stackoverflow.com/q/17331418/1122135[/url][/QUOTE] According to [url=http://www.mono-project.com/Interop_with_Native_Libraries#Invoking_Unmanaged_Code]this page[/url] the default calling convention on Linux is cdecl, and that should be correct. The library could be set to use another calling convention via compiler flag, but I think that's unlikely since interfacing with it in C would also not be straight forward. As a workaround you could reverse the order of parameters in the declaration, but I don't know how you'd fix the actual problem. You could perhaps try to ask in the CritterAI community if anyone has already interfaced with the lib in a .NET language. [editline]27th June 2013[/editline] [QUOTE=EpikMonster;41207483]anyone .. ?[/QUOTE] That book seemed to have been released just two months ago. I guess not many people have taken a look at it yet. I thought Learn C++ in 21 Days (newer revisions go by a slightly different title) was a good one, some others on this forum have made positive comments about Accelerated C++. Effective C++ by Scott Meyers is a good intermediate book, I definitively recommend to read it after you can write some C++.
Sorry, you need to Log In to post a reply to this thread.