Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for keyboard interaction in Linux #4

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
388 changes: 194 additions & 194 deletions include/Aluminum/MeshData.hpp

Large diffs are not rendered by default.

26 changes: 26 additions & 0 deletions linux/FreeGlutGLView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ void moved(int x, int y ) {


void keyboard(unsigned char key, int x, int y) {
renderer->keyboard(key,x,y);

switch(key) {

case 27:
Expand All @@ -93,6 +95,29 @@ void keyboard(unsigned char key, int x, int y) {
printf("done pressing...\n");
}


void specialkeys(int key, int x, int y) {
renderer->specialkeys(key,x,y);

switch (key) {

case GLUT_KEY_UP:
std::cout << "UP\n";
break;
case GLUT_KEY_DOWN:
std::cout << "DOWN\n";
break;
case GLUT_KEY_RIGHT:
std::cout << "RIGHT\n";
break;
case GLUT_KEY_LEFT:
std::cout << "LEFT\n";
break;

}

}

FreeGlutGLView* FreeGlutGLView::start(void* _renderer) {
return FreeGlutGLView::start(_renderer, "allomin");
}
Expand Down Expand Up @@ -135,6 +160,7 @@ FreeGlutGLView* FreeGlutGLView::start(void* _renderer, std::string name) {
glutDisplayFunc(&display);
glutReshapeFunc(&reshape);
glutKeyboardFunc(&keyboard);
glutSpecialFunc(&specialkeys);
glutMouseFunc(&pressed);
glutMotionFunc(&dragged);
glutPassiveMotionFunc(&moved);
Expand Down
2 changes: 2 additions & 0 deletions linux/RendererLinux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ void RendererLinux::mouseDragged(int px, int py) {}
void RendererLinux::mouseDown(int px, int py) {}
void RendererLinux::mouseUp(int px, int py) {}
void RendererLinux::mouseMoved(int px, int py) {}
void RendererLinux::keyboard(unsigned char key, int x, int y) {}
void RendererLinux::specialkeys(int key, int x, int y) {}



Expand Down
3 changes: 3 additions & 0 deletions linux/RendererLinux.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class RendererLinux {
//basic windowing
void start();
void start(std::string name);
void start(std::string name, int x, int y, int w, int h);

virtual void onCreate();
virtual void onFrame();
Expand All @@ -40,6 +41,8 @@ virtual void mouseDragged(int px, int py);
virtual void mouseDown(int px, int py);
virtual void mouseUp(int px, int py);
virtual void mouseMoved(int px, int py);
virtual void keyboard(unsigned char key, int x, int y);
virtual void specialkeys(int key, int x, int y);



Expand Down
2 changes: 1 addition & 1 deletion linux/run.command
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ LINUX_DIR="$RUN_PATH"

#COCOA="-isysroot /Applications/XCode.app/Contents/Developer/Platforms/MacLINUX.platform/Developer/SDKs/MacLINUX$LINUX_VERSION.sdk -mmacosx-version-min=$LINUX_VERSION -framework Cocoa -framework QuartzCore -framework OpenGL -framework AppKit -framework Foundation -framework AVFoundation -framework CoreMedia "

LINUX_LIBS=" -lglut -lGL -lm -lfreeimage"
LINUX_LIBS=" -lglut -lGL -lm -lfreeimage -lSDL -lSDL_image"

OPTIONS="-O3 -Wreturn-type -Wformat -Wmissing-braces -Wparentheses -Wswitch -Wunused-variable -Wsign-compare -Wno-unknown-pragmas -Woverloaded-virtual"

Expand Down
Loading