[Armadeus-commitlog] SF.net SVN: armadeus:[1043] trunk/target/demos/input_test
Brought to you by:
sszy
|
From: <ar...@us...> - 2009-01-31 13:27:44
|
Revision: 1043
http://armadeus.svn.sourceforge.net/armadeus/?rev=1043&view=rev
Author: artemys
Date: 2009-01-31 13:27:39 +0000 (Sat, 31 Jan 2009)
Log Message:
-----------
[DEMOS] rename keypad tool (part2)
Modified Paths:
--------------
trunk/target/demos/input_test/Makefile
Added Paths:
-----------
trunk/target/demos/input_test/main.c
Removed Paths:
-------------
trunk/target/demos/input_test/keypad.c
Modified: trunk/target/demos/input_test/Makefile
===================================================================
--- trunk/target/demos/input_test/Makefile 2009-01-31 11:58:13 UTC (rev 1042)
+++ trunk/target/demos/input_test/Makefile 2009-01-31 13:27:39 UTC (rev 1043)
@@ -1,20 +1,16 @@
+ARMADEUS_BASE_DIR=../../..
+include $(ARMADEUS_BASE_DIR)/Makefile.in
ifeq ($(TARGET),)
- BUILDROOT_DIR:=../../../buildroot/
- BUILD_DIR_EXT:=$(shell ls $(BUILDROOT_DIR) | grep -e "^build_arm*")
- BUILD_DIR:=$(BUILDROOT_DIR)/$(BUILD_DIR_EXT)
+ STAGING_DIR:=$(ARMADEUS_BUILD_DIR)/staging_dir/
+ INSTALL_DIR:=$(ARMADEUS_ROOTFS_DIR)/usr/bin/
- SDL_DIR:=$(BUILD_DIR)/SDL-1.2.11/
- STAGING_DIR:=$(BUILD_DIR)/staging_dir/
- ROOT_DIR:=$(BUILDROOT_DIR)/project_$(BUILD_DIR_EXT)/armadeus/root/
- INSTALL_DIR:=$(ROOT_DIR)/usr/bin/
-
- CC:=$(STAGING_DIR)/bin/arm-linux-gcc
+ CC:=$(STAGING_DIR)/usr/bin/arm-linux-gcc
DEFINES="TARGET"
- CFLAGS:=$(shell STAGING_DIR=$(STAGING_DIR) sh $(SDL_DIR)/sdl-config --cflags)
- LIBS:=$(shell STAGING_DIR=$(STAGING_DIR) sh $(SDL_DIR)/sdl-config --libs)
+ CFLAGS:=$(shell STAGING_DIR=$(STAGING_DIR) sh $(ARMADEUS_SDL_DIR)/sdl-config --cflags)
+ LIBS:=$(shell STAGING_DIR=$(STAGING_DIR) sh $(ARMADEUS_SDL_DIR)/sdl-config --libs)
else
- INSTALL_DIR="./install"
+ INSTALL_DIR=./install
CFLAGS=`/usr/bin/sdl-config --cflags`
LIBS=`/usr/bin/sdl-config --libs`
CC=gcc
@@ -22,23 +18,29 @@
endif
CFLAGS+="-g"
+EXEC_NAME=keypad_test
-default: keypad_test
-all: keypad_test
+default: $(EXEC_NAME)
+all: $(EXEC_NAME)
-keypad.o: keypad.c
+
+main.o: main.c
$(CC) $(CFLAGS) -c -o $@ $^
-keypad_test: keypad.o
+$(EXEC_NAME): main.o
$(CC) $(LIBS) -o $@ $^
-install: keypad_test
+install: $(EXEC_NAME)
mkdir -p $(INSTALL_DIR)
cp $^ $(INSTALL_DIR)
+uninstall:
+ rm -f $(INSTALL_DIR)/input_test
clean:
- rm -rf keypad_test
+ rm -rf $(EXEC_NAME)
rm -rf *.o
+.PHONY: clean uninstall
+
Deleted: trunk/target/demos/input_test/keypad.c
===================================================================
--- trunk/target/demos/input_test/keypad.c 2009-01-31 11:58:13 UTC (rev 1042)
+++ trunk/target/demos/input_test/keypad.c 2009-01-31 13:27:39 UTC (rev 1043)
@@ -1,107 +0,0 @@
-/*
- * Small tool to test keypad (with the use of SDL library)
- * for the Armadeus project. www.armadeus.org
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h> // for sleep()
-
-#include "SDL.h"
-
-#define SCREEN_WIDTH 480
-#define SCREEN_HEIGHT 270
-
-#ifdef DEBUG
-#define debug( args...) printf( ## args )
-#else
-#define debug( args...) do {;} while(0);
-#endif
-
-#define bool unsigned int
-#define false 0
-#define true 1
-
-SDL_Surface *screen;
-
-
-//---- Main ----
-
-int main(int argc, char *argv[])
-{
- Uint8* keys;
- int nbFrames = 0;
- int cursorPos = 0;
-
- // Initialize SDL
- if( SDL_Init( SDL_INIT_VIDEO | SDL_INIT_TIMER /*| SDL_INIT_EVENTTHREAD |SDL_INIT_NOPARACHUTE*/) < 0 )
- {
- printf("Unable to init SDL: %s\n", SDL_GetError());
- exit(1);
- }
- // Ask SDL to cleanup when exiting
- atexit(SDL_Quit);
-
- // Get a screen to display some stuff
- screen=SDL_SetVideoMode( SCREEN_WIDTH, SCREEN_HEIGHT, 16, 0/*SDL_HWPALETTE*//*SDL_HWSURFACE|| SDL_DOUBLEBUF*/ );
- if( screen == NULL )
- {
- printf("Unable to set %dx%dvideo mode: %s\n", SCREEN_WIDTH, SCREEN_HEIGHT, SDL_GetError());
- exit(1);
- }
-
- int done=0, move=0;
-
- // Hide mouse
- SDL_ShowCursor(0);
-
- // Main loop
- while(done == 0)
- {
- SDL_Event event;
- // Wait for SDL events
- while ( SDL_PollEvent(&event) )
- {
- cursorPos = 0;
- switch( event.type )
- {
- case SDL_QUIT: { done = 1; break; }
-
- case SDL_KEYDOWN:
- {
- //if ( event.key.keysym.sym == SDLK_ESCAPE ) { done = 1; }
- printf("Key down: %s\n", SDL_GetKeyName(event.key.keysym.sym));
- break;
- }
-
- case SDL_KEYUP:
- {
- //if ( event.key.keysym.sym == SDLK_ESCAPE ) { done = 1; }
- printf("Key up: %s\n", SDL_GetKeyName(event.key.keysym.sym));
- break;
- }
-
- default:
- break;
- }
- }
-
- SDL_Delay(50);
- }
-
- return 0;
-}
Copied: trunk/target/demos/input_test/main.c (from rev 1042, trunk/target/demos/input_test/keypad.c)
===================================================================
--- trunk/target/demos/input_test/main.c (rev 0)
+++ trunk/target/demos/input_test/main.c 2009-01-31 13:27:39 UTC (rev 1043)
@@ -0,0 +1,107 @@
+/*
+ * Small tool to test keypad (with the use of SDL library)
+ * for the Armadeus project. www.armadeus.org
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h> // for sleep()
+
+#include "SDL.h"
+
+#define SCREEN_WIDTH 480
+#define SCREEN_HEIGHT 270
+
+#ifdef DEBUG
+#define debug( args...) printf( ## args )
+#else
+#define debug( args...) do {;} while(0);
+#endif
+
+#define bool unsigned int
+#define false 0
+#define true 1
+
+SDL_Surface *screen;
+
+
+//---- Main ----
+
+int main(int argc, char *argv[])
+{
+ Uint8* keys;
+ int nbFrames = 0;
+ int cursorPos = 0;
+
+ // Initialize SDL
+ if( SDL_Init( SDL_INIT_VIDEO | SDL_INIT_TIMER /*| SDL_INIT_EVENTTHREAD |SDL_INIT_NOPARACHUTE*/) < 0 )
+ {
+ printf("Unable to init SDL: %s\n", SDL_GetError());
+ exit(1);
+ }
+ // Ask SDL to cleanup when exiting
+ atexit(SDL_Quit);
+
+ // Get a screen to display some stuff
+ screen=SDL_SetVideoMode( SCREEN_WIDTH, SCREEN_HEIGHT, 16, 0/*SDL_HWPALETTE*//*SDL_HWSURFACE|| SDL_DOUBLEBUF*/ );
+ if( screen == NULL )
+ {
+ printf("Unable to set %dx%dvideo mode: %s\n", SCREEN_WIDTH, SCREEN_HEIGHT, SDL_GetError());
+ exit(1);
+ }
+
+ int done=0, move=0;
+
+ // Hide mouse
+ SDL_ShowCursor(0);
+
+ // Main loop
+ while(done == 0)
+ {
+ SDL_Event event;
+ // Wait for SDL events
+ while ( SDL_PollEvent(&event) )
+ {
+ cursorPos = 0;
+ switch( event.type )
+ {
+ case SDL_QUIT: { done = 1; break; }
+
+ case SDL_KEYDOWN:
+ {
+ //if ( event.key.keysym.sym == SDLK_ESCAPE ) { done = 1; }
+ printf("Key down: %s\n", SDL_GetKeyName(event.key.keysym.sym));
+ break;
+ }
+
+ case SDL_KEYUP:
+ {
+ //if ( event.key.keysym.sym == SDLK_ESCAPE ) { done = 1; }
+ printf("Key up: %s\n", SDL_GetKeyName(event.key.keysym.sym));
+ break;
+ }
+
+ default:
+ break;
+ }
+ }
+
+ SDL_Delay(50);
+ }
+
+ return 0;
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|