ReactOS  0.4.13-dev-99-g7e18b6d
butterflies.c File Reference
#include <windows.h>
#include <scrnsave.h>
#include <tchar.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glext.h>
#include "resource.h"
Include dependency graph for butterflies.c:

Go to the source code of this file.

Classes

struct  object
 

Functions

void SetDefaults ()
 
void ReadRegistry ()
 
void WriteRegistry ()
 
void SetObject (int loop)
 
void LoadGLTextures ()
 
HGLRC InitOGLWindow (HWND hWnd)
 
void InitOpenGL (GLsizei width, GLsizei height)
 
void Display ()
 
INT_PTR CALLBACK AboutProc (HWND hdlg, UINT msg, WPARAM wpm, LPARAM lpm)
 
LRESULT WINAPI ScreenSaverProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
 
BOOL WINAPI ScreenSaverConfigureDialog (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
 
BOOL WINAPI RegisterDialogClasses (HANDLE hInst)
 

Variables

HINSTANCE hInstance
 
GLuint texture [3]
 
LPCTSTR registryPath = _T("Software\\Microsoft\\ScreenSavers\\Butterflies")
 
BOOL dRotate
 
struct object obj [50]
 

Function Documentation

◆ AboutProc()

INT_PTR CALLBACK AboutProc ( HWND  hdlg,
UINT  msg,
WPARAM  wpm,
LPARAM  lpm 
)

Definition at line 233 of file butterflies.c.

233  {
234 
235  switch(msg){
236  case WM_CTLCOLORSTATIC:
237  if(((HWND)lpm == GetDlgItem(hdlg, WEBPAGE1)) || ((HWND)lpm == GetDlgItem(hdlg, WEBPAGE2)))
238  {
239  SetTextColor((HDC)wpm, RGB(0,0,255));
242  }
243  break;
244  case WM_COMMAND:
245  switch(LOWORD(wpm)){
246  case IDOK:
247  EndDialog(hdlg, LOWORD(wpm));
248  break;
249  case WEBPAGE1:
250  ShellExecute(NULL, _T("open"), _T("http://nehe.gamedev.net"), NULL, NULL, SW_SHOWNORMAL);
251  break;
252  case WEBPAGE2:
253  ShellExecute(NULL, _T("open"), _T("http://www.thaputer.com"), NULL, NULL, SW_SHOWNORMAL);
254  break;
255  }
256  }
257  return FALSE;
258 }
#define IDOK
Definition: winuser.h:824
#define WM_CTLCOLORSTATIC
Definition: winuser.h:1748
static HDC
Definition: imagelist.c:92
int32_t INT_PTR
Definition: typedefs.h:62
DWORD WINAPI GetSysColor(_In_ int)
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
#define WEBPAGE1
Definition: resource.h:13
COLORREF WINAPI SetBkColor(_In_ HDC, _In_ COLORREF)
Definition: dc.c:975
#define COLOR_3DFACE
Definition: winuser.h:919
#define WEBPAGE2
Definition: resource.h:14
#define ShellExecute
Definition: shellapi.h:689
smooth NULL
Definition: ftsmooth.c:416
#define _T(x)
Definition: vfdio.h:22
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
DWORD COLORREF
Definition: windef.h:285
#define RGB(r, g, b)
Definition: wingdi.h:2918
#define WM_COMMAND
Definition: winuser.h:1716
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:884
#define SW_SHOWNORMAL
Definition: winuser.h:764
#define msg(x)
Definition: auth_time.c:54
HBRUSH WINAPI GetSysColorBrush(_In_ int)
#define LOWORD(l)
Definition: pedump.c:82

Referenced by ScreenSaverConfigureDialog().

◆ Display()

Definition at line 184 of file butterflies.c.

185 {
186  int loop;
187  glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear Screen And Depth Buffer
188 
189  for (loop=0; loop<50; loop++) // Loop Of 50 (Draw 50 Objects)
190  {
191  glLoadIdentity (); // Reset The Modelview Matrix
192  glBindTexture(GL_TEXTURE_2D, texture[obj[loop].tex]); // Bind Our Texture
193  glTranslatef(obj[loop].x,obj[loop].y,obj[loop].z); // Position The Object
194  glRotatef(45.0f,1.0f,0.0f,0.0f); // Rotate On The X-Axis
195  if (dRotate)
196  {
197  glRotatef((obj[loop].spinz),0.0f,0.0f,1.0f); // Spin On The Z-Axis
198  }
199  glBegin(GL_TRIANGLES); // Begin Drawing Triangles
200  // First Triangle _____
201  glTexCoord2f(1.0f,1.0f); glVertex3f( 1.0f, 1.0f, 0.0f); // (2)| / (1)
202  glTexCoord2f(0.0f,1.0f); glVertex3f(-1.0f, 1.0f, obj[loop].flap); // | /
203  glTexCoord2f(0.0f,0.0f); glVertex3f(-1.0f,-1.0f, 0.0f); // (3)|/
204 
205  // Second Triangle
206  glTexCoord2f(1.0f,1.0f); glVertex3f( 1.0f, 1.0f, 0.0f); // /|(1)
207  glTexCoord2f(0.0f,0.0f); glVertex3f(-1.0f,-1.0f, 0.0f); // / |
208  glTexCoord2f(1.0f,0.0f); glVertex3f( 1.0f,-1.0f, obj[loop].flap); // (2)/____|(3)
209 
210  glEnd(); // Done Drawing Triangles
211 
212  obj[loop].y-=obj[loop].yi; // Move Object Down The Screen
213  obj[loop].spinz+=obj[loop].spinzi; // Increase Z Rotation By spinzi
214  obj[loop].flap+=obj[loop].fi; // Increase flap Value By fi
215 
216  if (obj[loop].y<-18.0f) // Is Object Off The Screen?
217  {
218  SetObject(loop); // If So, Reassign New Values
219  }
220 
221  if ((obj[loop].flap>1.0f) || (obj[loop].flap<-1.0f)) // Time To Change Flap Direction?
222  {
223  obj[loop].fi=-obj[loop].fi; // Change Direction By Making fi = -fi
224  }
225  }
226 
227  Sleep(15); // Create A Short Delay (15 Milliseconds)
228 
229  glFlush ();
230 
231 }
#define GL_TRIANGLES
Definition: gl.h:194
#define GL_COLOR_BUFFER_BIT
Definition: gl.h:716
GLAPI void GLAPIENTRY glClear(GLbitfield mask)
GLAPI void GLAPIENTRY glTranslatef(GLfloat x, GLfloat y, GLfloat z)
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:736
GLAPI void GLAPIENTRY glVertex3f(GLfloat x, GLfloat y, GLfloat z)
GLAPI void GLAPIENTRY glBindTexture(GLenum target, GLuint texture)
#define GL_DEPTH_BUFFER_BIT
Definition: gl.h:710
GLAPI void GLAPIENTRY glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
void SetObject(int loop)
Definition: butterflies.c:75
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLdouble GLdouble z
Definition: glext.h:5874
GLfloat f
Definition: glext.h:7540
GLenum GLuint texture
Definition: glext.h:6295
BOOL dRotate
Definition: butterflies.c:17
GLAPI void GLAPIENTRY glBegin(GLenum mode)
GLAPI void GLAPIENTRY glFlush(void)
GLAPI void GLAPIENTRY glLoadIdentity(void)
GLAPI void GLAPIENTRY glTexCoord2f(GLfloat s, GLfloat t)
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
#define GL_TEXTURE_2D
Definition: gl.h:645
GLAPI void GLAPIENTRY glEnd(void)

Referenced by ScreenSaverProc().

◆ InitOGLWindow()

HGLRC InitOGLWindow ( HWND  hWnd)

Definition at line 117 of file butterflies.c.

118 {
119  HDC hDC = GetDC(hWnd);
120  HGLRC hRC = 0;
122  int nFormat;
123 
125 
126  pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR);
127  pfd.nVersion = 1;
129  pfd.cColorBits = 24;
130  pfd.cDepthBits = 24;
131 
132  nFormat = ChoosePixelFormat(hDC, &pfd);
133  DescribePixelFormat(hDC, nFormat, sizeof(PIXELFORMATDESCRIPTOR), &pfd);
134  SetPixelFormat(hDC, nFormat, &pfd);
135 
138 
139  ReleaseDC(hWnd, hDC);
140 
141  return hRC;
142 }
static HGLRC hRC
Definition: 3dtext.c:32
static HGLRC(WINAPI *pwglCreateContextAttribsARB)(HDC hDC
HDC WINAPI GetDC(_In_opt_ HWND)
static HDC
Definition: imagelist.c:92
HWND hWnd
Definition: settings.c:17
#define ZeroMemory
Definition: winbase.h:1635
BOOL WINAPI SetPixelFormat(_In_ HDC, _In_ int, _In_ const PIXELFORMATDESCRIPTOR *)
#define PFD_DOUBLEBUFFER
Definition: wingdi.h:300
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
int WINAPI DescribePixelFormat(_In_ HDC hdc, _In_ int iPixelFormat, _In_ UINT nBytes, _Out_writes_bytes_opt_(nBytes) LPPIXELFORMATDESCRIPTOR ppfd)
int WINAPI ChoosePixelFormat(_In_ HDC hdc, _In_ const PIXELFORMATDESCRIPTOR *ppfd)
static PIXELFORMATDESCRIPTOR pfd
Definition: ssstars.c:67
BOOL WINAPI wglMakeCurrent(HDC hdc, HGLRC hglrc)
Definition: wgl.c:650
static HDC hDC
Definition: 3dtext.c:33
struct tagPIXELFORMATDESCRIPTOR PIXELFORMATDESCRIPTOR
#define PFD_SUPPORT_OPENGL
Definition: wingdi.h:305
#define PFD_DRAW_TO_WINDOW
Definition: wingdi.h:302
HGLRC WINAPI wglCreateContext(HDC hdc)
Definition: wgl.c:383

Referenced by ScreenSaverProc().

◆ InitOpenGL()

void InitOpenGL ( GLsizei  width,
GLsizei  height 
)

Definition at line 144 of file butterflies.c.

145 {
146  int loop;
147 
148  if (height==0) // Prevent A Divide By Zero By
149  {
150  height=1; // Making Height Equal One
151  }
152 
153  glViewport(0,0,width,height); // Reset The Current Viewport
154 
155  glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
156  glLoadIdentity(); // Reset The Projection Matrix
157 
158  // Calculate The Aspect Ratio Of The Window
159  gluPerspective (45.0f, (GLfloat)(width)/(GLfloat)(height),1.0f, 1000.0f);
160 
161  glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
162  glLoadIdentity();
163  // Start Of User Initialization
164  LoadGLTextures(); // Load The Textures From Our Resource File
165 
166  glClearColor (0.0f, 0.0f, 0.0f, 0.5f); // Black Background
167  glClearDepth (1.0f); // Depth Buffer Setup
168  glDepthFunc (GL_LEQUAL); // The Type Of Depth Testing (Less Or Equal)
169  glDisable(GL_DEPTH_TEST); // Disable Depth Testing
170  glShadeModel (GL_SMOOTH); // Select Smooth Shading
171  glHint (GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); // Set Perspective Calculations To Most Accurate
172  glEnable(GL_TEXTURE_2D); // Enable Texture Mapping
173  glBlendFunc(GL_ONE,GL_SRC_ALPHA); // Set Blending Mode (Cheap / Quick)
175 
176 
177  for (loop=0; loop<50; loop++) // Loop To Initialize 50 Objects
178  {
179  SetObject(loop); // Call SetObject To Assign New Random Values
180  }
181 
182 }
GLint GLint GLsizei width
Definition: gl.h:1546
#define GL_LEQUAL
Definition: gl.h:296
#define GL_ONE
Definition: gl.h:375
#define GL_BLEND
Definition: gl.h:371
GLAPI void GLAPIENTRY glMatrixMode(GLenum mode)
void LoadGLTextures()
Definition: butterflies.c:87
void SetObject(int loop)
Definition: butterflies.c:75
#define GL_PERSPECTIVE_CORRECTION_HINT
Definition: gl.h:578
#define GL_SMOOTH
Definition: gl.h:339
GLAPI void GLAPIENTRY glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
#define gluPerspective
Definition: glu_mangle.h:28
GLAPI void GLAPIENTRY glBlendFunc(GLenum sfactor, GLenum dfactor)
GLAPI void GLAPIENTRY glShadeModel(GLenum mode)
GLAPI void GLAPIENTRY glDisable(GLenum cap)
GLfloat f
Definition: glext.h:7540
GLAPI void GLAPIENTRY glHint(GLenum target, GLenum mode)
#define GL_PROJECTION
Definition: gl.h:246
#define GL_NICEST
Definition: gl.h:585
GLAPI void GLAPIENTRY glEnable(GLenum cap)
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
#define GL_DEPTH_TEST
Definition: gl.h:301
GLAPI void GLAPIENTRY glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
GLAPI void GLAPIENTRY glLoadIdentity(void)
#define GL_MODELVIEW
Definition: gl.h:245
#define GL_TEXTURE_2D
Definition: gl.h:645
float GLfloat
Definition: gl.h:161
GLAPI void GLAPIENTRY glClearDepth(GLclampd depth)
#define GL_SRC_ALPHA
Definition: gl.h:378
GLAPI void GLAPIENTRY glDepthFunc(GLenum func)

Referenced by ScreenSaverProc().

◆ LoadGLTextures()

void LoadGLTextures ( )

Definition at line 87 of file butterflies.c.

88 {
89  HBITMAP hBMP; // Handle Of The Bitmap
90  BITMAP BMP; // Bitmap Structure
91  int loop;
92 
93  // The ID Of The 3 Bitmap Images We Want To Load From The Resource File
94  byte Texture[]={ IDB_BUTTERFLY1, IDB_BUTTERFLY2, IDB_BUTTERFLY3 };
95 
96  glGenTextures(sizeof(Texture), &texture[0]); // Generate 3 Textures (sizeof(Texture)=3 ID's)
97  for (loop=0; loop<sizeof(Texture); loop++) // Loop Through All The ID's (Bitmap Images)
98  {
100  if (hBMP) // Does The Bitmap Exist?
101  { // If So...
102  GetObject(hBMP,sizeof(BMP), &BMP); // Get The Object
103  // hBMP: Handle To Graphics Object
104  // sizeof(BMP): Size Of Buffer For Object Information
105  // Buffer For Object Information
106  glPixelStorei(GL_UNPACK_ALIGNMENT,4); // Pixel Storage Mode (Word Alignment / 4 Bytes)
107  glBindTexture(GL_TEXTURE_2D, texture[loop]); // Bind Our Texture
110 
111  // Generate Mipmapped Texture (3 Bytes, Width, Height And Data From The BMP)
112  gluBuild2DMipmaps(GL_TEXTURE_2D, 3, BMP.bmWidth, BMP.bmHeight, GL_BGR_EXT, GL_UNSIGNED_BYTE, BMP.bmBits);
113  }
114  }
115 }
#define GL_BGR_EXT
Definition: glext.h:3114
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define gluBuild2DMipmaps
Definition: glu_mangle.h:35
GLAPI void GLAPIENTRY glBindTexture(GLenum target, GLuint texture)
#define GL_UNSIGNED_BYTE
Definition: gl.h:178
GLAPI void GLAPIENTRY glGenTextures(GLsizei n, GLuint *textures)
Definition: image.c:4224
GLAPI void GLAPIENTRY glTexParameteri(GLenum target, GLenum pname, GLint param)
#define GL_UNPACK_ALIGNMENT
Definition: gl.h:632
smooth NULL
Definition: ftsmooth.c:416
GLAPI void GLAPIENTRY glPixelStorei(GLenum pname, GLint param)
#define GL_TEXTURE_MIN_FILTER
Definition: gl.h:649
GLenum GLuint texture
Definition: glext.h:6295
#define GL_LINEAR
Definition: gl.h:421
#define GetObject
Definition: wingdi.h:4446
#define IDB_BUTTERFLY2
Definition: resource.h:8
#define GetModuleHandle
Definition: winbase.h:3641
#define GL_TEXTURE_MAG_FILTER
Definition: gl.h:648
Definition: bl.h:1331
#define LR_CREATEDIBSECTION
Definition: winuser.h:1088
#define GL_LINEAR_MIPMAP_LINEAR
Definition: gl.h:670
#define IMAGE_BITMAP
Definition: winuser.h:211
#define GL_TEXTURE_2D
Definition: gl.h:645
#define IDB_BUTTERFLY1
Definition: resource.h:7
#define IDB_BUTTERFLY3
Definition: resource.h:9
#define LoadImage
Definition: winuser.h:5681
static HBITMAP
Definition: button.c:44

Referenced by InitOpenGL().

◆ ReadRegistry()

void ReadRegistry ( )

Definition at line 41 of file butterflies.c.

41  {
42  LONG result;
43  HKEY skey;
44  DWORD valtype, valsize, val;
45 
46  SetDefaults();
47 
49  if(result != ERROR_SUCCESS)
50  return;
51 
52  valsize=sizeof(val);
53 
54  result = RegQueryValueEx(skey, _T("Rotate"), 0, &valtype, (LPBYTE)&val, &valsize);
55  if(result == ERROR_SUCCESS)
56  dRotate = val;
57  RegCloseKey(skey);
58 }
#define RegQueryValueEx
Definition: winreg.h:524
#define ERROR_SUCCESS
Definition: deptool.c:10
#define KEY_READ
Definition: nt_native.h:1023
#define HKEY_CURRENT_USER
Definition: winreg.h:11
LPCTSTR registryPath
Definition: butterflies.c:16
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
long LONG
Definition: pedump.c:60
GLuint GLfloat * val
Definition: glext.h:7180
#define _T(x)
Definition: vfdio.h:22
BOOL dRotate
Definition: butterflies.c:17
unsigned long DWORD
Definition: ntddk_ex.h:95
void SetDefaults()
Definition: butterflies.c:36
#define RegOpenKeyEx
Definition: winreg.h:520
GLuint64EXT * result
Definition: glext.h:11304

Referenced by ScreenSaverConfigureDialog(), and ScreenSaverProc().

◆ RegisterDialogClasses()

BOOL WINAPI RegisterDialogClasses ( HANDLE  hInst)

Definition at line 325 of file butterflies.c.

326 {
327  return TRUE;
328 }
#define TRUE
Definition: types.h:120

◆ ScreenSaverConfigureDialog()

BOOL WINAPI ScreenSaverConfigureDialog ( HWND  hDlg,
UINT  message,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 296 of file butterflies.c.

298 {
299  switch (message)
300  {
301  case WM_INITDIALOG:
302  ReadRegistry();
303  CheckDlgButton(hDlg, ROTATE, dRotate);
304  return TRUE;
305  case WM_COMMAND:
306  switch (LOWORD(wParam))
307  {
308  case IDOK:
310  WriteRegistry();
311  EndDialog(hDlg, TRUE);
312  return TRUE;
313  case IDCANCEL:
314  EndDialog(hDlg, TRUE);
315  break;
316  case IDABOUT:
318  break;
319  }
320  }
321 
322  return FALSE;
323 }
INT_PTR CALLBACK AboutProc(HWND hdlg, UINT msg, WPARAM wpm, LPARAM lpm)
Definition: butterflies.c:233
#define MAKEINTRESOURCE
Definition: winuser.h:591
BOOL WINAPI CheckDlgButton(_In_ HWND, _In_ int, _In_ UINT)
Definition: tftpd.h:59
#define TRUE
Definition: types.h:120
#define IDOK
Definition: winuser.h:824
#define IDABOUT
Definition: resource.h:5
HINSTANCE hInstance
Definition: butterflies.c:12
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
#define DialogBox
Definition: winuser.h:5627
#define ROTATE
Definition: resource.h:12
void WriteRegistry()
Definition: butterflies.c:60
UINT WINAPI IsDlgButtonChecked(_In_ HWND, _In_ int)
BOOL dRotate
Definition: butterflies.c:17
void ReadRegistry()
Definition: butterflies.c:41
#define WM_COMMAND
Definition: winuser.h:1716
#define BST_CHECKED
Definition: winuser.h:197
#define IDD_DLG_ABOUT
Definition: resource.h:11
#define IDCANCEL
Definition: winuser.h:825
#define WM_INITDIALOG
Definition: winuser.h:1715
#define LOWORD(l)
Definition: pedump.c:82

◆ ScreenSaverProc()

LRESULT WINAPI ScreenSaverProc ( HWND  hWnd,
UINT  message,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 260 of file butterflies.c.

262 {
263  static HGLRC hRC;
264  static DWORD timer = 1;
265  HDC hDC;
266  RECT WindowRect;
267  int width;
268  int height;
269 
270  switch (message)
271  {
272  case WM_CREATE:
273  ReadRegistry();
275  GetClientRect (hWnd, &WindowRect);
276  width = WindowRect.right - WindowRect.left;
277  height = WindowRect.bottom - WindowRect.top;
279  SetTimer(hWnd, timer, 5, NULL);
280  break;
281  case WM_TIMER:
282  hDC = GetDC(hWnd);
283  Display();
284  SwapBuffers(hDC);
285  ReleaseDC(hWnd, hDC);
286  break;
287  case WM_DESTROY:
290  break;
291  }
292 
294 }
static HGLRC hRC
Definition: 3dtext.c:32
static HGLRC(WINAPI *pwglCreateContextAttribsARB)(HDC hDC
GLint GLint GLsizei width
Definition: gl.h:1546
Definition: tftpd.h:59
BOOL WINAPI wglDeleteContext(HGLRC hglrc)
Definition: wgl.c:514
HDC WINAPI GetDC(_In_opt_ HWND)
static HDC
Definition: imagelist.c:92
HWND hWnd
Definition: settings.c:17
void InitOpenGL(GLsizei width, GLsizei height)
Definition: butterflies.c:144
LONG top
Definition: windef.h:292
LONG left
Definition: windef.h:291
LONG right
Definition: windef.h:293
WPARAM wParam
Definition: combotst.c:138
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
smooth NULL
Definition: ftsmooth.c:416
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
#define WM_DESTROY
Definition: winuser.h:1591
BOOL WINAPI SwapBuffers(HDC)
Definition: wingl.c:187
HGLRC InitOGLWindow(HWND hWnd)
Definition: butterflies.c:117
#define WM_TIMER
Definition: winuser.h:1718
unsigned long DWORD
Definition: ntddk_ex.h:95
void ReadRegistry()
Definition: butterflies.c:41
BOOL WINAPI wglMakeCurrent(HDC hdc, HGLRC hglrc)
Definition: wgl.c:650
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
static HDC hDC
Definition: 3dtext.c:33
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define WM_CREATE
Definition: winuser.h:1590
LRESULT WINAPI DefScreenSaverProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: scrnsave.c:95
LONG bottom
Definition: windef.h:294
LPARAM lParam
Definition: combotst.c:139
void Display()
Definition: butterflies.c:184

◆ SetDefaults()

void SetDefaults ( )

Definition at line 36 of file butterflies.c.

37 {
38  dRotate = TRUE;
39 }
#define TRUE
Definition: types.h:120
BOOL dRotate
Definition: butterflies.c:17

Referenced by DECLARE_INTERFACE_(), and ReadRegistry().

◆ SetObject()

void SetObject ( int  loop)

Definition at line 75 of file butterflies.c.

76 {
77  obj[loop].tex=rand()%3; // Texture Can Be One Of 3 Textures
78  obj[loop].x=rand()%34-17.0f; // Random x Value From -17.0f To 17.0f
79  obj[loop].y=18.0f; // Set y Position To 18 (Off Top Of Screen)
80  obj[loop].z=-((rand()%30000/1000.0f)+10.0f); // z Is A Random Value From -10.0f To -40.0f
81  obj[loop].spinzi=(rand()%10000)/5000.0f-1.0f; // spinzi Is A Random Value From -1.0f To 1.0f
82  obj[loop].flap=0.0f; // flap Starts Off At 0.0f;
83  obj[loop].fi=0.05f+(rand()%100)/1000.0f; // fi Is A Random Value From 0.05f To 0.15f
84  obj[loop].yi=0.001f+(rand()%1000)/10000.0f; // yi Is A Random Value From 0.001f To 0.101f
85 }
_Check_return_ int __cdecl rand(void)
Definition: rand.c:10
GLfloat f
Definition: glext.h:7540

Referenced by DECLARE_INTERFACE_(), Display(), and InitOpenGL().

◆ WriteRegistry()

void WriteRegistry ( )

Definition at line 60 of file butterflies.c.

60  {
61  LONG result;
62  HKEY skey;
63  DWORD val, disp;
64 
66  if(result != ERROR_SUCCESS)
67  return;
68 
69  val = dRotate;
70  RegSetValueEx(skey, _T("Rotate"), 0, REG_DWORD, (CONST BYTE*)&val, sizeof(val));
71 
72  RegCloseKey(skey);
73 }
disp
Definition: i386-dis.c:3181
#define ERROR_SUCCESS
Definition: deptool.c:10
#define HKEY_CURRENT_USER
Definition: winreg.h:11
LPCTSTR registryPath
Definition: butterflies.c:16
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
GLuint GLfloat * val
Definition: glext.h:7180
#define REG_OPTION_NON_VOLATILE
Definition: nt_native.h:1057
#define KEY_WRITE
Definition: nt_native.h:1031
#define _T(x)
Definition: vfdio.h:22
BOOL dRotate
Definition: butterflies.c:17
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned char BYTE
Definition: mem.h:68
GLuint64EXT * result
Definition: glext.h:11304
#define REG_DWORD
Definition: sdbapi.c:596
#define CONST
Definition: pedump.c:81
#define RegSetValueEx
Definition: winreg.h:533
#define RegCreateKeyEx
Definition: winreg.h:501

Referenced by ScreenSaverConfigureDialog().

Variable Documentation

◆ dRotate

BOOL dRotate

◆ hInstance

HINSTANCE hInstance

Definition at line 12 of file butterflies.c.

Referenced by ScreenSaverConfigureDialog().

◆ obj

Definition at line 33 of file butterflies.c.

◆ registryPath

LPCTSTR registryPath = _T("Software\\Microsoft\\ScreenSavers\\Butterflies")

◆ texture

Definition at line 14 of file butterflies.c.