Skip to content

Commit

Permalink
Can build screensaver. I need to embed data files so that it doesn't …
Browse files Browse the repository at this point in the history
…need any files in Windows directory.
  • Loading branch information
captainys committed Feb 2, 2022
1 parent d1c2fca commit fa219ee
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 56 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ project(FLYBY2)
add_subdirectory(impulse/src)
add_subdirectory(hotas/src)
add_subdirectory(skyhawk/SRC)
add_subdirectory(aurora/src)
add_subdirectory(flyby2)
add_subdirectory(flyby2_s)
8 changes: 4 additions & 4 deletions flyby2_s/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
add_executable(flyby2_s.scr FLYBY2_S.c)
target_link_libraries(flyby2_s.scr impulse_win32scsv hotas_win32 skyhawk)
add_executable(flyby2_s.scr flyby2_s.c)
target_link_libraries(flyby2_s.scr impulse_win32scsv hotas_win32 skyhawk aurora winmm)

add_executable(flyby2_s_gl.scr FLYBY2_S.c)
target_link_libraries(flyby2_s_gl.scr impulse_win32scsvogl hotas_win32 skyhawk)
add_executable(flyby2_s_gl.scr flyby2_s.c)
target_link_libraries(flyby2_s_gl.scr impulse_win32scsvogl hotas_win32 skyhawk aurora winmm)
6 changes: 4 additions & 2 deletions impulse/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,11 @@ target_link_libraries(impulse_win32ogl gdi32.lib user32.lib kernel32.lib opengl3
target_include_directories(impulse_win32ogl PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})

add_library(impulse_win32scsv ${SRCS} ${WINSCSVSRCS})
target_link_libraries(impulse_win32scsv gdi32.lib user32.lib kernel32.lib SCRNSAVE.lib)
target_link_libraries(impulse_win32scsv gdi32.lib user32.lib kernel32.lib SCRNSAVE.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib comctl32.lib
)
target_include_directories(impulse_win32scsv PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})

add_library(impulse_win32scsvogl ${SRCS} ${WINOGLSCSVSRCS})
target_link_libraries(impulse_win32scsvogl gdi32.lib user32.lib kernel32.lib opengl32.lib glu32.lib SCRNSAVE.lib)
target_link_libraries(impulse_win32scsvogl gdi32.lib user32.lib kernel32.lib opengl32.lib glu32.lib SCRNSAVE.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib comctl32.lib
)
target_include_directories(impulse_win32scsvogl PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
64 changes: 14 additions & 50 deletions impulse/src/winscsvogl/iwinscsvogl.c
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,8 @@ int started=BI_FALSE;
int irqMask=0; // <- To prevent infinite loop.
unsigned prevTickCount=0; // Currently not used

HANDLE thread=NULL;
int threadId;

LRESULT CALLBACK ScreenSaverProc(HWND w,UINT msg,WPARAM wPara,LPARAM lPara)
{
Expand Down Expand Up @@ -422,8 +424,19 @@ LRESULT CALLBACK ScreenSaverProc(HWND w,UINT msg,WPARAM wPara,LPARAM lPara)
if(irqMask==0)
{
irqMask=1;

ScSvInitialize();
ScSvInterval();

thread=CreateThread(NULL,0,
(LPTHREAD_START_ROUTINE)ScSvMain,
NULL,
STANDARD_RIGHTS_REQUIRED,
&threadId);
if(thread!=NULL)
{
SetThreadPriority(thread, THREAD_PRIORITY_BELOW_NORMAL);
}

irqMask=0;
}

Expand Down Expand Up @@ -457,55 +470,6 @@ LRESULT CALLBACK ScreenSaverProc(HWND w,UINT msg,WPARAM wPara,LPARAM lPara)
}
exit(0);
break;
case WM_TIMER:
case WM_APP:
if(BiWnd!=NULL && irqMask==0)
{
RECT rcScsv,rcOpenGl;

GetWindowRect(w,&rcScsv);
GetWindowRect(BiWnd,&rcOpenGl);
if(rcScsv.left!=rcOpenGl.left || rcScsv.top!=rcOpenGl.top)
{
long sizX,sizY,lupX,lupY;

sizX=BiWinX; // size of rcScsv is (1,1), so must user BiWinX,BiWinY
sizY=BiWinY;

lupX=rcScsv.left;
lupY=rcScsv.top;

MoveWindow(BiWnd,lupX,lupY,sizX,sizY,TRUE);

wglMakeCurrent(BiWndDC,BiGlRC);
glViewport(0,0,sizX,sizY);

{ // desparate solution : Repaint parents!
HWND par;
int i;
par=GetParent(w);
for(i=0; i<4 && par!=NULL; i++)
{
InvalidateRect(par,NULL,FALSE);
par=GetParent(par);
}
}
}

irqMask=1;
InvalidateRect(BiWnd,NULL,FALSE);
wglMakeCurrent(BiWndDC,BiGlRC);
ScSvInterval();
irqMask=0;

PostMessage(w,WM_APP,0,0);
}

return 0L;
case WM_MOVE:
{
}
return 0L;
}
return DefScreenSaverProc(w,msg,wPara,lPara);
}
Expand Down

0 comments on commit fa219ee

Please sign in to comment.