Browse Source

ui: add a Platform class to query information about the current platform.

Implement GetMouseCount() to query the number of mice on the system.
legacy
Sam Hocevar sam 14 years ago
parent
commit
f23ce9c7b4
4 changed files with 72 additions and 0 deletions
  1. +1
    -0
      src/Makefile.am
  2. +1
    -0
      src/core.h
  3. +36
    -0
      src/platform.cpp
  4. +34
    -0
      src/platform.h

+ 1
- 0
src/Makefile.am View File

@@ -10,6 +10,7 @@ liblol_a_SOURCES = \
world.cpp world.h sample.cpp sample.h sampler.cpp sampler.h \
text.cpp text.h emitter.cpp emitter.h numeric.h hash.cpp hash.h \
worldentity.cpp worldentity.h shader.cpp shader.h image.cpp image.h \
platform.cpp platform.h \
\
sdlapp.cpp sdlapp.h sdlinput.cpp sdlinput.h \
\


+ 1
- 0
src/core.h View File

@@ -23,6 +23,7 @@

// Static classes
#include "log.h"
#include "platform.h"
#include "video.h"
#include "audio.h"
#include "scene.h"


+ 36
- 0
src/platform.cpp View File

@@ -0,0 +1,36 @@
//
// Lol Engine
//
// Copyright: (c) 2010-2011 Sam Hocevar <sam@hocevar.net>
// This program is free software; you can redistribute it and/or
// modify it under the terms of the Do What The Fuck You Want To
// Public License, Version 2, as published by Sam Hocevar. See
// http://sam.zoy.org/projects/COPYING.WTFPL for more details.
//

#if defined HAVE_CONFIG_H
# include "config.h"
#endif

#include <cmath>

#include "core.h"

namespace lol
{

/*
* Public Platform class
*/

int Platform::GetMouseCount()
{
#if defined ANDROID_NDK
/* Assume Android devices are touch devices that don't have a mouse */
return 0;
#endif
return 1;
}

} /* namespace lol */


+ 34
- 0
src/platform.h View File

@@ -0,0 +1,34 @@
//
// Lol Engine
//
// Copyright: (c) 2010-2011 Sam Hocevar <sam@hocevar.net>
// This program is free software; you can redistribute it and/or
// modify it under the terms of the Do What The Fuck You Want To
// Public License, Version 2, as published by Sam Hocevar. See
// http://sam.zoy.org/projects/COPYING.WTFPL for more details.
//

//
// The Platform interface
// ----------------------
// Helper functions to set up the platform.
//

#if !defined __LOL_PLATFORM_H__
#define __LOL_PLATFORM_H__

#include <stdint.h>

namespace lol
{

class Platform
{
public:
static int GetMouseCount();
};

} /* namespace lol */

#endif // __LOL_PLATFORM_H__


Loading…
Cancel
Save