Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygopro-2pick
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
ygopro-2pick
Commits
f6dfd298
Commit
f6dfd298
authored
Jul 21, 2019
by
mercury233
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://github.com/Fluorohydride/ygopro
into server
parents
049d3cf7
49ae7129
Changes
4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
259 additions
and
151 deletions
+259
-151
gframe/drawing.cpp
gframe/drawing.cpp
+2
-2
gframe/game.cpp
gframe/game.cpp
+1
-1
gframe/mysignal.h
gframe/mysignal.h
+16
-100
lflist.conf
lflist.conf
+240
-48
No files found.
gframe/drawing.cpp
View file @
f6dfd298
...
...
@@ -1142,8 +1142,8 @@ void Game::DrawDeckBd() {
driver
->
draw2DRectangleOutline
(
Resize
(
313
+
i
*
dx
,
563
,
359
+
i
*
dx
,
629
));
}
//search result
driver
->
draw2DRectangle
(
Resize
(
805
,
137
,
9
15
,
157
),
0x400000ff
,
0x400000ff
,
0x40000000
,
0x40000000
);
driver
->
draw2DRectangleOutline
(
Resize
(
804
,
136
,
9
15
,
157
));
driver
->
draw2DRectangle
(
Resize
(
805
,
137
,
9
26
,
157
),
0x400000ff
,
0x400000ff
,
0x40000000
,
0x40000000
);
driver
->
draw2DRectangleOutline
(
Resize
(
804
,
136
,
9
26
,
157
));
DrawShadowText
(
textFont
,
dataManager
.
GetSysString
(
1333
),
Resize
(
810
,
137
,
915
,
157
),
Resize
(
1
,
1
,
1
,
1
),
0xffffffff
,
0xff000000
,
false
,
true
);
DrawShadowText
(
numFont
,
deckBuilder
.
result_string
,
Resize
(
875
,
137
,
935
,
157
),
Resize
(
1
,
1
,
1
,
1
),
0xffffffff
,
0xff000000
,
false
,
true
);
driver
->
draw2DRectangle
(
Resize
(
805
,
160
,
1020
,
630
),
0x400000ff
,
0x400000ff
,
0x40000000
,
0x40000000
);
...
...
gframe/game.cpp
View file @
f6dfd298
...
...
@@ -863,7 +863,7 @@ void Game::MainLoop() {
}
}
driver
->
endScene
();
if
(
closeSignal
.
Wait
(
0
))
if
(
closeSignal
.
Wait
(
1
))
CloseDuelWindow
();
fps
++
;
cur_time
=
timer
->
getTime
();
...
...
gframe/mysignal.h
View file @
f6dfd298
#ifndef SIGNAL_H
#define SIGNAL_H
#ifdef _WIN32
#include <windows.h>
class
Signal
{
public:
Signal
()
{
_event
=
CreateEvent
(
0
,
FALSE
,
FALSE
,
0
);
_nowait
=
false
;
}
~
Signal
()
{
CloseHandle
(
_event
);
}
void
Set
()
{
SetEvent
(
_event
);
}
void
Reset
()
{
ResetEvent
(
_event
);
}
void
Wait
()
{
if
(
_nowait
)
return
;
WaitForSingleObject
(
_event
,
INFINITE
);
}
bool
Wait
(
long
milli
)
{
if
(
_nowait
)
return
false
;
return
WaitForSingleObject
(
_event
,
milli
+
1
)
!=
WAIT_TIMEOUT
;
}
void
SetNoWait
(
bool
nowait
)
{
_nowait
=
nowait
;
}
private:
HANDLE
_event
;
bool
_nowait
;
};
#else // _WIN32
#include <sys/time.h>
#include <pthread.h>
#include <mutex>
#include <condition_variable>
class
Signal
{
public:
Signal
()
{
_state
=
false
;
_nowait
=
false
;
pthread_mutex_init
(
&
_mutex
,
NULL
);
pthread_cond_init
(
&
_cond
,
NULL
);
}
~
Signal
()
{
pthread_cond_destroy
(
&
_cond
);
pthread_mutex_destroy
(
&
_mutex
);
}
void
Set
()
{
if
(
pthread_mutex_lock
(
&
_mutex
))
return
;
std
::
unique_lock
<
std
::
mutex
>
lock
(
_mutex
);
_state
=
true
;
if
(
pthread_cond_broadcast
(
&
_cond
))
{
pthread_mutex_unlock
(
&
_mutex
);
// ERROR Broadcasting event status!
return
;
}
pthread_mutex_unlock
(
&
_mutex
);
_cond
.
notify_all
();
}
void
Reset
()
{
if
(
pthread_mutex_lock
(
&
_mutex
))
return
;
std
::
unique_lock
<
std
::
mutex
>
lock
(
_mutex
);
_state
=
false
;
pthread_mutex_unlock
(
&
_mutex
);
}
void
Wait
()
{
if
(
_nowait
||
pthread_mutex_lock
(
&
_mutex
))
return
;
while
(
!
_state
)
{
if
(
pthread_cond_wait
(
&
_cond
,
&
_mutex
))
{
pthread_mutex_unlock
(
&
_mutex
);
// ERROR Waiting events;
if
(
_nowait
)
return
;
}
}
std
::
unique_lock
<
std
::
mutex
>
lock
(
_mutex
);
_cond
.
wait
(
lock
,
[
this
]()
{
return
_state
;
});
_state
=
false
;
pthread_mutex_unlock
(
&
_mutex
);
}
bool
Wait
(
long
milliseconds
)
{
if
(
_nowait
||
pthread_mutex_lock
(
&
_mutex
)
!=
0
)
return
false
;
int
rc
=
0
;
struct
timespec
abstime
;
struct
timeval
tv
;
gettimeofday
(
&
tv
,
NULL
);
abstime
.
tv_sec
=
tv
.
tv_sec
+
milliseconds
/
1000
;
abstime
.
tv_nsec
=
tv
.
tv_usec
*
1000
+
(
milliseconds
%
1000
)
*
1000000
;
if
(
abstime
.
tv_nsec
>=
1000000000
)
{
abstime
.
tv_nsec
-=
1000000000
;
abstime
.
tv_sec
++
;
}
while
(
!
_state
)
{
if
((
rc
=
pthread_cond_timedwait
(
&
_cond
,
&
_mutex
,
&
abstime
)))
{
if
(
rc
==
ETIMEDOUT
)
break
;
pthread_mutex_unlock
(
&
_mutex
);
bool
Wait
(
long
milliseconds
)
{
if
(
_nowait
)
return
false
;
}
}
std
::
unique_lock
<
std
::
mutex
>
lock
(
_mutex
);
bool
res
=
_cond
.
wait_for
(
lock
,
std
::
chrono
::
milliseconds
(
milliseconds
),
[
this
]()
{
return
_state
;
});
_state
=
false
;
pthread_mutex_unlock
(
&
_mutex
);
return
rc
==
0
;
return
res
;
}
void
SetNoWait
(
bool
nowait
)
{
_nowait
=
nowait
;
}
private:
pthread_mutex_t
_mutex
;
pthread_cond_t
_cond
;
std
::
mutex
_mutex
;
std
::
condition_variable
_cond
;
bool
_state
;
bool
_nowait
;
};
#endif // _WIN32
#endif // SIGNAL_H
lflist.conf
View file @
f6dfd298
This diff is collapsed.
Click to expand it.
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