File: RenderVisitor.cpp

package info (click to toggle)
pinball 0.3.20230219-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 8,572 kB
  • sloc: cpp: 15,776; makefile: 1,037; sh: 588; xml: 24
file content (40 lines) | stat: -rw-r--r-- 840 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*-
// SPDX-License-Identifier: GPL-2.0+

#include <cstdlib>
#include <cstring>
#include <iostream>

#include "Private.h"
#include "RenderVisitor.h"
#include "OpenGLVisitor.h"
#include "AllegroVisitor.h"


using namespace std;


RenderVisitor* RenderVisitor::getInstance()
{
  static RenderVisitor* pInstance = NULL;

  if (!pInstance) {
    char* text = getenv("PINBALL_RENDER_DRIVER");
    if (text) {
      cerr << "PINBALL_RENDER_DRIVER=\""<< text<<"\""<<endl;
      if ((0 == strcmp(text, "dummy"))) {
	pInstance =  new RenderVisitor;
      }
    } else {
#if EM_USE_SDL
      pInstance = OpenGLVisitor::getInstance();
#elif EM_USE_ALLEGRO
      pInstance = AllegroVisitor::getInstance();
#else
      pInstance = new RenderVisitor;
#endif    
    }
  }

  return pInstance;
}