FireNet 64 Posting Whiz in Training

You use simple vectors. You can rotate vectors with minimal calculations.

So when the ball hits the paddle, based on the distance from the center, rotate the directional vector of the ball by a certain amount of degrees.

http://chortle.ccsu.edu/VectorLessons/vectorIndex.html

The above link contains a pretty good coverage of vector math. Vectors are very simple to use and make thing very easy once you get the hang of them.

Try them out. :), come back if your run into trouble or if you figure it out post your discoveries here ;)

Maidomax commented: Yep, that's about it! +2
FireNet 64 Posting Whiz in Training

First ... use code tags to highlight your code...

[*code]
[*/code]

(without the *)

Also dumping the whole file into your post does not really help... where's line 376... one's going count the lines....


P.S Check this post:
http://www.daniweb.com/forums/thread72874.html

nav33n commented: lol.. yeah.. I do that in free time ! I am returning your reputation as a token of gratitude! lol.. +1
FireNet 64 Posting Whiz in Training

Most of the resources mentioned here are a bit advanced , used for 3D games, and requires quite a bit of reading to actually use in a game.

Here are a few libraries that should hopefully help in making simple games, with a much lower learning curve.

What do games need?
Graphics -> something draw on the screen, primitives (lines,circles,quads) and textures (pictures)
Sound -> bangs and bams, background music to make the game come alive.
Input -> To let the user actually interact with the game

So here are some simple libs which can help you with the above:

Frame Buffer: http://www.pixeltoaster.com/
Something to draw on. For beginners, it's recommended you use fairly low-level APIs and do things yourself. This should help you get a buffer to draw on and to learn some rendering techniques (and to develop a greater appreciation for the reasons why somethings are the way they are)

Rendering: http://freeglut.sourceforge.net/
Once you've learned to draw, you can let an API do it for you. Freeglut is pretty hand for that and can do wonders to simplify OpenGL initialization and rendering across various platforms.

Image Loader: http://corona.sourceforge.net/
Every game needs it's art. This lib makes loading images in a variety of formats easy. It can be used with any application. It just loads the image from file into a buffer in any mode(eg RGB).

Sound: http://audiere.sourceforge.net/
Open Source …

~s.o.s~ commented: Nice one. +20
FireNet 64 Posting Whiz in Training
Graphics In Pixel
				     Part II B
			  'Realization of an Enigma'

Introduction
------------
Life's unfair, writing good tutorials take a lot of time, not typing it, but thinking up
the content does. Life's fun too, I had quite a good time learning new stuff. My hobby
at present is learning rasterization techniques. It's quite fun, but learning how the
things are done, is best done mathematically. The best part I love about algebra is the
way in which one proves something - make an assumption then derive something and
using the derivation prove the assumption was right.

Anyway rasterization is an approximation of reality. A raster is the medium used to
represent, in our case, the primitive (i.e. line, circle etc).This is usually, on computers,
a grid of square pixels.

Date:29/10/2004

Graphics Output
---------------
This series goes in for Mode13h (which is a very ancient mode) and DOS based. If you
can get this working then well and good. Incase you are unable then there is GCL which
stands for GDI Console Layer. It provides you a linear frame buffer just like mode13h but
uses windows gdi for output,=> win32 mode13h. You will be able to use the code given here
without any problem. Also If enough people ask for it, I will start providing GCL based code
too.

Razterization of a Circle
-----------------------
Razterization is a big …

alc6379 commented: excellent tutorial! +4
FireNet 64 Posting Whiz in Training

Look in the tutorial forum at dani too ;) and google

FireNet 64 Posting Whiz in Training

The Brain - the one and only

FireNet 64 Posting Whiz in Training

const is short for constant.An constant must be initialised when it is declared and it cannot be changed.

In a class you cannot declare a member as datatype data_var = some_value since it's against standards and each object of that class has a sperate space in mem to store all it's members.

when a member is declared as static, all the objects of the class share this value and you can assign a value as static datatype data_var = some_value as you cannot do that in the constuctor as when an object is initialised this value will get overwriten.So we are allowed to do it within the class.

Helps?

p.s: look up on constructors

FireNet 64 Posting Whiz in Training

FrozenICE.cpp to BurningHell.cpp

Hey,what else did you expect anyway.Cool depend on you.;)

FireNet 64 Posting Whiz in Training

Quite simple really,just open word.txt with ios::app (append) added to the options when opening the file.That will automaticaly put the file pointer to the end of the file and you can just write to it normally.

Another way is to open the file and use filehandle.seekp(0,ios::end); to move the pointer to the end of the file and then write the output you want to the file and it will still be at the end.

Checks the tut for the list of options,I covered them there.

Btw,then close the file when you exit or are finished with using it.There you go a new word was added to the file.

FireNet 64 Posting Whiz in Training

Hello, my name is kerry and i just sign up .Well, my question is how do reverse a number input by user using recersive function.Thanks for the help.

You mean recursive funtion.The concept is quite simple.You take a number (to be reversed) and divide it by 10 and add the remainder to another number.As every loop goes by you multiply 10 to the other number and keep adding the remainders till you get 0.

Check this out

int n=12345,m=0;
cout<<"Orginal No:"<<n;
while(n>0)
{
    m *= 10;
    m += n%10;
    n /= 10;
}

cout<<"\nRevesed No:"<<m;
FireNet 64 Posting Whiz in Training

*Yawn*, me too.Who cares ???.We will have to use what ever the policy making companies shove at us.Yup it's quite too the OpenSource is only open before money comes in.It's like water,can dissolve anything given enough time.Brrr

<b>Resistance is futile.</b>

Nah......,You can do that till you are dead :D,and even then you can leave followers to do your work.

So after you are gone,what do you care :D .

FireNet 64 Posting Whiz in Training

Now this is a bit OS specific when it comes to raw packet sending.I really dont know if you can manually control ARP packets on a Windows PC (XP,2000,NT [you dont even get raw packet access on other windows vers]).

You can find *nix code easily on the net.(try send_arp.c).

Using Windows XP,eh?

FireNet 64 Posting Whiz in Training

How am I supposed to know what you can do?(Just kidding)

Yes you can in C, C++ and ASM.(ok some other languages also).Do a few searches on http://www.google.com/
You will find something.

Slade commented: couldn't have given a better answer, idiots need to search google first +36
FireNet 64 Posting Whiz in Training

Not really.
If you are using a header with a static library you should try getting the latest version of the static library.

Otherwise if you have link errors is you own programs it maybe because you declared a funtion and forgot to define it.Check for these and fix them.

Link error occur when the linker cant find the modules(funtions,externs) the compiler reffers.

FireNet 64 Posting Whiz in Training

You are most welcome.Now there is a full tut on file i/o in the C++ tutorial section :-)

FireNet 64 Posting Whiz in Training
File I/O
With C++ Fstream

Intro

File handling is as simple as writing in a book, much easier to modify and
find. It's so simple people get confused with it :-). Welcome to the world of file handling.

We will use the c++ fstream classes to do our file handling. So, what is a file? A file is just a bunch of bytes stored on a hardisk. Some have a specific structure others dont. Files are used to save info so that it can be retrived later for use. [I dont think you will want to save 100 people's address in memory will you].

Types of Files

Actually there are only two. Text files and binary files. In text files data is stored as readable chars and binary file are in machine language. So if you output abc123 to a text file you will see abc123 but in a binary file you may see only a bunch of black blocks if you use notepad. The binary files are smaller in size.

Fstream.h

fstream.h provides simultaneous input and output through ifstream, ofstream and fstream.

ifstream       - open the file for input
ofstream       - open the file for output
fstream       - open the file for input/output/both

Writing to a file

Relatively very simple.

Steps:

  • Declare an ofstream var.
  • Open a file with it.
  • Write to the file (there are a couple of ways.)
  • Close it.

Eg Program 1.1

#include <fstream.h>

void main
{
    ofstream file;

    file.open("file.txt");      //open a file …
N3wbi3C0d3r commented: GREAT JOB, KEEP EM COMIN +1
sharunkumar commented: Thanks a lot! Really needed something like this! :D +0
FireNet 64 Posting Whiz in Training

My God I even had a comp science teacher ask me this.Arrrg one will go mad.

It's simple.Cut a few funtions out of you code and paste them in a file with a .h extension and call #include "your_header_name.h" to include that.

Note: not < > but " " if it's in the current directory else you have to supply the full or relative path.

All the rules are same as normal C++ syntax.

----------------------------------------------
That was very simple thing.Headers can be used for more things.They can just contain funtions declarations without definitions.In that case it will be used to link to a static library.

Eg.Make a header file with 2 funtion declarations like fun1(); fun2(); only
Include it with a cpp file and call the funtions and compile.

You will get no errors on compile but on linking you will see an error similar to the following:

undefined module fun1() refferenced from Module main.cpp
undefined module fun2() refferenced from Module main.cpp

I hope you understand a header in not really diffrent from a cpp file.Btw you can also include .cpp files.

Eg: #include "wow.cpp"

FireNet 64 Posting Whiz in Training

Dir.h is probably what you want if you use C++

int chdir(char *path);

use it like chdir("c:\windows");

FireNet 64 Posting Whiz in Training
FireNet 64 Posting Whiz in Training

Yup, C++ is the best to start out of the langs you mentioned. try www.google.com and search for tutorials.

If you have no experiance what so ever QBASIC is also somewhere to start.

For C++ you will need a complier and the best free easy one for a new user would be DevC++

www.bloodshed.net/dev/devcpp.html

FireNet 64 Posting Whiz in Training

I would suggesst you first learn structures,classes and file i/o before trying games.You will just be frustrated and end up failing if you jump into games too soo.

Try www.google.com and search for c++ tutorials.