« first day (329 days earlier)      last day (4621 days later) » 

12:01 AM
Phew, I made it. I closed all the TVTropes tabs.
@TonyTheTiger furnitureporn.com
 
oh ghosh
so that actual pr0n or furniture pics?
 
Furniture pics.
Perfectly SFW.
 
Hello Martin
 
12:06 AM
hahah
 
Hello all
 
Do you guys randomly post stuff here? lol
 
sometimes
 
12:07 AM
This is the chat. There are no rules.
(Well, there are.)
 
esp in this room, lol
 
Ha..very cool...good to mix business with pleasure rofl
 
just while everyone remembers furniture porn site, it made me remember "spatula city" from middle/late 90's
 
I need help understanding how to calculate rotation angle
 
it's still there!
 
12:09 AM
@AlfPSteinbach Sorry, I already had my dose of geocities-style sites for the day.
 
@RMartinhoFernandes what? Links from tvtropes.tv?
 
@LewsTherin Sure, ask away.
 
Sorry to interrupt, but how does one calculate the direction vector of a sprite depending on its initial look
I almost got it working...but it is messed uo
up*
float x = sin(this->angle * PI/180.0) ;
float y =-cos(this->angle * PI/180.0) ;
 
12:13 AM
@RMartinhoFernandes Then you're not interested in The Really Big Button That Doesn't Do Anything?
 
And the confusing thing is sin works for x and cos for y
 
And what is wrong?
 
When I move up it is fine but when I move down..it moves sideways
 
@LewsTherin it's just defines a coordinate system. switch them and you get anothther.
 
@LewsTherin Up/down as in forward/backward?
 
12:15 AM
When I rotate it and press up, it goes forward in the direction it is facing normally
but when I rotate and press down, it will go down, but not in the right direction
@AL
I want to figure out the correct coordinate system
 
Unrelated: you may want to check out the newbie hints on the right to learn how to use the features of this chat thingy.
 
Alright np
 
Remind me again, are you using Allegro or XNA?
 
Allegro currently
Also when I try to do simple AI canon to player rotation
The formula .
atan2(enemyY-playerY,playerX-enemyX) doesn't work...Frustrating!
 
That will give you bad results because you have the order of enemy* and player* swapped!
 
12:22 AM
Still didn't work the other way :(
Why're you the only one replying lol :'(
 
Try atan2(playerY-enemyY,playerX-enemyX).
 
I tried man, but no luck
Must be some allegro weirdness...although I did ftofix(angle * 256/360.0f)
 
I don't think you need the manual multiplications.
Oh wait, you do.
Nevermind.
 
mmn..So what would be the problem then..atan2 returns radians yeah?
so need to convert to degrees again
 
Yes, all functions in the standard C library work with radians.
Allegro uses those crazy [0-256] units.
 
12:26 AM
Yeah, still not fully sure why...It doesn't actually say whether ftofix takes radians or degrees
 
ftofix works on any kind of value.
If you pass it radians it converts radians to fixed. If you pass it degrees it converts degrees to fixed.
ftofix(angle * 128/PI)?
 
I am just passing the return value from atan2... ftofix(angle *256/360.0f)
 
Yes, but that *256/360.0f converts from degrees to the Allegro units.
You need to convert from radians.
 
Why did you use 128 instead of 180?
 
128 AU (Allegro units) is a half circle. PI radians is also a half circle.
 
12:32 AM
yeah...
still didn't work..but some progress...missing the player by some offset.. I will try the other way
Ok so I did atan2(enemyY-playerY,enemyX-playerX)
but when I changed the angle to convert from radians to allegro units
angle * 180/PI worked...nearly..missed by a few pixels
 
That is converting from radians to degrees. That's why it misses.
You need to convert to AUs.
 
yeah but angle * 128/PI didn't work :(
 
What went wrong?
 
in fact the cannon and the player are parallel
 
Ah, found the docs on the Allegro coordinate system. I believe you need to use cos for the x axis, and -sin for the y axis.
 
12:36 AM
Really?
Didn't work though..can you please post me the link?
 
I don't think so :(
I think that just shows that y axis is other way round
Ok..can I ask. when I do float angle =0.0f
is the angle radians or degrees?
 
It's what you want it to be :)
Really.
 
ha ha I was going to ask, really?
OK assuming it was angle then was radians...when I feed it to cos I don't need to convert it again to radians...so I can do cos(angle) because what I am doing is cos(angle*PI/180)
 
If you got the cannon to be parallel with the player, it's a sign your angle is correct.
@LewsTherin Oh, that could be it.
 
12:43 AM
OK, I will just try cos(angle) then...but to convert to allegro units, I will have to change it to 128/PI
 
You don't need (nor want) to convert to Allegro units there.
You're not passing anything to an Allegro function.
You're passing it to the C library function cos, which takes radians.
 
Yeah but the return angle must be fed to rotate_sprite
so when I get the return value, would I need to convert to allegro units?
 
Yes, when calling rotate_sprite you need to convert to AU.
 
mmn...when I do angle*128/PI it goes crazy
it spins really fast
 
rotate_sprite takes a fixed. Are you converting with ftofix?
 
12:47 AM
yeah..pls a sec
Something is really wrong..
Lol, I need to sleep....Martinho will you be on msn tomorrow?
 
Maybe. A friend is coming tomorrow, so I may not be around.
 
Alright then, cool. Take care man. Thanks for helping
Have a nice day tomorrow
 
user457812
1:07 AM
Dead Island is the best therapy ever
 
6:00 AM
> gcc version 4.7.0 20110816 (experimental) [trunk revision 177785] (Debian 20110816-1)
Forgot to update my snapshot for a long time now!
Hurray! None of my code is more broken that it already was.
Hurray! They fixed something.
 
6:29 AM
hi...
 
6:42 AM
Haha GCC balloons up to to 2 GB of memory before giving me an error.
 
7:04 AM
morning :)
 
7:25 AM
hiya
 
 
1 hour later…
8:33 AM
eloo
Use it or loose it. Therefore programming today. #cs
Tony the lion
 
8:49 AM
Good time everyone!
 
how are you Tony ?
 
I'm alright, yourself?
 
Good thanks
 
0
A: Program with phreads works for some time and then stops

Tony The TigerFrom this: The pthread_cond_wait() and pthread_cond_timedwait() functions are used to block on a condition variable. They are called with mutex locked by the calling thread or undefined behaviour will result. I understand the mutex should be locked when this function is being called, fr...

I'm not very familiar with pthreads, but from the code I think he's using the con_wait function wrong
 
9:05 AM
humm
Never used pthreads, I heard that openmp is quite good and gets the job done w/o a headache and it works on win as well as on unix.
 
oh ccool
 
Finally found what I was looking for codeproject.com/KB/stl/boostsmartptr.aspx
 
9:29 AM
Where do I need to write inline? Header or impl?
 
in the header
inline functions are declared and defined in the header
 
ah now I remember that's why I have files like
ParticleDataI.h
 
10:10 AM
My GLUT display callback function needs access to some resources. What is the way to access them w/o declaring them globally?
The callback is defined as a function with no arguments
 
10:26 AM
You can wrap parameterized functions to get a non-parameterized function by binding. (e.g. boost::bind)
Not sure if that's applicable in your case, though.
 
if it's a function pointer
then you can't, and it's time to get a new library
 
@DeadMG If I were ever to write my own C++ library and I wanted to support both function pointers and functors, then I had to use templates, right?
 
or std::function
 
@Nils The general way to do that is to use a map (which could be a hash table) to associate your callback with a C++ object. Then let the callback call a method on the C++ object. The object gives the further association to arbitrary (member) data.
@Nils If there can only ever be one callback then it's no problem. The association is then fixed at compile time. E.g., that the callback has a static data member.
 
10:51 AM
@DeadMG Time to get a new lib, like what?
 
I believe there's SFML which would suck less
 
humm nah I want GLUT it is preinstalled on my mac and works on win as well
@AlfPSteinbach so I just pass a pointer to a method from an object holding the resources?
how do I call it.. GLUTResources?
humm
 
 
1 hour later…
11:59 AM
@AlfPSteinbach I don't know exactly what you mean the function pointer to a method of return type void (w/o any arguments) will differ from that for just a function.
 
12:18 PM
what does proxy class means?
 
12:33 PM
@Nils Could you provide a quote of what you don't know exactly what means?
 
"use a map (which could be a hash table) to associate your callback with a C++ object"
 
hiya all, xD I finally managed to understand how the allegro works. It was just a matter of scaling the angle.. And I also got the the canon to track the player once I understood that..
But what I still don't understand is the player cos and sin properties
the formula to calculate new x and y velocity/direction changes depending on the way the head of the ship is drawn...it is confusing...:(
For example. I had the bitmap initially at the angle of 0 degrees...
But the ships mouth was facing up at 0 degrees...and because of that the formula to calculate direction vector was screwed
I managed to hazard a guess...then I tried another experiment..Make the ships heading face 0 degrees..the formula changed again! I had to make sin and cos negative to go down and positive to move up
It doesn't make sense... Why is it happening
 
@Nils Well, that's the general method. The main scenario is when the callback has an argument such as a window handle, that can be associated with a C++ object. But when there are no arguments it can be possible to associate the C++ object with the function itself (i.e. using function address as key), where the main idea then is to have a large number of identical functions, and choosing a unique such function for each object you need callback functionality for.
But also note, as I wrote, that it may be that no such association is needed. E.g., that you may simply use a static local variable in the function. Or in an anonymous namespace (or whatever).
I haven't used GLUT so I don't know about the details of your scenario.
Historically, Borland's ObjectWindows framework for Turbo/Borland Pascal, and possibly also the version for C++, used the associate-with-function-address idea. It generated the function stubs dynamically :-). I guess, today you will get both the OS and the anti-virus going ape if you try that, but it was very nice, and very efficient (like, maximally efficient).
 
12:54 PM
Well the problem with GLUT is basically that opengl.org/resources/libraries/glut/spec3/node46.html needs to access resources, of course you can use globals, but that's ugly
 
oh. it helps with details, yes. all you need to do is let your function find the current window, and delegate to that object.
i.e., in your callback, call glutGetWindow.
 
what does proxy class means?
 
@MrAnubis A proxy object represents some other object or thingy. For example, for a matrix class you may let operator[] return a proxy object, an object that represents a row of the matrix. Then operator[] on this proxy may return a reference to a given element in the row. Or, perhaps a proxy for that element! :-)
 
hmm.. any other good example sir?
 
@MrAnubis Well, for example, in Windows you can create a COM object that really resides on another machine. Then what you get is not a pointer to that object (which is impossible). You get a pointer to a proxy on the local machine, where that proxy communicates via network with the real object on the other machine. This is a very special kind of proxy, one that pretends to directly be the object it represents. I think there's a special name for it, but I forget, sorry.
 
1:07 PM
Thanks for quick help
@AlfPSteinbach : why does it happens that sometimes i am even unable to understand my own code?
and keep thinking about it
 
@MrAnubis This is a very philosophical question, on the question of personal identity. The short of it is, the "you" as of now is not the "you" as of 1 second ago. You're changing, all the time, and without any change you'd be dead or in stasis. So one aspect is how much you can change without losing identity. And another aspect is the short term fluctuations in what you find easy to remember or not. Which is context-dependent. I like "time flies like the wind, fruit flies like a banana"
 
2:19 PM
humm now I get a strange linker error and don't know why
 
2:33 PM
@AlfPSteinbach Damn you, now I want pizza.
 
hai nubs
 
hey, that's my line
imitation is the sincerest form of flattery, but I prefer to remain as unique as I am
 
lol, I knew I'd provoke a reaction if I said that :P
so how did the exam go?
 
well
it was even worse than "memorize the rotation matrix formula"
I had to try and prove the rotation matrix formula
 
oh
and you failed at doing that?
 
2:37 PM
and manually multiply matrices together and similarly utterly worthless things
eh, I think I succeeded
 
oh ghosh
 
or at least a little
 
well, that's good
lol
 
humm my glutstuff seems to run in gdb, but not without it
heh paper and pencil
 
what an utter waste of mytime
it would be better spent pondering the colour of my bicycle shed
 
2:42 PM
humm paper and pencil is good for proving, learning to understand things and maintain a nice handwriting :)
 
a nice handwriting is useless
I'll never handwrite a single line of useful code
and I can already understand the concept of multiplication
 
nah it is not
drawing for example is much quicker when using a pencil
and if you do geometric stuff illustrating your math on paper will help
 
I have no need of drawing
but if I did, then I would do it on a whiteboard with a pen
where you don't have to spend eternity sharpening things
more importantly, proving things is for the theoreticians, and I am not one of those
 
oh yea, theory
meh, it's interesting only when it serves a practical purpose
 
well the best professors / teachers I had could do all the stuff on a whiteboard
some of them were also quite good at programming
 
2:51 PM
programs solve problems
theories don't until someone makes it into a program
 
Als
hmm saturday
 
ohla
what you doing on this saturday?
 
Als
Just reading some stuff..Templates the complete guide by Nicolai Josutils
I truly suck at templates :(
 
everybody does
 
hehe, yea, me too
 
Als
2:56 PM
Actually, my problem is partially because I do not get to use it in day to day work.
 
oh yea, it helps if you use things a lot
you get used to it faster
 
Als
Given that<no usage in day to day work>its difficult, and templates is a beast you need to wrestle with regularly to get a hang of it.
 
My approach to templates: Avoid them until it really makes sense to use them.
 
templates can be really useful in quite a few things though
 
Als
Exactly
 

« first day (329 days earlier)      last day (4621 days later) »