Sign in to follow this  
Carolina

Greetings and questions^_^

Recommended Posts

Hi there!My name is Carol and I´m new to Gamedev.My original language is NOT English,so excuse me if I make spelling mistakes and things like that.^^ I use Dev-C++ as IDE and I´d like to know how can I do 2 things: 1.Change background and word colors on a DOS console app.Because I´ve tried using conio.h,conio.c,used functions like textcolor(BLACK) and textbackground(WHITE),but,firstly,the output colors are never the ones I want,and secondly,I want to paint the whole background,and not only the text background.What should I use? 2.How can I detect the arrow keys and/or the mouse?It seems there´s a function for that in conio.h,but I understand nothing of it XD Any suggestions for where I should look up for answers are accepted. Thanks in advance ^^

Share this post


Link to post
Share on other sites
Hello and welcome to gamedev!

Well, it looks like you are writing console applications, which is a good start for new people. Unfortunatly, many things in conio.h have been depreciated under windows, cause it was originaly a borland dos library.

I suggest you start here.

MSDN is chock full of info.

Good luck and enjoy your stay!

Share this post


Link to post
Share on other sites
Thanks!I´ve taken a look at some functions at MSDN and it seems really an excellent source.Well,but the problem is,I can´t keep programming my TicTacToe game right now because I have to implement an algorithm called the Dijkstra´s Algorithm.It is something about graphs,and it should be done in C.The problem is:I know nothing about graphs,I´m in my first semester of Computer Engineering course and my professor is nuts...Any suggestions?XD

Share this post


Link to post
Share on other sites
Here's an overview:

http://www.math.niu.edu/~rusin/known-math/index/05CXX.html

Basically the idea of a graph is like a bunch of cities connected by roads. Say that there are some cites: Alonso, Beta, Condoro, Divitria, Erba, Fang, and Guluk. There's a couple ways to 'connect' these cities in code. The simpliest, if I remember, is just a matrix, although it takes up extra space. I know there are other implementations hopefully someone else will talk about them... Anyway say that:

Alonso is connected to Beta, Divitria, and Guluk.
Beta is connected to Alonso, Condoro, and Erba
Condoro is connected to Beta, Divitria, Erba, Fang and Guluk
Divitria is connected to Alonso, Condoro, and Guluk
Erba is connected to Beta, Condoro, and Fang
Fang is connected to Condoro, Erba, and Guluk
Guluk is connected to Alonso, Condoro, Divitria, and Fang

In compact matrix form:

Beta Condoro Divitria Erba Fang Guluk
Alonso 1 0 1 0 0 1
Guluk 0 1 1 0 1
Fang 0 1 0 1
Erba 1 1 0
Divitria 0 1
Condoro 1


I believe there's also a way using linked lists. Of course there are weighted graphs as well where instead of putting just a 1 when there was a connection you'd put for example the distance between the cities. I could be very wrong on some points, it's been like 2 years since I thought of this stuff. I just showed how to store it... I'd imagine that there would be a way to add a city with no roads and then have a way to specify what cities are connected to the new one. well I just hope that gave you a little bit to think on.

Share this post


Link to post
Share on other sites
Well thanks,I managed to do it.Graphs don´t seem so difficult...But what´s the difference between graphs implementation using structs(or classes) and usual unidimensional arrays?Is it efficiency or people like to complicate it(because the usage of structs seemed unnecessary to me)?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this