The Ring programming language version 1.5.4 book - Part 8 of 185

 Documents

 2 views
of 10
All materials on our website are shared by users. If you have any questions about copyright issues, please report us to resolve them. We are always happy to assist you.
Description
The Ring programming language version 1.5.4 book - Part 8 of 185
Share
Tags
Transcript
  Ring Documentation, Release 1.5.4 4.8 Better RingQt New classes added to RingQt :ã QStringRef ã QMutexã QMutexLockerã QBufferã QBluetoothAddressã QBluetoothDeviceDiscoveryAgentã QBluetoothDeviceInfoã QBluetoothHostInfoã QBluetoothLocalDeviceã QBluetoothServerã QBluetoothServiceDiscoveryAgentã QBluetoothServiceInfoã QBluetoothSocketã QBluetoothTransferManagerã QBluetoothTransferReplyã QBluetoothTransferRequestã QBluetoothUuid 4.8. Better RingQt 45  Ring Documentation, Release 1.5.4 Example: ### Submits your car VIN - Vehicle Id Number - to the Web Site - vpic.nhtsa.dot.gov -### Parses XML data returned ### Prints out the car info result load    libcurl.ring load    guilib.ring load    stdlib.ring curl = curl_easy_init() # request = 3G1JC5248YS251015?format=xml ### VIN - Chevrolet request =  3GYFK62847G247323?format=xml  ### VIN - Cadillac call_type =  decodevinvalues/ url =  https://vpic.nhtsa.dot.gov/api/vehicles/ url_request = url + call_type + request See   URL Request: + url_request +nl curl_easy_setopt(curl, curlopt_url, url_request)response = curl_easy_perform_silent(curl); See  nl + Response Raw: + response +nl +nl curl_easy_cleanup(curl)xml =  new  qxmlstreamreader()xml.adddata_2(response)x =  new  qstringref() while not  xml.atend() if  xml.error() see  xml.errorstring()  see  nl exit loopok x = xml.text() if not  x.length() = 0 see   Length:  see  x.length() + --- see   Value:  see  x.tostring()  see  nl ok xml.readnext() end get  x ###------------------------------------------### Results## ==>Value: 115# ==>Value: Results returned successfully # ==>Value: VIN(s): 3G1JC5248YS251015# ==>Value: 3G1JC5248YS251015# ==>Value: Sedan/Saloon# ==>Value: 4# ==>Value: 2200.0 4.8. Better RingQt 46  Ring Documentation, Release 1.5.4 # ==>Value: 134.25223700841# ==>Value: 2.2# ==>Value: 4# ==>Value: LN2# ==>Value: CHEVROLET # ==>Value: GENERAL MOTORS LLC # ==>Value: Cavalier # ==>Value: 2000# ==>Value: Ramos Arzipe# ==>Value: PASSENGER CAR# ==>Value: 4# ==>Value: In-Line# ==>Value: 1st Row (Driver & Passenger)# ==>Value: Sequential Fuel Injection (SFI)# ==>Value: Mexico# ==>Value: NA# ==>Value: Manual# ==>Value: Body Type: Sedan, 4-6 Window, Notchback (GM codes: 19, 69)# ==>Value: Name Plate: Chevrolet, Pontiac# ==>Value: 0 - VIN decoded clean. Check Digit (9th position) is correct# ==>Value: LAN # ==>Value: 984####----------------------------------------- 4.9 Better Objects Library The function Open_WindowInPackages() is added to the Objects library.The Open_WindowInPackages() function is the same as Open_Window() but takes an extra list that determine thepackages to import before opening the window.Syntax: Open_WindowInPackages(cClassName,aPackagesList) Example:The next example from the Form Designer source code, Open the Window Flags window using theopen_windowInPackages() function.We determine the class name “WindowFlagsController” and the packages name.The Window Flags window uses the FormDesigner and System.GUI packages. open_windowInPackages(:WindowFlagsController,[ formdesigner , System.GUI ]) 4.10 RingFreeGLUT Extension Ring 1.5 comes with RingFreeGLUT extension to support the FreeGLUT libraryExample: 4.9. Better Objects Library 47  Ring Documentation, Release 1.5.4 /*This sample is based on C Tutorialsfrom : http://www.lighthouse3d.com/tutorials/glut-tutorial/*/load freeglut.ring load opengl21lib.ring // angle of rotation for the camera directionangle = 0.0// actual vector representing the camera's directionlx=0.0 lz=-1.0// XZ position of the camerax=0.0 z=5.0// the key states. These variables will be zero//when no key is being pressesdeltaAngle = 0.0deltaMove = 0xOrigin = -1// Constant definitions for MenusC_RED = 1C_GREEN = 2C_BLUE = 3C_ORANGE = 4C_FILL = 5C_LINE = 6// Pop up menu identifiersfillMenu=NULLfontMenu=NULLmainMenu=NULLcolorMenu=NULL// color for the nosered = 1.0blue=0.5green=0.5// scale of snowmanscale = 1.0// menu statusmenuFlag = 0// default fontfont = GLUT_BITMAP_TIMES_ROMAN_24C_INT_GLUT_BITMAP_8_BY_13 = 7C_INT_GLUT_BITMAP_9_BY_15 = 8C_INT_GLUT_BITMAP_TIMES_ROMAN_10 = 9C_INT_GLUT_BITMAP_TIMES_ROMAN_24 = 10C_INT_GLUT_BITMAP_HELVETICA_10 = 11 4.10. RingFreeGLUT Extension 48
Related Search
We Need Your Support
Thank you for visiting our website and your interest in our free products and services. We are nonprofit website to share and download documents. To the running of this website, we need your help to support us.

Thanks to everyone for your continued support.

No, Thanks