Welcome, Guest. Please login or register.
May 25, 2013, 11:02:38 am

Login with username, password and session length
Members
Total Members: 488
Latest: Wimmie
Stats
Total Posts: 7309
Total Topics: 1178
Online Today: 7
Online Ever: 229
(April 05, 2011, 09:10:50 am)
Users Online
Users: 0
Guests: 5
Total: 5
Permissions

A Squeakyduck Design product
by GrahamK on February 24, 2008, 10:38:41 am
Before reading these tutorials, it is assumed that you have at least a Beginner's grasp of Cobra and programming, that you understand how to create variables and open a simple screen. This is all covered in the Beginners tutorials.

The Pure2D library is a module that you can use in Cobra. It allows you to draw 2D graphics to the screen with exceptional speed and blending capabilities. Pure2D requires no external DLLs like DirectX or special hardware to work, so it can be used on any computer running Windows 95 or above!

To use the commands in the Pure2D library, you have to specify it in the Uses command of your program, like so.


Program
Uses Pure2D, Keyset

Begin
OpenScreen

Repeat
// Update program, display graphics etc, here
Text(10, 10, "Helloooooooo Pure2d!")
Flip
Until KeyDown(VK_ESCAPE)

CloseScreen
End


Note, we have also used the Keyset library as it allows understandable constants such as VK_ESCAPE to be used, instead of figuring out what the numeric value of the Escape key is.

By specifying that we will be using Pure2D, Cobra sets up the program's commands to use that library. All drawing, window opening, and even input commands, relate to that library now.

It is important to note that if you did not specify Pure2D or Cobra3D in the Uses command, the OpenScreen command would not work and your program would generate an error. Without including a module, the only way to output information is with the MessageBox procedure.
1005 Views | Rating: (0 rates)