Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - TheFloatingBrain

Pages: [1]
1
General / Re: Bullet positioning (updated)
« on: December 07, 2014, 06:04:14 am »
Think about the numbers and what is happening to them in a loop. It may also be good to get a good grasp on vectors and trigonometry.


Right triangle
           \
            \
             \/
             
             |\
opposite ->  | \  <-hypotenuse
             |__\
               ^
               | adjacent
 


sin - takes in an angle, and returns a ratio that can exist in the sides, if you multiply this ratio by the length of the hypotenuse, you get the length of the side, sin = opposite / hypotenuse

cos - like sin, cos takes in an angle, and returns a ratio that can exist in the sides, again, if you multiply this ratio by the length of the hypotenuse, you get the length of the side, sin = adjacent / hypotenuse

tan - opposite / adjacent

sin^-1 or asin - this does the opposite of sin, it takes in a ratio and spits out an angle in radians

cos^-1 or acos - this does the opposite of cos, it takes in a ratio and returns an angle in radians

tan^-1 or atan - the opposite of tan adjacent / opposite
 

Think of them like little programming functions.

Now think of these in a graph, and where the numbers are going, like so
f( x ) = x^2, x@1 = 1, x@2 = 4, x@3 = 9...
Then think of what you are going to do with those numbers, so think for example of what cos/sin do, then use that data in a mathematical formula, and think of that mathematical formula along a graph, and try to figure out if those numbers are what you want, or what you want to do with them, and if you are devising a formula to work well with them.

I don't know if you know trig or how good you are with math, I hope I gave you relevant advice!

Peace!

2
General / Re: **whats the problem?** Program.exe has stop working
« on: December 07, 2014, 05:50:28 am »
Hello!

    When you call
(*it)->createBullet(bulletTexture,bulletImage,shipImage);
it does not appear as though there are any elements in the array, and
(*it)
is null which is why the program might be crashing.

Let me know :-)
 - TFB

3
General / Re: SFML 1.6 On Ubuntu
« on: December 07, 2014, 01:35:50 am »
I figured it out! It was not too hard, all I did was make symbolic links for all the shared libraries like so:

Code: [Select]
Prototype:
ln -s /usr/lib/SFML/libMODULE-sfml.so.1.6 /usr/lib/SFML/libMODULE-sfml.so
Example:
ln -s /usr/lib/SFML/libgraphics-sfml.so.1.6 /usr/lib/SFML/libgraphics-sfml.so

Then I just added all the directories of /usr/lib/SFML and /usr/lib/SFML16 to ldconfig:

Code: [Select]
sudo ldconfig /usr/lib/SFML16

You have to do ldconfig every time you switch, so I added it to the script.

If you want the code I have attached the script and test code, compile with...:

Code: [Select]
g++ -std=c++11 -L /usr/lib/SFML test21.cpp -lsfml-graphics -lsfml-window -lsfml-system

and...

Code: [Select]
g++ -std=c++11 -L /usr/lib/SFML test16.cpp -lsfml-graphics -lsfml-window -lsfml-system

You can use the script if you put it in /usr/local/bin/sfml_change, and make a link to the bin folder via:

Code: [Select]
ln -s  /usr/local/bin/sfml_change/chsfml.sh /usr/bin/chsfml

So you can run it any time from the command line, to use the script...

Code: [Select]
Change to SFML 2.1:
chsfml -sfml21
Change to SFML 1.6:
chsfml -sfml16
Clean all links:
chsfml -clean
Help:
chsfml -h

Errors happen every time complaining about symbolic links, unless it does not work (test it first), ignore them.


The files should be set up like so...

Code: [Select]
SFML library files (taken OUT of the original folders i.e /usr/lib/SFML16/libgraphics-sfml.so.1.6) should go into
/usr/lib/SFML16
/usr/lib/SFML21
SFML header files should go into (taken OUT of original folders, i.e /usr/include/SFMLInclude/SFML16/Graphics.hpp):
/usr/include/SFMLInclude/SFML16
/usr/include/SFMLInclude/SFML21

I might throw this up on github, Il post a link if I do :)

I hope this helps someone! Peace! :-D

4
General / SFML 1.6 On Ubuntu
« on: December 04, 2014, 01:37:19 am »
Hello!

   Wow! It has been a while since I was here last! Whats up  ;D ? I wonder if there are any other old SFMLers here, give me a shout if you used SFML back in 2009/2010 XD ? Anyway, I decided if I may just want to port an old project to linux http://gcggames.webs.com/WSL/Site/main.html, and I also wanted to use the new release for future proejcts (or port the project over to SFML 2.1). So I made a few switch scripts to switch from SFML 2.1, and SFML 1.6 on my system:

Code: [Select]
#!/bin/bash


if [ $1 = "-h" ] || [ $1 = "--help" ]; then
echo "-h This help diolouge."
echo "-sfml16 Set up SFML 1.6"
echo "-sfml21 Set up SFML 2.1"
echo "-clean Clean all links, do not set up a SFML"
else

echo "Dont mind the clean up errors."

sudo unlink /usr/include/SFML/SFML16
sudo unlink /usr/include/SFML/SFML21
sudo unlink /usr/include/SFML


sudo unlink /usr/lib/SFML16
sudo unlink /usr/lib/SFML21
sudo unlink /usr/lib/SFML/SFML16
sudo unlink /usr/lib/SFML/SFML21
sudo unlikn /usr/lib/SFML

sudo rm /usr/include/SFML
sudo rm /usr/lib/SFML

echo "Clean up complete, starting link."

if [ $1 = "-sfml16" ]; then
sudo ln -s /usr/include/SFMLInclude/SFML16 /usr/include/SFML
sudo ln -s /usr/lib/SFML16 /usr/lib/SFML
else
if [ $1 = "-sfml21" ]; then
sudo ln -s /usr/include/SFMLInclude/SFML21 /usr/include/SFML
sudo ln -s /usr/lib/SFML21 /usr/lib/SFML
fi
fi
fi




It works fine when I am using SFML 2.1 where the library .so files are in /usr/lib/SFML21 and have a symbolic link to /usr/lib/SFML, and where the include files are in /usr/include/SFMLInclude/SFML21 with another symbolic link to /usr/include/SFML

However while the symbolic links and such work with SFML 1.6 (i.e ls /usr/lib/SFML shows the 1.6 files), the linker cant seem to find the files when I try
Code: [Select]
g++ -std=c++11 -L /usr/lib/SFML -m64 -l sfml-graphics -l sfml-window -l sfml-system test.cpp (I have tried rearranging the commands and omitting the -std=c++11 flag).

The 1.6 files are in /usr/lib/SFML16 and /usr/include/SFMLInclude/SFML16 and the symbolic links seem to work, I tried running ldcondfig but it did nothing.

Any help is appreciated!

Thanks :-)

 - TFB

Pages: [1]
anything