Recent content by Peter P.
-
P
C/C++ How Can I Determine the Collided Side in C++ Collision Detection?
Yes, all the sides are either vertical or horizontal. And I just thought about using the vertices to check which side collided in the shower last night as well. :) Thanks for the idea of using bits that correspond to different sides and changing them to represent which side collided with...- Peter P.
- Post #4
- Forum: Programming and Computer Science
-
P
C/C++ How Can I Determine the Collided Side in C++ Collision Detection?
My problem is not so much with programming it, but rather determining which side is collided. And for those who aren't familiar with SDL, SDL_Rect is just a structure that hold an x and y position along with a width and height ( (x,y) is the top left corner of the rectangle). So here is how...- Peter P.
- Thread
- C++ Collision Detection
- Replies: 3
- Forum: Programming and Computer Science
-
P
C/C++ Why Does g++ Require -fpermissive for Default Arguments in Some Cases?
Ah, thanks for the help. It was the double declaration problem. I never know that you only had to specify default parameters in function prototypes and not the actual definition.- Peter P.
- Post #4
- Forum: Programming and Computer Science
-
P
C/C++ Why Does g++ Require -fpermissive for Default Arguments in Some Cases?
I started using g++ and the command line on linux. In one section of my code, I provide a default argument for a function parameter. I'm just wondering why this sometimes brings up an error if i don't include -fpermissive when I'm compiling everything. As an example. This is the...- Peter P.
- Thread
- Compiler Issues
- Replies: 4
- Forum: Programming and Computer Science
-
P
C/C++ Creating 2D Vectors in C++: A Quick Guide
I decided to make the switch from C to C++ and I'm having trouble with vectors. In C, I prefer to use dynamically allocated arrays when doing multidimensional arrays. But in C++, I know that there is the new function which replaced malloc. I read that when dealing with multidimensional arrays in...- Peter P.
- Thread
- 2d Vectors
- Replies: 1
- Forum: Programming and Computer Science
-
P
How Is Velocity Calculated in a Pulley System with Friction?
Using T for the kinetic energy is the convention used by my professor and i agree that it was odd when i first saw it as well. Second, i completely forgot about the tension, which only confuses me ever so more in how i need to incorporate it into the equation. I am thinking it depends on mB.- Peter P.
- Post #3
- Forum: Introductory Physics Homework Help
-
P
Principle of Work and Energy: Spring and Mass
Homework Statement When the 65-kg cylinder is released from rest, the spring is subjected to a tension of 75. Determine the speed of the cylinder after it has fallen 300. How far has it fallen when it momentarily stops? Given Diagram: Homework Equations The Attempt at a...- Peter P.
- Thread
- Energy Mass Principle Spring Work Work and energy
- Replies: 1
- Forum: Introductory Physics Homework Help
-
P
How Is Velocity Calculated in a Pulley System with Friction?
Homework Statement Determine the velocity of the 60- block A if the two blocks are released from rest and the 40- block B moves 0.6 up the in cline. The coefficient of kinetic friction between both blocks and the inclined planes is = 0.05. Here is the given diagram: The Attempt at a...- Peter P.
- Thread
- Energy Principle Work Work and energy
- Replies: 3
- Forum: Introductory Physics Homework Help
-
P
C: 2D arrays with structs and pointers
Yes, it's working. Thanks for the help.- Peter P.
- Post #7
- Forum: Programming and Computer Science
-
P
C: 2D arrays with structs and pointers
So, if I get what you are saying, would I change this: charLoc [i] = (int *) malloc (NUM_COLS * sizeof (CharPointers)); to this: charLoc [i] = (int *) malloc (NUM_COLS * sizeof (CharPointers *)); and if the above is correct, do you know what I would need to change to make this...- Peter P.
- Post #5
- Forum: Programming and Computer Science
-
P
C: 2D arrays with structs and pointers
But how would i use that in this context? I know that i can do that for when I'm going from pointers to structs, but what would I do for the from an int array to a pointer part?- Peter P.
- Post #3
- Forum: Programming and Computer Science
-
P
C: 2D arrays with structs and pointers
I wanted to make a variant on having a player just walking around a small 2d map. Instead of having 2 variables to store the current x and y values of the player position in a certain array, I want to make a 2d array that is filled with NULL pointers. Then the player would be represented as a...- Peter P.
- Thread
- 2d Arrays Pointers
- Replies: 6
- Forum: Programming and Computer Science
-
P
C Programming: Getting Input Without Enter Key
Thanks for the reply. Also, i was looking through the non-standard libraries that the compiler i use has, and noticed conio.h, i was wondering whether it would be better to just stick with conio or use curses? and if anyone would suggest curses, can you possibly tell me how to set it up? i use...- Peter P.
- Post #3
- Forum: Programming and Computer Science
-
P
C Programming: Getting Input Without Enter Key
im looking for functions that do not require the user to press enter. such as, they press "a" and the program continues, instead of something like "a[enter]" when using scanf.- Peter P.
- Thread
- Input
- Replies: 3
- Forum: Programming and Computer Science
-
P
For Loop Conditions in C: How Do You Combine Multiple Conditions?
i know that it is possible to have multiple conditions in a for loop. but is it separated by a comma or would it be separated by && like in an if statement? Thanks- Peter P.
- Thread
- Conditions Loop
- Replies: 1
- Forum: Programming and Computer Science