Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
0872f30a
Commit
0872f30a
authored
Apr 04, 2000
by
Joshua Thielen
Committed by
Alexandre Julliard
Apr 04, 2000
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added DestroyBoard function to delete bitmap handles.
Moved SelectObject outside of DrawMine. Selected old object's back into hMemDC.
parent
21c04b9d
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
7 deletions
+28
-7
main.c
programs/winemine/main.c
+26
-7
main.h
programs/winemine/main.h
+2
-0
No files found.
programs/winemine/main.c
View file @
0872f30a
...
...
@@ -111,6 +111,7 @@ LRESULT WINAPI MainProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
case
WM_DESTROY
:
SaveBoard
(
&
board
);
DestroyBoard
(
&
board
);
PostQuitMessage
(
0
);
return
0
;
...
...
@@ -418,6 +419,13 @@ void SaveBoard( BOARD *p_board )
RegCloseKey
(
hkey
);
}
void
DestroyBoard
(
BOARD
*
p_board
)
{
DeleteObject
(
p_board
->
hFacesBMP
);
DeleteObject
(
p_board
->
hLedsBMP
);
DeleteObject
(
p_board
->
hMinesBMP
);
}
void
SetDifficulty
(
BOARD
*
p_board
,
DIFFICULTY
difficulty
)
{
HMENU
hMenu
=
GetMenu
(
p_board
->
hWnd
);
...
...
@@ -588,14 +596,16 @@ void CreateBoxes( BOARD *p_board )
void
DrawMines
(
HDC
hdc
,
HDC
hMemDC
,
BOARD
*
p_board
)
{
HGDIOBJ
hOldObj
;
unsigned
col
,
row
;
hOldObj
=
SelectObject
(
hMemDC
,
p_board
->
hMinesBMP
);
for
(
row
=
1
;
row
<=
p_board
->
rows
;
row
++
)
{
for
(
col
=
1
;
col
<=
p_board
->
cols
;
col
++
)
{
DrawMine
(
hdc
,
hMemDC
,
p_board
,
col
,
row
,
FALSE
);
}
}
SelectObject
(
hMemDC
,
hOldObj
);
}
void
DrawMine
(
HDC
hdc
,
HDC
hMemDC
,
BOARD
*
p_board
,
unsigned
col
,
unsigned
row
,
BOOL
IsPressed
)
...
...
@@ -666,19 +676,16 @@ void DrawMine( HDC hdc, HDC hMemDC, BOARD *p_board, unsigned col, unsigned row,
&&
!
p_board
->
box
[
col
][
row
].
IsMine
)
offset
=
(
MINEBMP_OFFSET
)
p_board
->
box
[
col
][
row
].
NumMines
;
SelectObject
(
hMemDC
,
p_board
->
hMinesBMP
);
BitBlt
(
hdc
,
(
col
-
1
)
*
MINE_WIDTH
+
p_board
->
mines_rect
.
left
,
(
row
-
1
)
*
MINE_HEIGHT
+
p_board
->
mines_rect
.
top
,
MINE_WIDTH
,
MINE_HEIGHT
,
hMemDC
,
0
,
offset
*
MINE_HEIGHT
,
SRCCOPY
);
}
void
DrawLeds
(
HDC
hdc
,
HDC
hMemDC
,
BOARD
*
p_board
,
int
number
,
int
x
,
int
y
)
{
HGDIOBJ
hOldObj
;
unsigned
led
[
3
],
i
;
int
count
;
...
...
@@ -706,7 +713,7 @@ void DrawLeds( HDC hdc, HDC hMemDC, BOARD *p_board, int number, int x, int y )
for
(
i
=
0
;
i
<
3
;
i
++
)
led
[
i
]
=
11
;
SelectObject
(
hMemDC
,
p_board
->
hLedsBMP
);
hOldObj
=
SelectObject
(
hMemDC
,
p_board
->
hLedsBMP
);
for
(
i
=
0
;
i
<
3
;
i
++
)
{
BitBlt
(
hdc
,
...
...
@@ -719,12 +726,16 @@ void DrawLeds( HDC hdc, HDC hMemDC, BOARD *p_board, int number, int x, int y )
led
[
i
]
*
LED_HEIGHT
,
SRCCOPY
);
}
SelectObject
(
hMemDC
,
hOldObj
);
}
void
DrawFace
(
HDC
hdc
,
HDC
hMemDC
,
BOARD
*
p_board
)
{
SelectObject
(
hMemDC
,
p_board
->
hFacesBMP
);
HGDIOBJ
hOldObj
;
hOldObj
=
SelectObject
(
hMemDC
,
p_board
->
hFacesBMP
);
BitBlt
(
hdc
,
p_board
->
face_rect
.
left
,
...
...
@@ -732,6 +743,8 @@ void DrawFace( HDC hdc, HDC hMemDC, BOARD *p_board )
FACE_WIDTH
,
FACE_HEIGHT
,
hMemDC
,
0
,
p_board
->
face_bmp
*
FACE_HEIGHT
,
SRCCOPY
);
SelectObject
(
hMemDC
,
hOldObj
);
}
...
...
@@ -956,13 +969,16 @@ void AddFlag( BOARD *p_board, unsigned col, unsigned row )
void
PressBox
(
BOARD
*
p_board
,
unsigned
col
,
unsigned
row
)
{
HDC
hdc
;
HGDIOBJ
hOldObj
;
HDC
hMemDC
;
hdc
=
GetDC
(
p_board
->
hWnd
);
hMemDC
=
CreateCompatibleDC
(
hdc
);
hOldObj
=
SelectObject
(
hMemDC
,
p_board
->
hMinesBMP
);
DrawMine
(
hdc
,
hMemDC
,
p_board
,
col
,
row
,
TRUE
);
SelectObject
(
hMemDC
,
hOldObj
);
DeleteDC
(
hMemDC
);
ReleaseDC
(
p_board
->
hWnd
,
hdc
);
}
...
...
@@ -998,13 +1014,16 @@ void PressBoxes( BOARD *p_board, unsigned col, unsigned row )
void
UnpressBox
(
BOARD
*
p_board
,
unsigned
col
,
unsigned
row
)
{
HDC
hdc
;
HGDIOBJ
hOldObj
;
HDC
hMemDC
;
hdc
=
GetDC
(
p_board
->
hWnd
);
hMemDC
=
CreateCompatibleDC
(
hdc
);
hOldObj
=
SelectObject
(
hMemDC
,
p_board
->
hMinesBMP
);
DrawMine
(
hdc
,
hMemDC
,
p_board
,
col
,
row
,
FALSE
);
SelectObject
(
hMemDC
,
hOldObj
);
DeleteDC
(
hMemDC
);
ReleaseDC
(
p_board
->
hWnd
,
hdc
);
}
...
...
programs/winemine/main.h
View file @
0872f30a
...
...
@@ -108,6 +108,8 @@ void LoadBoard( BOARD *p_board );
void
SaveBoard
(
BOARD
*
p_board
);
void
DestroyBoard
(
BOARD
*
p_board
);
void
SetDifficulty
(
BOARD
*
p_board
,
DIFFICULTY
difficulty
);
void
CheckLevel
(
BOARD
*
p_board
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment