Saturday, 30 November 2013

Super Mario wears a hat because his creator, Shigeru Miyamoto, had trouble drawing hair.

Friday, 29 November 2013

The most intelligent invertebrates

Octopus and squid are thought to be the most intelligent of all invertebrates.
Losing one night of sleep will impair reasoning and brain function for four days.

Humans actually have 15 senses

Humans actually have 15 other senses which include things like balance, temperature, internal senses for suffocation, thirst and fullness.

Wednesday, 27 November 2013

Amazing Tricks to Speedup Your Pendrive.

Pen drive or USB are quite popular in the digital world for instant transfer of data. Using USB flash drives, one can easily transfer large files from one PC to another, from PC to laptop, from laptop to TV, and vice versa. This latest technology has made our work easier than before. In current times, you can move Gigabytes of information into just a tiny pen drive within few seconds.
In recent years, a lot of changes has been made in storage devices. When you compare new pen drives with the older ones, you will notice a considerable high transfer rate in the latest ones. However, there are times when you can get irritated with slow transfer speed of pen drives while copying data in pen drives. Well, this article shall provide you with some tricks using which you can speed up transfer rate of your pen drive.

Factors responsible for data transfer rate:


Before knowing the tricks, we shall have a look at some factors responsible for data transfer rate , and they are as follows.
1.Pen drive ageing: Well, this is common for any device that when it becomes old, the rates gets slower.
2.Type of files: The transfer rate of data also depends on the file type; you might have noticed that songs, videos and documents take very less time in transfer while application files need more time.
3.USB port version: The most popular version of USB is 2.0, and it will give you 35mbps speed. So, if you want fast speed then buy 2.0 version pen drives.

Few tricks to Speedup your pendrive Data Transfer Rate:


1.File system should be NTFS: If you want to Speedup Your Pendrive, then make sure you have NTFS as file system. You can do so by Right clicking on your pendrive and selecting Format,Select NTFS File system, Uncheck Quick Format And Click On Start.
2.Disk errors: To check disk errors go to the properties tab of your pen drive, then select ‘tools’ tab. You will find a ‘check now’ button, click it and then hit ‘start’ to fix the errors. The time taken for scan depends on the size of the pen drive.
check pendrive for errors
3.Device policy: Under properties of your pen drive, select ‘hardware’ tab. Then select USB device from there that will lead you to a pop up window where you need to change settings. You can even have better performance of pen drive by clicking the option under ‘hardware’ tab.
4.Format: This is one of the effective options that many users have tried. When you have used your pen drive for quite a long time, you can speed it up by formatting the device.
The above mentioned were few tricks though big advantages for the speeding of your pen drive. Carefully test your pen drive with the factors given above, and then follow the tricks to Speedup Your Pendrive to a greater extent. In addition to this, you should keep checking for these aspects regularly, say twice or thrice in a month.

Tuesday, 26 November 2013

5 Offbeat Habits Of The Biggest Tech CEOs Of The World!

Many of us idolize the lives of CEOs who founded big tech products and climbed the ladder of success and fame. And the secret behind their success was not just their exceptional talent but somewhere was their routine and their discipline. Here's bringing amazing and offbeat habits of 5 top tech CEOs. Read about Facebook’s Mark Zuckerbeg, Twitter’s cofounder Jack Dorsey, Reddit co-founder Alexis Ohanian, Apple's co-founder Steve Jobs and Tumblr's co-founder David Karp. 

1. Mark Zuckerberg, CEO, Facebook

CEO of Facebook, Mark Zuckerberg keeps 20 identical grey T-shirts to be worn on five days of the week. He wears it with a pair of blue jeans, thongs or trainers. Reportedly every year Zuckerberg sets a kind of challenge for himself, like in 2009, he decided to wear a tie to work every day. In 2010, he learnt Mandarin. In 2011, he decided that he will eat animals, only if he will kill them himself that apparently led to him in becoming somewhat a vegetarian. 

2. Steve Jobs, co-founder, Apple

All big people have great stories behind. Apple's late CEO of Steve Jobs had over 100 Issey Miyake designed black turtleneck sweaters and jeans so he never wasted time on thinking what to wear. He thought this would help him focus on the more important things, instead. 

3. Jack Dorsey, co-founder, Twitter

We have been taught since our very childhood to plan and divide days of the week for specific tasks. And Jack Dorsey is an example how planning works. Dorsey has divided each day of the week for separate tasks. Mondays are for Management meets; Tuesdays for Product development; Wednesdays for Marketing and communications; Thursdays for Developers and partnerships; Fridays for Discussing the company’s culture; Saturdays for Hiking; Sunday for sauna baths that he takes regularly. His Sunday ritual is 1. Dry sauna. 2. Cold dip. 3. Repeat. 

4. David Karp, co-founder, Tumblr

David Karp, the co-founder of Tumbler apparently takes the exact same breakfast every morning i.e. pancakes, eggs Florentine, avocado and bacon. Also every weekend David visits, Cafe Mogador in East Village, New York, with his girlfriend, Rachel, which is his favorite place to have brunch. 

5. Alexis Ohanian, co-founder, Reddit

30-year old Alexis Ohanian who is best known for co-founding the social news website Reddit in 2005, now has at least 50 other start-ups added in his portfolio. So what is his mantra for success? Every morning he writes down three biggest tasks to be done during the day. And then, “Do them, feel good. Repeat the next day.” 

Monday, 25 November 2013

Top 10 Unknown Google tricks

Google is the Proclaimed king among all search engines present on the internet. Among all the web based search engines, Google stands out because of its high speed and simplicity.
Unknown Google tricks
Everyone is familiar with the web applications provided by Google. Some of these are the Gmail, Google Drive, Google app store and a lot more. But little do people know about some very handy tricks that come along with this impeccable search engine.

 Top 10 Unknown Google tricks of all times:


1. Definition: there is no longer the need to type a word and then visit dictionaries online to find its meaning. Using this trick, all you need to do is simply write “define” followed by the word whose meaning you want to know.
You will be amazed to see that the meaning of the word, along with its synonym and antonym will be displayed on the search engine. For instance, type “define reach” and then press enter. The meaning of the word will get displayed on your screen.

2. Phone number lookup: it is now possible to trace mobile number by simply typing the full number along with the area code. This will display the address as well as the name of the person under whose name the number is registered.

3.Local search: you can now find local restaurants and other landmarks with this trick. Simply go to “Google visit” and type the name of the area and the place which you want to find. It is capable of displaying all local landmarks and places.

4.Translate: the “Google language tool” comes very handy while translating text, words, a fully fledged web page or document on the internet.

 5.Find movies and weather: All you need to do is type “movies” or “weather” in the search box followed by the area code or name of the state in order to display corresponding information regarding it. For instance, if you type “weather 12345”, weather conditions of the corresponding location will be displayed. Also, on typing “movies 12345”, the details of all the movies currently running at that place along with number of shows will get displayed.

 6.Paged linked to you: You can now find the web pages and links that are connected with your blog or website. Simply type “link” followed by the URL of your website and you will get a list of all the pages connected with your website.

7.Tracking airline flights and packages: this is another handy trick. You can now find the arrival time and status of a flight by simply entering the name of the airline and corresponding flight number.

8.Calculator: you can use the Google search engine as a real time calculator as well. For instance, if you will type 25+25 in the search box, 50 will get displayed.

9.Stocks: all you need to do is type the stock symbol on Google and you will get information about stock rates, links as well as charts. For instance, to know about the stock details of “Microsoft”, you have to write “msft” on Google.

10.Finding PDF results only: to get results matching only a certain file type, simply type “fileType:” after your search. Online manuals can be found using this trick from Google.
With this it ends my list of Unknown Google tricks, If i am Missing out on any Usefull Trick then please feel free to Comment.

Sunday, 24 November 2013

Wastage or not

Since 1959, more than 105 million yards of fabric have been used to create Barbie clothes.

How to Create Wifi Hotspot in Windows 7 and Windows 8

If you are one who looking to convert your PC as Wifi Hotspot then you are done.Here in this article We listed best 2 ways to convert your laptop as Wifi router.Once you turn you PC as WiFi router you can connect devices such as Android, another laptops etc. 

how-to-create-a-wifi-hotspot

Advantages of converting your laptop to a wifi router.

  • You can Enjoy internet in your wifi devices, any where you want but depend on your laptop wireless range.
  • Get rid of sitting at one place with wired internet connection.
  • If you have smart phone then you can get access to internet on your mobile.
There are numerous of method to turn your laptop a wifi spot (Windows 7 and 8 only),
Such as By command promote (only in windows 8) and by installing 3rd party software compatible with both.
Must Check: Talk to your Computer 

First Method-

You need to follow below steps care fully in order to make your laptop wifi router successfully.
Step.1: Open run (windows key+R), type ncpa.npl.

windows8-run
Step.2: A new window is in front of you. There select wireless Network adapter and sharing center and select properties.
rightclick-wifi
Step.3: In wifi properties Select share, followed by Allow Others Network users to connect.
wifi-properties
Note- Never Tick 2nd Option.
Step.4: Now Open Command Promote As administrative.
cmd-command-promopt-windows8
Step.5: Don't worry by looking in below Command promote codes in picture, those are very simple.
             You need to copy and paste below command in command promote.
"netsh wlan set hostednetwork mode=allow ssid=”techbymak” key=”techbymak”"
window8-cmd
You will see SSid which is actually your network name, which we are going to create.
Step.6:Now you need to start the network By using below command.
"netsh wlan start hostednetwork"
Every thing is done. Now you can observe your laptop is working like a router.
Note:To check How many Devices Are connected to your router you 
need to enter below command in command promote.
"netsh wlan show hostednetwork"
This was the first method to make your laptop a router.

Second Method:

We are using a Software in this method to make laptop Wifi router, this method is compatible with both windows 7 and 8.The name of the software is Virtual Router.Download the software and install it.( once you downloaded it will come in zip format so extract it)

When you have done all these make sure are connected to the network you want to share and then launch VirtualRouterPlus.exe.
Remember - Run the .Exe as administrative.

Let's Create A Network.

  • In this method we are using Virtual router so it is essential to create a new network.
  • It is similar to 1st method, here SSid also means the name of the network which we are creating, you can enter what you want.
virtual_router_plus_5
  • If you want you can enter Password, it is important to prevent others to use your internet service. 
  • Now here you need to indicate which network is to be shared and then click on start Virtual Router.
I hope you guys like the article and feel useful for you .If you have any problem in above steps feel free to comment below we ill help you out.
- See more at: http://www.alltechtricks.com/2013/10/how-to-create-wifi-hotspot-in-windows-7.html?CM#sthash.KSYCnvnx.dpuf

Saturday, 23 November 2013

a shark's survival

A shark must keep moving forward to stay alive.

Control PC with Mobile

Did you ever wish there must be a way to remotely access the  pictures,videos,music and other files that are on your personal computer from your mobile device while you are not home? Who does not love accessing the files and documents while travelling? Did you ever regret while showing pictures to your family or friends while some of them are in your computer but not the mobile device?
p3
The solution for all the questions above is just a small app called Polkast. Which is absolutely free of cost.
Must Check:How to Create Wifi Hotspot in PC 

About Polkast:

Polkast is a cloud service through which you can create your own personal cloud with the app itself. Any files on your computer you choose to share via Polkast can be remotely accessed from any mobile phone or tablet you own.
p2
This is how polkast works as we can see in the above picture. To make the polkast app work we need to install the server app on your computer and the client app on your mobile device such as phone or tab. Both the server and client versions of polkast are available as a free download from the Polkast website.

Step by Step Process to Acess Computer with Mobile:

  • Go to the Polkast website and click on the DESKTOP option as shown in the picture.
polkast+desktop
  • This directs to the download page. firstly download the server version that is the computer app version of the Polkast.
download+polkast
  • Click on the download option for windows.As soon as the download is complete, you can see the Polkast app active on your computer screen.Install the Polkast server app on your system and register an account for yourself.
  • After the registration process is completed it directs you to Polkast working screen.click on get started now option.
pol2
  • Next you have to choose which folders on your computer you want to access via polkast on your mobile. 
Screen+shot+2012-07-23+at+12.08.42+PM
  • Polkast adds the selected files and documents you have selected to the library. Now go back to the website and download the client version of the app. As of now,I will show you the working in ios. 
05
Download it and open in the app store of your mobile phone.
  • Once you start Polkast on your mobile phone or tablet, it will ask you to login to your polkast account.
phone1
  • After you are logged in, polkast will automatically search for your personal cloud  and connect to it. 
ph2
  • Once your phone successfully connects to the computer through polkast, the app dashboard will be displayed on the screen. the dashboard allows you to remotely access,browse,search and also download files from your computer.
phone4
By following the above simple steps you can watch pictures, listen to music and what ever you select from your dashboard to access from your mobile devices through Polkast. It doesn't matter where you are, you just need an active internet connection. you can also share the pictures on any social networks, edit them and save them back to your personal cloud.
- See more at: http://www.alltechtricks.com/2013/10/control-pc-with-android-mobile.html?CM#sthash.hvbxOVyS.dpuf

Top 5 Websites to Improve your typing skills and speed

Everyone using the computer wish to finish their tasks quickly. For doing this, typing plays a vital role because no matter if you are making presentations, doing content writing or even chatting you have to apply your Typing skills everywhere.
It is dream of everyone to type rapidly and without even looking at your keyboard, just by concentrating on word over your screen which you are typing. But many of us really don’t have those great typing skills and if same is the case with you , just don’t worry .
Improve your typing skills
Here is a list of few outstanding websites which will not only increase your typing speed but also let you improve your skills and minimizing typing mistakes.


1.TypingTest.com

typing test
On Typingtest.com you will have to select a time slice ranging from 1 minute, 2 minutes and 3 minutes. Accordingly choose one text type from given ten types and then you can begin the touch typing test.
After this test completes, website will generate a summary showing your typing speed, typing accuracy and errors that you made during your typing test. It will also categorize your typing in slow, Average or Fast in order to help you improve.
Besides, you can also play nine different games to test your typing speed while enjoyingthe game at the same time.

2.PowerTyping.com


The website PowerTyping is an online free typing tutor website allowing you practice on both kinds of keyboards i.e. Qwerty keyboard and Dvorak keyboard. Here Qwerty keyboard will make your paragraph or words typing skills better while Dvorak keyboard will be helping you to understand the alphabet’s keys location on your keyboard. You can select your desired keyboard and take the typing practice, or you can play some typing games as well.

 3. Keybr.com

Keybr.com is different from above mentioned two websites in such a manner because besides English, you can also take test for French, Italian, German, Spanish, Portuguese and Russian here. Some of which offer more than one default keyboard layout making you perfect in typing languages even other than English.
You can choose the test type from Random words, Custom text and Imported web site or blog which gives you flexibility to practice simply anything you want.

4. TypeRacer.com

In TypeRacer.com you can enter a typing race, take some practices yourself and also invite your friends to a private race with chat where you can compete against them. It will not just improve your typing skills of yours but will also help you to measuring typing speed as well as chatting with your friends at the same time. You can install TypeRacer on Facebook, Myspace, Orkut, Hi5, or Netlog  and you can also test your typing speed in Chinese, French, Japanese and many other languages.

5. FreeTypingGame.net

As per the name of website, you can test and improve your typing speed by playing games. There are 10 different free typing games and each of them has three levels: beginner, Intermediate and advanced.
Apart from this you can also study the typing lessons or you can take some typing tests if you don’t wish to play game and just want to practice in classical manner.
Keep on Practicing to Achieve your Goal, If you know any other Great Website, Feel Free to Mention it in Comments.

Create your own MAZE GAME

MAZE: THE GAME
It is an addictive and interesting game in which skills matter the most that how you move and control the motion of the square. I has 18 levels from easy to hard.
The game is developed in C++ using OpenGl glut library.
The game has graphical user interface and can be played using keyboard arrow keys.
The goal of the game is to move the green square towards blue square by passing it through various challenging maze without touching the boundary of maze.
The score is relative to the time i.e. less time, more score
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615
// Game Code in C++
 
#include<stdio.h>
#include<glut.h>
#include<stdlib.h>
#include<string.h>
#include<time.h>
#include<Windows.h>
#include<math.h>
 
 
int stx = 100, sty = 280;
float px = stx, py = sty; //centre pixel of car
float nacc = 2.0;
float accl = 0;
clock_t t1, t2; //to calculate the time taken to reach the goal
float friction = 0.20;
int time1 = 15;
float splimit = 5.0f;
char dir = 'O';
int leveltype = 0; //0 for easy, 1 for medium, 2 for hard
int h = 600, w = 1000;
int goalsize = 10;
int carsize = 4;
bool moveStart = false;
bool nwgame = true;
bool gmover = false;
bool goal = false;
int level = 1;
int highscore = 0;
int score = 0;
int encKey = 123;
int allcomp = 0; //All levels completed
int maxlevel = 6;
unsigned char pic[3] = {0};
bool toggle = true;
FILE *fp;
 
void car(float x, float y, int csize);
void myInit();
void grid1(int);
int collision(int, int);
void reshape(int wx, int hy);
void specialkeys(int key, int x, int y);
void handlekeys(unsigned char key, int x, int y);
void display();
void setPixel(float x, float y);
void automove(int value);
void start();
void mouse(int button, int state, int x, int y);
void changeLevelType();
 
GLubyte rgba[4];
 
int encryptHighscore(int num)
{
return num * encKey - 511377;
}
 
int decryptHighscore(int num)
{
if (num == 0)
return 0;
float s = (float) (num + 511377) / encKey;
float frac = s - (int)s;
if ((frac + 1) * 10000 == 10000.0)
return (int)s;
else return 0;
}
 
void toggleGlutWindowMaximizeBox(char *szWindowTitle)
{
long dwStyle;
HWND hwndGlut;
hwndGlut = FindWindow(NULL, szWindowTitle);
dwStyle = GetWindowLong(hwndGlut, GWL_STYLE);
dwStyle ^= WS_MAXIMIZEBOX;
SetWindowLong(hwndGlut, GWL_STYLE, dwStyle);
}
 
void getPixel(int x, int y, GLubyte *color) {
glReadPixels(x, y, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, color);
}
 
void *fonts[] =
{
GLUT_BITMAP_9_BY_15,
GLUT_BITMAP_TIMES_ROMAN_10,
GLUT_BITMAP_TIMES_ROMAN_24,
GLUT_BITMAP_HELVETICA_18,
GLUT_BITMAP_8_BY_13
};
 
void output(int x, int y, char *string, int f)
{
int len, i;
glPointSize(20.0);
glRasterPos2f(x, y);
len = (int) strlen(string);
for (i = 0; i < len; i++) {
glutBitmapCharacter(fonts[f], string[i]);
}
}
 
void myInit()
{
glClearColor(0.0, 1.0, 1.0, 1.0);
glLineWidth(3.0);
glShadeModel(GL_FLAT);
gluOrtho2D(0, w, h, 0);
changeLevelType();
int ii = encryptHighscore(20000);
int uu = decryptHighscore(ii);
try
{
fp = fopen("highscore.txt", "r+");
if (fp == NULL)
{
fp = fopen("highscore.txt", "w+");
fprintf(fp,"%d", 0);
}
else
{
fscanf(fp, "%d", &highscore);
highscore = decryptHighscore(highscore);
}
}
catch(...)
{
}
}
 
void border()
{
glBegin(GL_LINES);
//border
glVertex2i(1, 1);
glVertex2i(1, 599);
glVertex2i(1, 599);
glVertex2i(999, 599);
glVertex2i(999, 599);
glVertex2i(999, 1);
glVertex2i(999, 1);
glVertex2i(1, 1);
glEnd();
}
 
void grid1(int value)
{
//black grid rgba values are 0 0 0 255, a (alpha) is always same.
glBegin(GL_LINES);
//1st level
glVertex2i(260, 360);
glVertex2i(260, 200);
glVertex2i(260, 200);
glVertex2i(740, 200);
glVertex2i(740, 200);
glVertex2i(740, 400);
glVertex2i(740, 400);
glVertex2i(260, 400);
//2nd level
if (value >= 5)
{
glVertex2i(300, 240);
glVertex2i(300, 400);
}
glVertex2i(340, 200);
glVertex2i(340, 280);
glVertex2i(340, 320);
glVertex2i(340, 400);
if (value >= 3)
{
glVertex2i(380, 200);
glVertex2i(380, 360);
}
glVertex2i(420, 240);
glVertex2i(420, 400);
//3rd level
if (value > 1)
{
glVertex2i(460, 200);
glVertex2i(460, 280);
glVertex2i(460, 280);
glVertex2i(580, 280);
}
if (value > 1)
{
glVertex2i(460, 320);
glVertex2i(460, 360);
glVertex2i(460, 320);
glVertex2i(540, 320);
glVertex2i(460, 360);
glVertex2i(540, 360);
glVertex2i(540, 320);
glVertex2i(540, 360);
}
if (value > 2)
{
glVertex2i(540, 200);
glVertex2i(540, 240);
}
if (value >= 1)
{
glVertex2i(660, 280);
glVertex2i(740, 280);
}
if (value > 3)
{
glVertex2i(620, 240);
glVertex2i(700, 240);
}
if (value >= 1)
{
glVertex2i(620, 320);
glVertex2i(700, 320);
glVertex2i(700, 320);
glVertex2i(700, 360);
}
if (value >= 4)
{
glVertex2i(660, 360);
glVertex2i(700, 400);
}
glVertex2i(620, 240);
glVertex2i(620, 400);
glEnd();
glColor3f(0.0f, 0.0, 1.0);
if (value == 1)
car(580, 320, goalsize);
else if (value == 2)
car(570, 360, goalsize);
else if (value == 3)
car(520, 220, goalsize);
else if (value == 4)
car(720, 260, goalsize);
else if (value == 5)
car(720, 370, goalsize);
else if (value == 6)
car(660, 385, goalsize);
}
 
int collision(int size, int value)
{
// 0 if not collision, 1 if collision, 2 if goal
//checking goal color i.e. blue
getPixel(px,h - 1 - py, rgba);
if (rgba[0] == 0 && rgba[1] == 0 && rgba[2] == 255)
return 2;
getPixel(px,h - 1 - py+size, rgba);
if (rgba[0] == 0 && rgba[1] == 0 && rgba[2] == 255)
return 2;
getPixel(px+size,h - 1 - py, rgba);
if (rgba[0] == 0 && rgba[1] == 0 && rgba[2] == 255)
return 2;
getPixel(px-size,h - 1 - py, rgba);
if (rgba[0] == 0 && rgba[1] == 0 && rgba[2] == 255)
return 2;
// checking for 4 directions of car
getPixel(px,600 - 1 - py-size, rgba); // getting pixel from cooardinates, initially viewport coordinates are bottom left, then inverting y to set viewport
if (rgba[0] == 0 && rgba[1] == 0 && rgba[2] == 0)
return 1;
getPixel(px,600 - 1 - py+size, rgba);
if (rgba[0] == 0 && rgba[1] == 0 && rgba[2] == 0)
return 1;
getPixel(px+size,600 - 1 - py, rgba);
if (rgba[0] == 0 && rgba[1] == 0 && rgba[2] == 0)
return 1;
getPixel(px-size,600 - 1 - py, rgba);
if (rgba[0] == 0 && rgba[1] == 0 && rgba[2] == 0)
return 1;
return 0;
}
 
void setPixel(float x, float y)
{
glBegin(GL_POINTS);
glVertex2f(x, y);
glEnd();
}
 
void car(float x, float y, int csize)
{
glBegin(GL_POLYGON);
glVertex2i(x-csize, y-csize);
glVertex2i(x-csize, y+csize);
glVertex2i(x+csize, y+csize);
glVertex2i(x+csize, y-csize);
glEnd();
}
 
float ax = 1.0, ay = 1.0;
 
void movement(int value)
{
px += ax;
py += ay;
if (px <= 0)
ax = -ax;
if (px > 1000)
ax = -ax;
if (py < 0)
ay = -ay;
if (py >= 600)
ay = -ay;
glutPostRedisplay();
if(!toggle)
glutTimerFunc(time1, movement, 1);
}
 
void changeLevelType()
{
if (leveltype == 1)
{
carsize = 7;
goalsize = 10;
friction = 0.15;
nacc = 2.0;
splimit = 6.0;
}
else if(leveltype == 2)
{
carsize = 8;
goalsize = 10;
friction = 0.10;
nacc = 2.0;
splimit = 8.0;
}
else if(leveltype == 0)
{
level = 1;
accl = 0;
t1 = t2;
leveltype = 0;
px = stx;
py = sty;
nwgame = true;
goal = false;
carsize = 4;
goalsize = 10;
score = 0;
friction = 0.20;
nacc = 1.0;
splimit = 5.0;
}
level = 1;
}
 
void automove(int value)
{
if (dir == 'w')
py -= accl;
else if (dir == 's')
py += accl;
else if (dir == 'a')
px -= accl;
else if (dir == 'd')
px += accl;
else dir = 'O';
//time -= accl;
accl -= friction;
if (px < 0)
px = 1000;
if (px > 1000)
px = 0;
if (py < 0)
py = 600;
if (py > 600)
py = 0;
if (collision(carsize, level) == 1) //wall collision
{
accl = 0;
px = stx;
nwgame = false;
py = sty;
goal = false;
if (score >= 0)
score -= 100;
if (score < 0)
score = 0;
}
if(collision(carsize, level) == 2) //goal collision
{
if (score > highscore)
{
highscore = score;
try{
fp = fopen("highscore.txt", "w+");
fprintf(fp, "%d", encryptHighscore(highscore));
}
catch(...)
{
}
}
accl = 0;
level++;
if (level > maxlevel)
{
leveltype++;
if (leveltype == 3)
allcomp = 1;
changeLevelType();
}
px = stx;
nwgame = true;
py = sty;
goal = false;
}
glutPostRedisplay();
if (accl > 0)
glutTimerFunc(time1, automove, 0);
}
 
void start()
{
accl = 0;
glutTimerFunc(time1, automove, 0);
}
 
void showtime()
{
char strr[20];
int tot;
tot = (double)(t2 - t1)/1000; // calculating time
itoa(tot, strr, 10);
output(650, 50, strr, 3); // displaying time
itoa(level, strr, 10);
output(650, 80, strr, 3); // displaying level
itoa(score, strr, 10);
output(650, 140, strr, 3); // displaying score
output(600,110, "HIGHSCORE: ", 4);
itoa(highscore, strr, 10);
output(680, 110, strr, 3);
}
 
void playtime(int value)
{
glutPostRedisplay();
t2 = clock();
if (score > 0)
score -= 1; // score calculation
if (goal == true)
glutTimerFunc(100, playtime, 1);
}
 
void display()
{
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(0.0f, 0.01, 0.0);
border();
if (allcomp == 1)
{
output(260,170, "CONGRATULATIONS! YOU HAVE COMPLETED ALL LEVELS.", 4);
output(260,190, "FOR MORE VISIT WWW.YOUTUBE.COM/SHIVNARR", 4);
leveltype = 0;
changeLevelType();
}
glColor3f(0.0f, 0.0, 0.0);
grid1(level);
glColor3f(0.0f, 0.1, 0.0);
output(800, 580, "SHIVINDER SINGH NARR", 4);
output(700, 592, "http://shivindernarr.blogspot.com", 4);
output(50, 50, "GOAL - MOVE GREEN SQUARE TO BLUE SQUARE", 4);
output(50, 80, "USE ARROW KEYS TO MOVE SQUARE", 4);
output(50, 580, "Exit(ESC)", 4);
output(150, 580, "Restart(R)", 4);
output(600, 80, "LEVEL: ", 4);
output(600,140, "SCORE: ", 4);
output(665, 80, "/ 6", 3);
if (leveltype == 0)
{
output(690, 80, "(EASY)", 4);
}
else if (leveltype == 1)
{
output(690, 80, "(MEDIUM)", 4);
}
else if (leveltype == 2)
{
output(690, 80, "(HARD)", 4);
}
output(600, 50, "TIME: ", 4);
output(680, 50, "SECONDS", 4);
showtime();
glColor3f(0.0f, 0.3, 0.0);
car(px, py, carsize);
glutSwapBuffers();
glFlush();
}
 
void handlekeys(unsigned char key, int x, int y)
{
if (key == 27) // Esc key
exit(0);
if (key == 'S') // Cheat key
{
toggle = !toggle;
movement(1);
}
if (allcomp == 1) // Enter key
{
level = 1;
allcomp = 0;
accl = 0;
t1 = t2;
leveltype = 0;
px = stx;
py = sty;
nwgame = true;
goal = false;
carsize = 4;
goalsize = 10;
score = 0;
friction = 0.20;
nacc = 1.0;
splimit = 5.0;
glutPostRedisplay();
}
if (key == 'r' || key == 'R')
{
level = 1;
accl = 0;
t1 = t2;
leveltype = 0;
px = stx;
py = sty;
nwgame = true;
goal = false;
carsize = 4;
goalsize = 10;
score = 0;
friction = 0.20;
nacc = 1.0;
splimit = 5.0;
glutPostRedisplay();
}
}
 
void specialkeys(int key, int x, int y) {
if (key == GLUT_KEY_UP){
dir = 'w';
}
else if (key == GLUT_KEY_DOWN) {
dir = 's';
}
else if (key == GLUT_KEY_LEFT) {
dir = 'a';
}
else if (key == GLUT_KEY_RIGHT) {
dir = 'd';
}
if (accl <= 0)
{
start();
}
if (accl == 0 && px == stx && py == sty)
{
t1 = clock();
goal = true;
if (nwgame)
score = score + 500 * level; //score addition
playtime(1);
}
if (moveStart == false && accl <= 0)
{
moveStart = true;
}
accl += nacc;
if (accl > splimit)
accl = splimit;
}
 
void specialkeysup(int key, int x, int y)
{
if (key == GLUT_KEY_UP){
moveStart = false;
}
else if (key == GLUT_KEY_DOWN) {
moveStart = false;
}
else if (key == GLUT_KEY_LEFT) {
moveStart = false;
}
else if (key == GLUT_KEY_RIGHT) {
moveStart = false;
}
}
 
void reshape(int wx, int hy)
{
glViewport(0,0, w, h); // Set the viewport to the size of our window
}
 
int main(int argc, char ** argv)
{
char * winMess = "Maze Ver 1.0";
HWND h1 = GetConsoleWindow();
ShowWindow(h1, SW_HIDE);
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH | GLUT_RGBA);
glutInitWindowSize(w, h);
glutInitWindowPosition(150, 100);
glutCreateWindow(winMess);
myInit();
glutDisplayFunc(display);
glutKeyboardFunc(handlekeys);
glutSpecialFunc(specialkeys);
glutSpecialUpFunc(specialkeysup);
glutReshapeFunc(reshape);
glutMainLoop();
return 0;
}