01-10-2019 12:19 PM
hi everyone ,
i am starting cvi project about snake game,i will be appreciated for any information or suggestions that could help .
Solved! Go to Solution.
01-11-2019 05:00 PM
Hi Deadband24,
There's some general C recommendations that I can provide, but that's a pretty broad question so it's hard to really address it. Are you looking for ideas for how to structure your data, for how to update the graphics, for how to accept user input? Why have you chosen LabWindows/CVI over another C compiler?
In general, I would recommend looking up Design Patterns and finding a pattern that approximates the way you're trying to make your project work. Build around something that people already know is good rather than trying to reinvent the wheel. Are you wanting to cycle through a sequence of events regularly, but have the order change based on the program's input? Use a State Machine. Are you wanting to process some data entirely independently from the rest of your program? Look into parallel loop structures.
Best,
Nick Smith
Applications Engineer
National Instruments
02-05-2019 08:55 AM
hi,
i added a panel when my game is over and i included a menu button to return to the menu
and when i return the game does not start all over again it continues from where it had finished.
i tried to call the main function in the menufunction but it wont work and i also tried putting runuserinterface and quiteuserinterface but it also cant work,
any ideas?
02-05-2019 10:29 AM
Well, CVI is basically a C language, which is a procedural program; that is, you must explicitly determine the program flow according to your needs. If you want that a process restarts, you must code it to do that. Adding a popup message won't start the program by itself: you must add some code executed after the user dismisses the panel to let your program start over the process again.
BTW, do not play unnecessarily with RunUserInterface and QuitUserInterface: be sure to have only one instance of them in your application and don't call the main function over and over. You should better place a start button on your UI and have the game start on the button press, so that when the game ends the user can restart it again and again, if that's what you want.