LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

project

Solved!
Go to solution

hi everyone ,

i am starting cvi project about snake game,i will be appreciated for any information or suggestions that could help . 

0 Kudos
Message 1 of 4
(360 Views)
Highlighted
Solution
Accepted by topic author deadband24
02-05-2019 07:07 AM

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 

http://www.ni.com/support 

Nick Smith
Product Support Engineer
C Series Controllers
National Instruments
0 Kudos
Message 2 of 4
(329 Views)

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? 

0 Kudos
Message 3 of 4
(249 Views)

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.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 4 of 4
(235 Views)