示例#1
0
/**
 * Initialize the game state
 */
Common::ErrorCode MortevielleEngine::initialize() {
	// Initialize graphics mode
	initGraphics(SCREEN_WIDTH, SCREEN_HEIGHT, true);

	// Set debug channels
	DebugMan.addDebugChannel(kMortevielleCore, "core", "Core debugging");
	DebugMan.addDebugChannel(kMortevielleGraphics, "graphics", "Graphics debugging");

	// Set up an intermediate screen surface
	_screenSurface.create(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8());

	_txxFileFl = false;
	// Load texts from TXX files
	loadTexts();

	// Load the mort.dat resource
	Common::ErrorCode result = loadMortDat();
	if (result != Common::kNoError) {
		_screenSurface.free();
		return result;
	}

	// Load some error messages (was previously in chartex())
	_hintPctMessage = getString(580);  // You should have noticed %d hints

	// Set default EGA palette
	_paletteManager.setDefaultPalette();

	// Setup the mouse cursor
	initMouse();

	loadPalette();
	loadCFIPH();
	loadCFIEC();
	decodeNumber(&_cfiecBuffer[161 * 16], (_cfiecBufferSize - (161 * 16)) / 64);
	_x26KeyCount = 1;
	initMaxAnswer();
	initMouse();

	loadPlaces();
	_soundOff = false;
	_largestClearScreen = false;

	testKeyboard();
	showConfigScreen();
	testKeyboard();
	clearScreen();

	_soundManager.loadNoise();
	_soundManager.loadAmbiantSounds();

	return Common::kNoError;
}
示例#2
0
bool MouseKeyboardInput::initalise(HINSTANCE hInstance,HWND hWnd)
{
	winHandle = hWnd;

	HRESULT hr = DirectInput8Create(hInstance, DIRECTINPUT_VERSION,
    IID_IDirectInput8, (void**)&m_diObject, NULL);

	if(FAILED(m_diObject->CreateDevice(GUID_SysKeyboard, &m_diKeyboardDevice, NULL)))
	{
		GAMEERROR("Unable to create input device object.",winHandle);
		return false;
	}

	if( FAILED( initMouse() ) )
	{
		GAMEERROR("Unable to create mouse initalise mouse.",winHandle);
		return false;
	}

	if( FAILED( initKeyboard() ) )
	{
		GAMEERROR("Unable to create mouse initalise keyboard.",winHandle);
		return false;
	}

	return true;

}
示例#3
0
void initGLUT(int argc, char **argv) {
    /* Initialize GLUT */
    glutInit(&argc, argv);
	glutInitDisplayMode( GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH );
    glutInitWindowSize(window_width, window_height);
	glutCreateWindow("window_name");
    glutInitWindowPosition(100,50);

	glutDisplayFunc(display);
    glutKeyboardFunc(keyboard);
    glutReshapeFunc(reshape);
	
	/* set an idle function */
	glutIdleFunc(redisplay);
//	glutIdleFunc(NULL);

	/* init the mouse */
	initMouse();

	loadScene(argv[1]);

    /* Enter main loop */
	glutMainLoop();

	return;
}
示例#4
0
文件: ui.c 项目: jeremysrand/a2bejwld
void initUI(void)
{
    bool optionsLoaded;
    bool mouseInitialized;
    
    initMachine();
    
    optionsLoaded = loadOptions();
    
    initGameEngine(&gCallbacks);
    mouseInitialized = initMouse(&gMouseCallbacks);
    
    // If we couldn't initialize a mouse and it was enabled on the options, then disable it.
    if ((!mouseInitialized) &&
        (gGameOptions.enableMouse)) {
        gGameOptions.enableMouse = false;
        gGameOptions.optionsSaved = false;
        
        // If there were no options loaded, then let's turn on the joystick instead.
        if (!optionsLoaded) {
            gGameOptions.enableJoystick = true;
        }
    }
    
    initJoystick(&gJoyCallbacks);
    
    if (gGameOptions.enableSound) {
        soundInit(gGameOptions.mockingBoardSlot, gGameOptions.enableSpeechChip);
    }
    
    if (!gGameOptions.optionsSaved) {
        saveOptions();
    }
}
示例#5
0
文件: ui.c 项目: jeremysrand/a2bejwld
static void applyNewOptions(tGameOptions *newOptions)
{
    bool oldEnableMouse = gGameOptions.enableMouse;
    
    // If there is no change in game options, then nothing to do.
    if (memcmp(newOptions, &gGameOptions, sizeof(gGameOptions)) == 0) {
        return;
    }
    
    if ((gGameOptions.enableSound != newOptions->enableSound) ||
        (gGameOptions.mockingBoardSlot != newOptions->mockingBoardSlot) ||
        (gGameOptions.enableSpeechChip != gGameOptions.enableSpeechChip)) {
        // If the sound parameters have changed, then re-init or shutdown sounds
        if (newOptions->enableSound) {
            soundInit(newOptions->mockingBoardSlot, newOptions->enableSpeechChip);
        } else {
            soundShutdown();
        }
    }
    
    memcpy(&gGameOptions, newOptions, sizeof(gGameOptions));
    gGameOptions.optionsSaved = false;
    if (oldEnableMouse != gGameOptions.enableMouse) {
        if (gGameOptions.enableMouse) {
            gGameOptions.enableMouse = initMouse(&gMouseCallbacks);
        }
    }
    saveOptions();
}
示例#6
0
void Input::init( Window& window )
{
	deleteKeyboard();
	deleteMouse();
	deleteInput();

	initInput();
	initKeyboard( window );
	initMouse( window );
};
示例#7
0
文件: agos.cpp 项目: bluddy/scummvm
void AGOSEngine::setupGame() {
	allocItemHeap();
	allocTablesHeap();

	if (getGameType() != GType_SIMON2)
		initMouse();

	_variableArray = (int16 *)calloc(_numVars, sizeof(int16));
	_variableArrayPtr = _variableArray;
	if (getGameType() == GType_FF || getGameType() == GType_PP) {
		_variableArray2 = (int16 *)calloc(_numVars, sizeof(int16));
	}

	setupOpcodes();
	setupVgaOpcodes();

	setZoneBuffers();

	_currentMouseCursor = 255;
	_currentMouseAnim = 255;

	_lastMusicPlayed = -1;
	_nextMusicToPlay = -1;

	_noOverWrite = 0xFFFF;

	_stringIdLocalMin = 1;

	_agosMenu = 1;
	_superRoomNumber = 1;

	for (int i = 0; i < 20; i++) {
		if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) {
			_videoWindows[i] = initialVideoWindows_Simon[i];
		} else if (getGameType() == GType_PN) {
			_videoWindows[i] = initialVideoWindows_PN[i];
		} else {
			_videoWindows[i] = initialVideoWindows_Common[i];
		}
	}

	if (getGameType() == GType_ELVIRA2 && getPlatform() == Common::kPlatformAtariST) {
		_videoWindows[9] = 75;
	}
}
void initGraphics() {

    glEnable(GL_TEXTURE_2D);
    glEnable(GL_DEPTH_TEST);
    glEnable(GL_BLEND);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

    eyeVector = vec3(0.0,0.0,defaultEyeZ);
    upVector = vec3(0.0,1.0,0.0);
    centerVector = vec3(0,0,0);

    initializeAnimation();
    //initialize display lists
    initCircleThingy();
    initTorus();
    initSpaceStation();
    initMouse();

    //initialize shaders
    vertexShader = initshaders(GL_VERTEX_SHADER, "vertexShader.glsl");
    fragmentShader = initshaders(GL_FRAGMENT_SHADER, "fragmentShader.glsl");
    shaderProgram = initprogram(vertexShader,fragmentShader);

//link up variables in shaders
//
    computingTeapot = glGetUniformLocation(shaderProgram,"computingTeapot");
    computingSphere = glGetUniformLocation(shaderProgram,"computingSphere");
    centerDist = glGetUniformLocation(shaderProgram, "centerDist");
    computingTorus = glGetUniformLocation(shaderProgram, "computingTorus");
    torusTransparency = glGetUniformLocation(shaderProgram, "torusTransparency");
    materialDiffuse = glGetUniformLocation(shaderProgram, "materialDiffuse");
    materialSpecular = glGetUniformLocation(shaderProgram, "materialSpecular");
    materialShininess = glGetUniformLocation(shaderProgram, "materialShininess");
    viewMatrix = glGetUniformLocation(shaderProgram, "viewMatrix");
    usingTextures = glGetUniformLocation(shaderProgram, "usingTextures");
    computingMonitor = glGetUniformLocation(shaderProgram, "computingMonitor");

    //initialize textures
    initSphereTexture(fragmentShader);

}
示例#9
0
X11UIEngine::X11UIEngine() : 
  _display(NULL),
  _fd(-1),
  _screen(-1),
  _root(0),
  _gc(0),
  _visual(NULL),
  _colorMap(0),
  _xim(0),
  _numButtons(0),
  _xShm(false),
  _xPrivateColorMap(false),
  _xForcePixmap(true),
  _xDontLogUnsupportedBpp(false),
  _wmClientLeader(0),
  _atomNames(X11UIEngine_atomNames)
{
  _wakeUpPipe[0] = -1;
  _wakeUpPipe[1] = -1;
  
  // Make sure that there is no garbage in these arrays.
  MemOps::zero(_atomList, X11_ATOM_COUNT * sizeof(XAtom));
  MemOps::zero(&_keyMap , sizeof(_keyMap));
  MemOps::zero(&_XLib   , sizeof(_XLib));
  MemOps::zero(&_XExt   , sizeof(_XExt));
  MemOps::zero(&_XRender, sizeof(_XRender));

  if (openXlib() != ERR_OK)
    return;

  if (openDisplay() != ERR_OK)
    return;
  
  initDisplay();
  initKeyboard();
  initMouse();

  _eventLoop.adopt(fog_new X11UIEventLoopImpl(this));
  _isInitialized = true;
}
示例#10
0
Visualizer::Visualizer(
  QWidget *parent,
  Graph *graph_)
  : QGLWidget(parent),
    m_lastMouseEvent(QEvent::None, QPoint(0,0), Qt::NoButton, Qt::NoButton, Qt::NoModifier),
    m_graph(graph_)
{
  setMinimumSize(10,10);
  setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
  setFocusPolicy(Qt::ClickFocus);
  clearColor = Qt::white;

  initMouse();

  m_inSelectMode = false;
  texCharOK = false;
  texCushOK = false;

  geomChanged = true;
  dataChanged = true;

  showMenu = false;
}
示例#11
0
文件: angTest.cpp 项目: KuroObi/3DCAD
		bool Init(){
			Vector3f Pos(0.0f, 0.0f, -22.0f);
			Vector3f Target(0.0f, -0.2f, 1.0f);
			Vector3f Up(0.0, 0.0f, 0.0f);

			eyeStep = 0.02f;

			worldPos = Vector3f(0.0f, 0.0f, 3.0f);
			m_pGameCamera = new Camera(WINDOW_WIDTH, WINDOW_HEIGHT, eyeStep);

			CreateVertexBuffer();
			//CreateIndexBuffer();

			m_pEffect = new LightingTechnique();

			if (!m_pEffect->Init()){
				return false;
			}
			
			m_pEffect->Enable();

			stereo = false;
			turnAround = false;

			m_gui.init();
			initGUI();
			
			m_mousePos = Vector3f(0.0, 0.0, 1.0);
			m_mouse2DPos = Vector2f(0.0f, 0.0f);
			m_horoptor = 1.1f;
			m_horoptorStep = 0.05f;
			
			initMouse();

			return true;
		}
示例#12
0
int main(int argc, char** argv) {
	
	glutInit(&argc, argv);
	glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH);
	glutInitWindowPosition(300, 150);
	glutInitWindowSize(1024, 690);
	glutCreateWindow("World Of Garden");

	GLenum err = glewInit();
	if (err != GLEW_OK) {
		fprintf(stderr, "Error: %s\n", glewGetErrorString(err));
		return  -1;
	}
	else {
		fprintf(stdout, "glew loading success\n");
	}

	initKeyBord();
	initMouse();
	initScene();

	initMapTexture();
	initTerran();

	glutReshapeFunc(reshape_init);
	glutDisplayFunc(render_scene);
	glutIdleFunc(render_scene);




	

	glutMainLoop();
	return 0;
}
示例#13
0
//==============================================================================
void initGL(int argc, char **argv){

    // Start OpenGL ES
    bcm_host_init();

    // Clear application state
    int32_t success = 0;
    EGLBoolean result;
    EGLint num_config;

    static EGL_DISPMANX_WINDOW_T nativeviewport;

    DISPMANX_ELEMENT_HANDLE_T dispman_element;
    DISPMANX_DISPLAY_HANDLE_T dispman_display;
    DISPMANX_UPDATE_HANDLE_T dispman_update;
    VC_RECT_T dst_rect;
    VC_RECT_T src_rect;

    uint32_t screen_width;
    uint32_t screen_height;

    static const EGLint attribute_list[] = {
        EGL_RED_SIZE, 8,
        EGL_GREEN_SIZE, 8,
        EGL_BLUE_SIZE, 8,
        EGL_ALPHA_SIZE, 8,
        EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
        EGL_DEPTH_SIZE, 16,
        EGL_NONE
    };

    static const EGLint context_attributes[] = {
        EGL_CONTEXT_CLIENT_VERSION, 2,
        EGL_NONE
    };

    EGLConfig config;

    // get an EGL display connection
    display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
    assert(display!=EGL_NO_DISPLAY);
    check();

    // initialize the EGL display connection
    result = eglInitialize(display, NULL, NULL);
    assert(EGL_FALSE != result);
    check();

    // get an appropriate EGL frame buffer configuration
    result = eglChooseConfig(display, attribute_list, &config, 1, &num_config);
    assert(EGL_FALSE != result);
    check();

    // get an appropriate EGL frame buffer configuration
    result = eglBindAPI(EGL_OPENGL_ES_API);
    assert(EGL_FALSE != result);
    check();

    // create an EGL rendering context
    context = eglCreateContext(display, config, EGL_NO_CONTEXT, context_attributes);
    assert(context!=EGL_NO_CONTEXT);
    check();

    // create an EGL viewport surface
    success = graphics_get_display_size(0 /* LCD */, &screen_width, &screen_height);
    assert( success >= 0 );

    //  Initially the viewport is for all the screen
    viewport.x = 0;
    viewport.y = 0;
    viewport.z = screen_width;
    viewport.w = screen_height;

    dst_rect.x = viewport.x;
    dst_rect.y = viewport.y;
    dst_rect.width = viewport.z;
    dst_rect.height = viewport.w;

    src_rect.x = 0;
    src_rect.y = 0;
    src_rect.width = viewport.z << 16;
    src_rect.height = viewport.w << 16;

    dispman_display = vc_dispmanx_display_open( 0 /* LCD */);
    dispman_update = vc_dispmanx_update_start( 0 );

    dispman_element = vc_dispmanx_element_add( dispman_update, dispman_display,
                                       0/*layer*/, &dst_rect, 0/*src*/,
                                       &src_rect, DISPMANX_PROTECTION_NONE, 0 /*alpha*/, 0/*clamp*/, (DISPMANX_TRANSFORM_T)0/*transform*/);

    nativeviewport.element = dispman_element;
    nativeviewport.width = viewport.z;
    nativeviewport.height = viewport.w;
    vc_dispmanx_update_submit_sync( dispman_update );
    check();

    surface = eglCreateWindowSurface( display, config, &nativeviewport, NULL );
    assert(surface != EGL_NO_SURFACE);
    check();

    // connect the context to the surface
    result = eglMakeCurrent(display, surface, surface, context);
    assert(EGL_FALSE != result);
    check();

    // Set background color and clear buffers
    // glClearColor(0.15f, 0.25f, 0.35f, 1.0f);
    // glClear( GL_COLOR_BUFFER_BIT );

    setWindowSize(viewport.z,viewport.w);
    mouse.x = viewport.z*0.5;
    mouse.y = viewport.w*0.5;
    check();

    initMouse();
    ///printf("OpenGL Initialize at %i,%i,%i,%i\n",viewport.x,viewport.y,viewport.z,viewport.w);
}
示例#14
0
int main()
 {
  mkdir(Menufold);
  char sorcepath[100];
  int i;
  char Ch;
  fstream fin;
  fstream foutMenu;
  fstream foutDesk;
  screenMain();
  stanterdScreen(50,1,9);
  strcpy(sorcepath,"C:\\MISION\\HELP\\Ad_Book.PIF");

  fin.open("C:\\MISION\\VISION\\Ad_Book.PIF",ios::nocreate|ios::in);
  if(!fin)
   {
    cout<<"\n\n\n\n\n\n\n\n\n\n\n\t\t\tFirst Use INSTAL.EXE\n\n\n\n\n";
    getch();
    exit(0);
   }

  fin.close();

  fin.open(sorcepath,ios::nocreate|ios::in|ios::binary);
  if(fin)
   {
    foutDesk.open(Desktop,ios::out|ios::trunc|ios::binary);
    foutMenu.open(StartMenu,ios::out|ios::trunc|ios::binary);
   }
  else
   {
    cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\n\t\t\t\tError In Process\n\n\t\t\t\tAborted !";
    getch();
    exit(0);
   }
  while(fin)
   {
    fin.get(Ch);
    foutDesk.put(Ch);
    foutMenu.put(Ch);
   }
  fin.close();
  foutDesk.close();
  foutMenu.close();
  cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\n\t\t\tDesktop Shortcut Is Created\n\n\t\t\tFile Is Added To Start Menu \n\n\n\n";
  fin.open("C:\\MISION\\help\\help.htm",ios::nocreate|ios::in);
  foutMenu.open(StartMenuhtm,ios::out|ios::trunc|ios::binary);
  while(fin)
   {
    fin.get(Ch);
    foutMenu.put(Ch);
   };
  fin.close();
  foutMenu.close();
  stanterdScreen(50,1,9);
  forMyCollege();
  delay(250);
  Report(11,"Graphics&Header","dreamBlitzer");
  Report(11,"Mouse","CCoder");
  Report(11,"Data Management","MadCoder");
  Report(11,"File & Storage","Looxers");
  Report(11,"Desktop & Menu","dreamBlitzer");
  setcolor(11);
  sprintf(msg1,"Thank You");
  outtextxy(((getmaxx()-(textwidth(msg1)))/2),getmaxy()/2-50,msg1);
  initMouse();
  showMouse();
  setMouseCurserPosition(50,50);
  outtextxy(180,275,"Press Esc To Exit . . . !");
  do
   {
    i=getBiosKey();
   }
   while(i!=ESC);
  return(0);
 }