changeset 867:58d426cece23

add init_aquarium with protobuf
author kazz <kazz@cr.ie.u-ryukyu.ac.jp>
date Tue, 22 Jun 2010 12:52:25 +0900
parents a37eb30d40d8
children 58b4fb8ad77c
files Renderer/Test/Makefile.macosx Renderer/Test/init_aquarium.cc Renderer/Test/protobuf/aquarium.proto
diffstat 3 files changed, 25 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/Renderer/Test/Makefile.macosx	Tue Jun 22 12:10:37 2010 +0900
+++ b/Renderer/Test/Makefile.macosx	Tue Jun 22 12:52:25 2010 +0900
@@ -19,7 +19,7 @@
 %.pb.cc: $(PROTODIR)/%.proto
 	$(PROTO) $(PROTOFLAGS) $<
 
-ALL =  ball_bound boss1_action direction gaplant ieshoot node panel universe untitled vacuum property_test send_linda dynamic writer chain_old SgRootChange viewer aquarium
+ALL =  ball_bound boss1_action direction gaplant ieshoot node panel universe untitled vacuum property_test send_linda dynamic writer chain_old SgRootChange viewer aquarium init_aquarium
 
 oFLAGS=-g -O2
 CFLAGt=-g -O2
@@ -97,6 +97,9 @@
 aquarium : $(AQUARIUM_OBJ)
 	$(CC) -o $@ $?    $(LIBS) $(PROTOLIBS)
 
+INIT_AQUARIUM_OBJ = aquarium.pb.o init_aquarium.o
+init_aquarium : $(INIT_AQUARIUM_OBJ)
+	$(CC) -o $@ $? $(LIBS) $(PROTOLIBS)
 
 run: $(TARGET)
 	sudo ./$(TARGET) -width 576 -height 384 -bpp 32
@@ -113,5 +116,5 @@
 	rm -f *~ \#* $(ALL)
 	rm -f $(BALL_BOUND_XML).cc $(BALL_BOUND_XML).h $(BALL_BOUND_OBJ)
 	rm -f *.pb.{cc,h}
-	
+
 -include depend.inc
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Renderer/Test/init_aquarium.cc	Tue Jun 22 12:52:25 2010 +0900
@@ -0,0 +1,18 @@
+#include <stdio.h>
+#include "lindaapi.h"
+#include "aquarium.pb.h"
+
+int main(int argc, char *argv[]) {
+	init_linda();
+	aqua::Width *width = new aqua::Width();
+	width->set_width(0); // 0 ¤Ç½é´ü²½
+	int size = width->ByteSize();
+	unsigned char *msg = (unsigned char *) malloc(sizeof(char) * size);
+	width->SerializeToArray(msg, size);
+
+	int linda = open_linda_java("localhost", 10000);
+	psx_out(linda, 1, msg, size);
+	psx_sync_n();
+	
+	return 0;
+}
--- a/Renderer/Test/protobuf/aquarium.proto	Tue Jun 22 12:10:37 2010 +0900
+++ b/Renderer/Test/protobuf/aquarium.proto	Tue Jun 22 12:52:25 2010 +0900
@@ -1,3 +1,5 @@
+package aqua;
+
 message Width {
   required int32 width = 1;
 }