mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-25 17:14:59 +02:00
Added key state to avatar data, started on chat entry field.
This commit is contained in:
parent
9802940f8c
commit
f538e2bdbc
5 changed files with 60 additions and 0 deletions
12
interface/src/ChatEntry.cpp
Normal file
12
interface/src/ChatEntry.cpp
Normal file
|
@ -0,0 +1,12 @@
|
|||
//
|
||||
// ChatEntry.cpp
|
||||
// interface
|
||||
//
|
||||
// Created by Andrzej Kapolka on 4/24/13.
|
||||
// Copyright (c) 2013 High Fidelity, Inc. All rights reserved.
|
||||
|
||||
#include "ChatEntry.h"
|
||||
|
||||
void ChatEntry::render(int screenWidth, int screenHeight) {
|
||||
|
||||
}
|
20
interface/src/ChatEntry.h
Normal file
20
interface/src/ChatEntry.h
Normal file
|
@ -0,0 +1,20 @@
|
|||
//
|
||||
// ChatEntry.h
|
||||
// interface
|
||||
//
|
||||
// Created by Andrzej Kapolka on 4/24/13.
|
||||
// Copyright (c) 2013 High Fidelity, Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef __interface__ChatEntry__
|
||||
#define __interface__ChatEntry__
|
||||
|
||||
class ChatEntry {
|
||||
public:
|
||||
|
||||
void render(int screenWidth, int screenHeight);
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
#endif /* defined(__interface__ChatEntry__) */
|
|
@ -64,6 +64,7 @@
|
|||
#include "MenuColumn.h"
|
||||
#include "Menu.h"
|
||||
#include "Camera.h"
|
||||
#include "ChatEntry.h"
|
||||
#include "Head.h"
|
||||
#include "Particle.h"
|
||||
#include "Texture.h"
|
||||
|
@ -178,6 +179,9 @@ int mousePressed = 0; // true if mouse has been pressed (clear when finished)
|
|||
Menu menu; // main menu
|
||||
int menuOn = 1; // Whether to show onscreen menu
|
||||
|
||||
ChatEntry chatEntry; // chat entry field
|
||||
bool chatEntryOn = false; // Whether to show the chat entry
|
||||
|
||||
struct HandController
|
||||
{
|
||||
bool enabled;
|
||||
|
@ -976,6 +980,11 @@ void display(void)
|
|||
menu.render(WIDTH,HEIGHT);
|
||||
}
|
||||
|
||||
// Show chat entry field
|
||||
if (::chatEntryOn) {
|
||||
chatEntry.render(WIDTH, HEIGHT);
|
||||
}
|
||||
|
||||
// Stats at upper right of screen about who domain server is telling us about
|
||||
glPointSize(1.0f);
|
||||
char agents[100];
|
||||
|
@ -1350,6 +1359,10 @@ void keyUp(unsigned char k, int x, int y) {
|
|||
|
||||
void key(unsigned char k, int x, int y)
|
||||
{
|
||||
if (::chatEntryOn) {
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Process keypresses
|
||||
if (k == 'q' || k == 'Q') ::terminate();
|
||||
|
@ -1416,6 +1429,7 @@ void key(unsigned char k, int x, int y)
|
|||
if (k == 'g') renderPitchRate += KEYBOARD_PITCH_RATE;
|
||||
if (k == 'a') myAvatar.setDriveKeys(ROT_LEFT, 1);
|
||||
if (k == 'd') myAvatar.setDriveKeys(ROT_RIGHT, 1);
|
||||
if (k == '\r') ::chatEntryOn = true;
|
||||
}
|
||||
|
||||
// Receive packets from other agents/servers and decide what to do with them!
|
||||
|
|
|
@ -112,6 +112,9 @@ int AvatarData::getBroadcastData(unsigned char* destinationBuffer) {
|
|||
memcpy(destinationBuffer, &_cameraFarClip, sizeof(_cameraFarClip));
|
||||
destinationBuffer += sizeof(_cameraFarClip);
|
||||
|
||||
// Key State
|
||||
memcpy(destinationBuffer, &_keyState, sizeof(char));
|
||||
destinationBuffer += sizeof(char);
|
||||
|
||||
return destinationBuffer - bufferStart;
|
||||
}
|
||||
|
@ -168,6 +171,10 @@ int AvatarData::parseData(unsigned char* sourceBuffer, int numBytes) {
|
|||
memcpy(&_cameraFarClip, sourceBuffer, sizeof(_cameraFarClip));
|
||||
sourceBuffer += sizeof(_cameraFarClip);
|
||||
|
||||
// Key State
|
||||
memcpy(&_keyState, sourceBuffer, sizeof(char));
|
||||
sourceBuffer += sizeof(char);
|
||||
|
||||
return sourceBuffer - startPosition;
|
||||
}
|
||||
|
||||
|
|
|
@ -74,6 +74,10 @@ public:
|
|||
void setCameraNearClip(float nearClip) { _cameraNearClip = nearClip; }
|
||||
void setCameraFarClip(float farClip) { _cameraFarClip = farClip; }
|
||||
|
||||
// Key state
|
||||
void setKeyState(char s) { _keyState = s; }
|
||||
char keyState() const { return _keyState; }
|
||||
|
||||
protected:
|
||||
glm::vec3 _position;
|
||||
glm::vec3 _handPosition;
|
||||
|
@ -105,6 +109,9 @@ protected:
|
|||
float _cameraAspectRatio;
|
||||
float _cameraNearClip;
|
||||
float _cameraFarClip;
|
||||
|
||||
// Key state (nothing, down, up, backspace)
|
||||
char _keyState;
|
||||
};
|
||||
|
||||
#endif /* defined(__hifi__AvatarData__) */
|
||||
|
|
Loading…
Reference in a new issue