Skip to content

Commit

Permalink
X11 cursors, NaClPlatform replaced by Pepper
Browse files Browse the repository at this point in the history
- ozEngine
  * Cursor: X11 cursor loader and data structure
- client
  * NaClPlatform & OpenGL removed, replaced by ozEngine counterparts
  * oz::Cursor used for rendering cursors
  • Loading branch information
ducakar committed Apr 29, 2013
1 parent 3b8efd0 commit 9ef5191
Show file tree
Hide file tree
Showing 75 changed files with 558 additions and 846 deletions.
2 changes: 1 addition & 1 deletion ChangeLog.md
Expand Up @@ -15,7 +15,7 @@
* new SpinLock class
* ALSA and OSS back-ends for System::bell()
* linear algebra classes added as primitives to streams, Log and JSON
* PFile class merged into File class
* PFile class merged into File class (VFS paths begin with '@')
- ozDynamics: new rigid body dynamics library
* collision
+ primitives: Box, Capsule, Polytope, Compound
Expand Down
4 changes: 2 additions & 2 deletions build.sh
Expand Up @@ -15,7 +15,7 @@

buildType=Debug
platforms=(
Linux-x86_64
# Linux-x86_64
Linux-x86_64-Clang
# Linux-i686
# Linux-i686-Clang
Expand All @@ -28,7 +28,7 @@ platforms=(
# NaCl-i686
# NaCl-ARM
# PNaCl
Android14-i686
# Android14-i686
# Android14-ARM
# Android14-ARMv7a
# Android14-MIPS
Expand Down
4 changes: 2 additions & 2 deletions src/builder/Builder.cc
Expand Up @@ -911,12 +911,12 @@ int Builder::main( int argc, char** argv )
lingua.build();
}
if( doUI ) {
UI::buildCursors();
UI::buildIcons();
UI::copyScheme();

copyFiles( "@ui/cur", "ui/cur", "", false );
copyFiles( "@ui/font", "ui/font", "ttf", false );
copyFiles( "@ui/icon", "ui/icon", "", true );
copyFiles( "@ui/icon", "ui/icon", "", false );
}
if( doShaders ) {
copyFiles( "@glsl", "glsl", "glsl", false );
Expand Down
3 changes: 1 addition & 2 deletions src/builder/Context.hh
Expand Up @@ -24,8 +24,7 @@
#pragma once

#include <builder/common.hh>

#include <client/OpenGL.hh>
#include <ozEngine/GL.hh>

struct FIBITMAP;

Expand Down
54 changes: 0 additions & 54 deletions src/builder/UI.cc
Expand Up @@ -51,60 +51,6 @@ const char* const UI::ICON_NAMES[] = {
"arrow"
};

void UI::buildCursors()
{
if( File( "@ui/cur" ).type() != File::DIRECTORY ) {
return;
}

Log::println( "Building mouse cursors {" );
Log::indent();

bool useS3TC = context.useS3TC;
context.useS3TC = false;

File::mkdir( "ui" );
File::mkdir( "ui/cur" );

for( int i = 0; i < ui::Mouse::CURSORS_MAX; ++i ) {
File inFile( String::str( "@ui/cur/%s.in", ui::Mouse::NAMES[i] ) );
File destFile( String::str( "ui/cur/%s.ozCur", ui::Mouse::NAMES[i] ) );

String realPath = inFile.realPath();

FILE* fs = fopen( realPath, "r" );
if( fs == nullptr ) {
OZ_ERROR( "Failed to open cursor description '%s'", realPath.cstr() );
}

int size, hotspotX, hotspotY;
char imgPath[32];

int nMatches = fscanf( fs, "%3d %3d %3d %31s", &size, &hotspotX, &hotspotY, imgPath );
if( nMatches != 4 ) {
OZ_ERROR( "Invalid xcursor line" );
}

fclose( fs );

Context::Texture tex = context.loadTexture( String::str( "@ui/cur/%s", imgPath ), false,
GL_NEAREST, GL_NEAREST );
OutputStream os( 0 );

os.writeInt( size );
os.writeInt( hotspotX );
os.writeInt( hotspotY );
tex.write( &os );

destFile.write( os.begin(), os.tell() );
}

context.useS3TC = useS3TC;

Log::unindent();
Log::println( "}" );
}

void UI::buildIcons()
{
if( File( "@ui/icon" ).type() != File::DIRECTORY ) {
Expand Down
1 change: 0 additions & 1 deletion src/builder/UI.hh
Expand Up @@ -38,7 +38,6 @@ class UI

public:

static void buildCursors();
static void buildIcons();
static void copyScheme();

Expand Down
2 changes: 1 addition & 1 deletion src/client/BSP.cc
Expand Up @@ -26,7 +26,7 @@

#include <client/Context.hh>
#include <client/SMM.hh>
#include <client/OpenGL.hh>
#include <ozEngine/GL.hh>

namespace oz
{
Expand Down
4 changes: 0 additions & 4 deletions src/client/CMakeLists.txt
Expand Up @@ -34,10 +34,8 @@ add_library( client STATIC
MenuStage.hh
Mesh.hh
NaClDownloader.hh
NaClPlatform.hh
NaClUpdater.hh
Network.hh
OpenGL.hh
openzone.hh
Profile.hh
Proxy.hh
Expand Down Expand Up @@ -85,10 +83,8 @@ add_library( client STATIC
MenuStage.cc
Mesh.cc
NaClDownloader.cc
NaClPlatform.cc
NaClUpdater.cc
Network.cc
OpenGL.cc
Profile.cc
Proxy.cc
QuestList.cc
Expand Down
2 changes: 1 addition & 1 deletion src/client/Caelum.cc
Expand Up @@ -28,7 +28,7 @@
#include <client/Camera.hh>
#include <client/Terra.hh>
#include <client/Shape.hh>
#include <client/OpenGL.hh>
#include <ozEngine/GL.hh>

namespace oz
{
Expand Down
2 changes: 1 addition & 1 deletion src/client/CinematicProxy.cc
Expand Up @@ -24,10 +24,10 @@
#include <stable.hh>
#include <client/CinematicProxy.hh>

#include <ozEngine/Pepper.hh>
#include <common/Timer.hh>
#include <client/Camera.hh>
#include <client/Sound.hh>
#include <client/NaClPlatform.hh>
#include <client/ui/GalileoFrame.hh>
#include <client/ui/MusicPlayer.hh>
#include <client/ui/UI.hh>
Expand Down
19 changes: 9 additions & 10 deletions src/client/Client.cc
Expand Up @@ -26,6 +26,7 @@
#include <stable.hh>
#include <client/Client.hh>

#include <ozEngine/Pepper.hh>
#include <common/Timer.hh>
#include <common/Lua.hh>
#include <client/Camera.hh>
Expand All @@ -34,7 +35,6 @@
#include <client/Sound.hh>
#include <client/Render.hh>
#include <client/Loader.hh>
#include <client/NaClPlatform.hh>
#include <client/NaClUpdater.hh>
#include <client/Window.hh>
#include <client/Input.hh>
Expand Down Expand Up @@ -381,9 +381,9 @@ int Client::init( int argc, char** argv )

#ifdef __native_client__

NaClPlatform::post( "lang:" );
Pepper::post( "lang:" );

for( String message = NaClPlatform::poll(); ; message = NaClPlatform::poll() ) {
for( String message = Pepper::pop(); ; message = Pepper::pop() ) {
if( message.isEmpty() ) {
Time::sleep( 10 );
}
Expand All @@ -392,7 +392,7 @@ int Client::init( int argc, char** argv )
break;
}
else {
NaClPlatform::push( message );
Pepper::push( message );
}
}

Expand Down Expand Up @@ -473,7 +473,7 @@ int Client::init( int argc, char** argv )
gameStage.init();

#ifdef __native_client__
NaClPlatform::post( "none:" );
Pepper::post( "none:" );
#endif

Stage::nextStage = nullptr;
Expand Down Expand Up @@ -719,15 +719,14 @@ int Client::main()

#ifdef __native_client__

if( NaClPlatform::width != window.width || NaClPlatform::height != window.height ) {
if( Pepper::width != window.width || Pepper::height != window.height ) {
window.resize();
}
if( window.hasFocus != NaClPlatform::hasFocus ) {
window.hasFocus = NaClPlatform::hasFocus;
if( window.hasFocus != Pepper::hasFocus ) {
window.hasFocus = Pepper::hasFocus;
input.reset();
}
for( String message = NaClPlatform::poll(); !message.isEmpty(); message = NaClPlatform::poll() )
{
for( String message = Pepper::pop(); !message.isEmpty(); message = Pepper::pop() ) {
if( message.equals( "quit:" ) ) {
isAlive = false;
}
Expand Down
4 changes: 2 additions & 2 deletions src/client/Context.cc
Expand Up @@ -35,7 +35,7 @@
#include <client/BotAudio.hh>
#include <client/VehicleAudio.hh>

#include <client/OpenGL.hh>
#include <ozEngine/GL.hh>
#include <ozEngine/AL.hh>
#include <client/eSpeak.hh>

Expand Down Expand Up @@ -643,7 +643,7 @@ void Context::load()
void Context::unload()
{
#ifdef __native_client__
hard_assert( NaClPlatform::isMainThread() );
hard_assert( Pepper::isMainThread() );
#endif

Log::println( "Unloading Context {" );
Expand Down
2 changes: 1 addition & 1 deletion src/client/ExplosionImago.cc
Expand Up @@ -26,7 +26,7 @@

#include <common/Timer.hh>
#include <client/Context.hh>
#include <client/OpenGL.hh>
#include <ozEngine/GL.hh>

namespace oz
{
Expand Down
2 changes: 1 addition & 1 deletion src/client/FragPool.cc
Expand Up @@ -27,7 +27,7 @@
#include <client/Shader.hh>
#include <client/Context.hh>
#include <client/SMM.hh>
#include <client/OpenGL.hh>
#include <ozEngine/GL.hh>

namespace oz
{
Expand Down
2 changes: 1 addition & 1 deletion src/client/GameStage.cc
Expand Up @@ -24,6 +24,7 @@
#include <stable.hh>
#include <client/GameStage.hh>

#include <ozEngine/Pepper.hh>
#include <matrix/Synapse.hh>
#include <matrix/Matrix.hh>
#include <nirvana/Nirvana.hh>
Expand All @@ -38,7 +39,6 @@
#include <client/QuestList.hh>
#include <client/MenuStage.hh>
#include <client/Input.hh>
#include <client/NaClPlatform.hh>
#include <client/ui/LoadingArea.hh>

namespace oz
Expand Down
9 changes: 6 additions & 3 deletions src/client/Input.cc
Expand Up @@ -25,7 +25,6 @@
#include <client/Input.hh>

#include <client/Window.hh>
#include <client/NaClPlatform.hh>

namespace oz
{
Expand Down Expand Up @@ -463,8 +462,12 @@ void Input::update()

#if defined( __native_client__ )

mouseX = +NaClPlatform::moveX;
mouseY = -NaClPlatform::moveY;
mouseX = +Pepper::moveX;
mouseY = -Pepper::moveY;

int dx, dy;
SDL_GetRelativeMouseState( &dx, &dy );
printf( "SMM: %d, %d\n", dx, dy );

#else

Expand Down
2 changes: 2 additions & 0 deletions src/client/Input.hh
Expand Up @@ -23,6 +23,8 @@

#pragma once

#include <client/common.hh>

#include <SDL.h>

namespace oz
Expand Down
2 changes: 1 addition & 1 deletion src/client/Loader.cc
Expand Up @@ -32,7 +32,7 @@
#include <client/MD2.hh>
#include <client/MD3.hh>

#include <client/OpenGL.hh>
#include <ozEngine/GL.hh>
#include <ozEngine/AL.hh>

#include <SDL.h>
Expand Down
2 changes: 1 addition & 1 deletion src/client/MD2.cc
Expand Up @@ -26,7 +26,7 @@

#include <common/Timer.hh>
#include <client/Context.hh>
#include <client/OpenGL.hh>
#include <ozEngine/GL.hh>

namespace oz
{
Expand Down
2 changes: 1 addition & 1 deletion src/client/MD2Imago.cc
Expand Up @@ -26,7 +26,7 @@

#include <client/Context.hh>
#include <client/Camera.hh>
#include <client/OpenGL.hh>
#include <ozEngine/GL.hh>

namespace oz
{
Expand Down
2 changes: 1 addition & 1 deletion src/client/MD2WeaponImago.cc
Expand Up @@ -26,7 +26,7 @@

#include <client/Camera.hh>
#include <client/Context.hh>
#include <client/OpenGL.hh>
#include <ozEngine/GL.hh>

namespace oz
{
Expand Down
2 changes: 1 addition & 1 deletion src/client/MD3.cc
Expand Up @@ -25,7 +25,7 @@
#include <client/MD3.hh>

#include <client/Context.hh>
#include <client/OpenGL.hh>
#include <ozEngine/GL.hh>

namespace oz
{
Expand Down
2 changes: 1 addition & 1 deletion src/client/MD3Imago.cc
Expand Up @@ -26,7 +26,7 @@

#include <client/Context.hh>
#include <client/Camera.hh>
#include <client/OpenGL.hh>
#include <ozEngine/GL.hh>

namespace oz
{
Expand Down
2 changes: 1 addition & 1 deletion src/client/MenuStage.cc
Expand Up @@ -24,11 +24,11 @@
#include <stable.hh>
#include <client/MenuStage.hh>

#include <ozEngine/Pepper.hh>
#include <client/Camera.hh>
#include <client/Render.hh>
#include <client/Sound.hh>
#include <client/Input.hh>
#include <client/NaClPlatform.hh>

namespace oz
{
Expand Down
2 changes: 1 addition & 1 deletion src/client/Mesh.cc
Expand Up @@ -26,7 +26,7 @@

#include <client/Context.hh>
#include <client/Terra.hh>
#include <client/OpenGL.hh>
#include <ozEngine/GL.hh>

namespace oz
{
Expand Down

0 comments on commit 9ef5191

Please sign in to comment.