main.cpp:
#include <iostream>
#include "header.h"
using namespace std;
int main(){
while(1){
cout<<"X: "<<x<<endl<<"Y: "<<y<<endl<<"Z: "<<z<<endl; //The x,y,z decleared in header.h
}
}
header.h
#ifndef HEADER_H_INCLUDED
#define HEADER_H_INCLUDED
#include <windows.h>
int example(int x, int y, int z=0){
if(GetAsyncKeyState(VK_UP)){y++;}
if(GetAsyncKeyState(VK_DOWN)){y--;}
if(GetAsyncKeyState(VK_RIGHT)){x++;}
if(GetAsyncKeyState(VK_LEFT)){x++;}
if(GetAsyncKeyState(VK_TAB)){z=1;}
if(GetAsyncKeyState(VK_SPACE)){z=2;}
if(GetAsyncKeyState(VK_SHIFT)){z=3;}
return(0);
}
#endif // HEADER_H_INCLUDED

New Topic/Question
Reply




MultiQuote






|