bethesirius / ChosunTruck

Euro Truck Simulator 2 autonomous driving solution
732 stars 104 forks source link

Introducing input #10

Closed zappybiby closed 7 years ago

zappybiby commented 7 years ago

Input now works in that it sends messages to the game and moves the truck.

However, this change currently freezes the program and does not work correctly. It sends messages too fast and doesn't seem to move left/right appropriately. Because of this, I have commented out that section for now.

I thought it might be useful to have this on the main file just in case any developers see this and want to help.

zappybiby commented 7 years ago

Let me know if you want to pull this version: https://github.com/ajchili/ChosunTruck/commit/61f184521ac4fb0c6d34da42f2089a2dfd884bc1

I just added some comments explaining the code. It's up to you 😃

zappybiby commented 7 years ago

Oh, I almost forgot! My keyboard type (I live in the United States) might be different than yours since you are in South Korea.

In that case, instead of MapVirtualKey, you would use MapVirtualKeyEx to define a specific keyboard type. Something like MapVirtualKeyEx(0x41, MAPVK_VK_TO_VSC_EX, HKL)

To find your HKL, use the LoadKeyboardLayout function.

We could also use SendInput to move the mouse instead, avoiding this issue altogether.