graphics2.C
		graphics2_win.C

svn path=/trunk/boinc/; revision=12717
This commit is contained in:
David Anderson 2007-05-22 21:26:47 +00:00
parent fe68a746fd
commit 38aaf5ee9c
3 changed files with 40 additions and 9 deletions

View File

@ -1,3 +1,6 @@
#include "util.h"
#include "graphics_api.h"
double boinc_max_fps;
double boinc_max_gfx_cpu_frac;
@ -57,3 +60,17 @@ bool throttled_app_render(int x, int y, double t) {
}
return false;
}
void get_window_title(APP_INIT_DATA& aid, char* buf, int len) {
if (aid.app_version) {
snprintf(buf, len,
"%s version %.2f [workunit: %s]",
aid.app_name, aid.app_version/100.0, aid.wu_name
);
} else {
snprintf(buf, len,
"%s [workunit: %s]",
aid.app_name, aid.wu_name
);
}
}

View File

@ -21,6 +21,7 @@
#include "graphics_api.h"
#include "app_ipc.h"
#include "util.h"
#include "str_util.h"
#include "graphics_impl.h"
#define BOINC_WINDOW_CLASS_NAME "BOINC_app"
@ -40,6 +41,7 @@ static HDC myhDC;
static bool visible = true;
static bool window_ready=false;
static UINT_PTR gfx_timer_id = 0;
static bool fullscreen;
void close_window() {
window_ready=false;
@ -181,16 +183,16 @@ LRESULT CALLBACK WndProc(
return 0;
case WM_KEYDOWN:
if(!window_ready) return 0;
if (current_graphics_mode == MODE_FULLSCREEN) {
set_mode(MODE_HIDE_GRAPHICS);
if (fullscreen) {
close_window();
} else {
boinc_app_key_press((int)wParam, (int)lParam);
}
return 0;
case WM_KEYUP:
if(!window_ready) return 0;
if (current_graphics_mode == MODE_FULLSCREEN) {
set_mode(MODE_HIDE_GRAPHICS);
if (fullscreen) {
close_window();
} else {
boinc_app_key_release((int)wParam, (int)lParam);
}
@ -334,10 +336,17 @@ void boinc_graphics(int argc, char** argv) {
fullscreen = true;
}
}
boinc_get_init_data(aid);
if (!strlen(aid.app_name)) {
strcpy(aid.app_name, "BOINC Application");
}
make_window(fullscreen);
make_window();
win_graphics_event_loop();
}
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR Args, int WinMode) {
LPSTR command_line;
char* argv[100];
int argc;
command_line = GetCommandLine();
argc = parse_command_line( command_line, argv );
boinc_graphics(argc, argv);
}

View File

@ -5182,3 +5182,8 @@ David 22 May 2007
graphics2_win.C (new)
sched/
Makefile.am
David 22 May 2007
api/
graphics2.C
graphics2_win.C