summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authordscho <dscho>2003-07-25 08:18:27 +0000
committerdscho <dscho>2003-07-25 08:18:27 +0000
commit1e60fc200aaab8ec302c3752eddab464b1adc2cc (patch)
tree201d5f0c99b820c4cd068f694b81c7b35d4048fa /examples
parent1694a574609805789a0afb8ce011304228af6bb2 (diff)
downloadlibtdevnc-1e60fc200aaab8ec302c3752eddab464b1adc2cc.tar.gz
libtdevnc-1e60fc200aaab8ec302c3752eddab464b1adc2cc.zip
Added simple examples
Diffstat (limited to 'examples')
-rw-r--r--examples/.cvsignore3
-rw-r--r--examples/Makefile.am2
-rw-r--r--examples/Makefile.in39
-rw-r--r--examples/simple.c10
-rw-r--r--examples/simple15.c24
5 files changed, 71 insertions, 7 deletions
diff --git a/examples/.cvsignore b/examples/.cvsignore
index 61a17ba..0f0081f 100644
--- a/examples/.cvsignore
+++ b/examples/.cvsignore
@@ -10,3 +10,6 @@ vncev
Makefile.in
.deps
colourmaptest
+simple
+simple15
+
diff --git a/examples/Makefile.am b/examples/Makefile.am
index cb2d6e6..17e79b2 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -12,7 +12,7 @@ endif
noinst_HEADERS=radon.h
noinst_PROGRAMS=example pnmshow regiontest pnmshow24 fontsel \
- vncev storepasswd colourmaptest $(BACKGROUND_TEST) $(MAC)
+ vncev storepasswd colourmaptest simple simple15 $(BACKGROUND_TEST) $(MAC)
LDADD = ../libvncserver.a
diff --git a/examples/Makefile.in b/examples/Makefile.in
index 8feabc8..5341adf 100644
--- a/examples/Makefile.in
+++ b/examples/Makefile.in
@@ -86,7 +86,7 @@ CFLAGS = -I..
noinst_HEADERS = radon.h
noinst_PROGRAMS = example pnmshow regiontest pnmshow24 fontsel \
- vncev storepasswd colourmaptest $(BACKGROUND_TEST) $(MAC)
+ vncev storepasswd colourmaptest simple simple15 $(BACKGROUND_TEST) $(MAC)
LDADD = ../libvncserver.a
@@ -102,7 +102,8 @@ CONFIG_CLEAN_FILES =
@HAVE_LIBPTHREAD_FALSE@@OSX_TRUE@ vncev$(EXEEXT) \
@HAVE_LIBPTHREAD_FALSE@@OSX_TRUE@ storepasswd$(EXEEXT) \
@HAVE_LIBPTHREAD_FALSE@@OSX_TRUE@ colourmaptest$(EXEEXT) \
-@HAVE_LIBPTHREAD_FALSE@@OSX_TRUE@ mac$(EXEEXT)
+@HAVE_LIBPTHREAD_FALSE@@OSX_TRUE@ simple$(EXEEXT) \
+@HAVE_LIBPTHREAD_FALSE@@OSX_TRUE@ simple15$(EXEEXT) mac$(EXEEXT)
@HAVE_LIBPTHREAD_FALSE@@OSX_FALSE@noinst_PROGRAMS = example$(EXEEXT) \
@HAVE_LIBPTHREAD_FALSE@@OSX_FALSE@ pnmshow$(EXEEXT) \
@HAVE_LIBPTHREAD_FALSE@@OSX_FALSE@ regiontest$(EXEEXT) \
@@ -110,7 +111,9 @@ CONFIG_CLEAN_FILES =
@HAVE_LIBPTHREAD_FALSE@@OSX_FALSE@ fontsel$(EXEEXT) \
@HAVE_LIBPTHREAD_FALSE@@OSX_FALSE@ vncev$(EXEEXT) \
@HAVE_LIBPTHREAD_FALSE@@OSX_FALSE@ storepasswd$(EXEEXT) \
-@HAVE_LIBPTHREAD_FALSE@@OSX_FALSE@ colourmaptest$(EXEEXT)
+@HAVE_LIBPTHREAD_FALSE@@OSX_FALSE@ colourmaptest$(EXEEXT) \
+@HAVE_LIBPTHREAD_FALSE@@OSX_FALSE@ simple$(EXEEXT) \
+@HAVE_LIBPTHREAD_FALSE@@OSX_FALSE@ simple15$(EXEEXT)
@HAVE_LIBPTHREAD_TRUE@@OSX_TRUE@noinst_PROGRAMS = example$(EXEEXT) \
@HAVE_LIBPTHREAD_TRUE@@OSX_TRUE@ pnmshow$(EXEEXT) \
@HAVE_LIBPTHREAD_TRUE@@OSX_TRUE@ regiontest$(EXEEXT) \
@@ -118,6 +121,8 @@ CONFIG_CLEAN_FILES =
@HAVE_LIBPTHREAD_TRUE@@OSX_TRUE@ fontsel$(EXEEXT) vncev$(EXEEXT) \
@HAVE_LIBPTHREAD_TRUE@@OSX_TRUE@ storepasswd$(EXEEXT) \
@HAVE_LIBPTHREAD_TRUE@@OSX_TRUE@ colourmaptest$(EXEEXT) \
+@HAVE_LIBPTHREAD_TRUE@@OSX_TRUE@ simple$(EXEEXT) \
+@HAVE_LIBPTHREAD_TRUE@@OSX_TRUE@ simple15$(EXEEXT) \
@HAVE_LIBPTHREAD_TRUE@@OSX_TRUE@ blooptest$(EXEEXT) mac$(EXEEXT)
@HAVE_LIBPTHREAD_TRUE@@OSX_FALSE@noinst_PROGRAMS = example$(EXEEXT) \
@HAVE_LIBPTHREAD_TRUE@@OSX_FALSE@ pnmshow$(EXEEXT) \
@@ -127,6 +132,8 @@ CONFIG_CLEAN_FILES =
@HAVE_LIBPTHREAD_TRUE@@OSX_FALSE@ vncev$(EXEEXT) \
@HAVE_LIBPTHREAD_TRUE@@OSX_FALSE@ storepasswd$(EXEEXT) \
@HAVE_LIBPTHREAD_TRUE@@OSX_FALSE@ colourmaptest$(EXEEXT) \
+@HAVE_LIBPTHREAD_TRUE@@OSX_FALSE@ simple$(EXEEXT) \
+@HAVE_LIBPTHREAD_TRUE@@OSX_FALSE@ simple15$(EXEEXT) \
@HAVE_LIBPTHREAD_TRUE@@OSX_FALSE@ blooptest$(EXEEXT)
PROGRAMS = $(noinst_PROGRAMS)
@@ -169,6 +176,16 @@ regiontest_OBJECTS = regiontest.$(OBJEXT)
regiontest_LDADD = $(LDADD)
regiontest_DEPENDENCIES = ../libvncserver.a
regiontest_LDFLAGS =
+simple_SOURCES = simple.c
+simple_OBJECTS = simple.$(OBJEXT)
+simple_LDADD = $(LDADD)
+simple_DEPENDENCIES = ../libvncserver.a
+simple_LDFLAGS =
+simple15_SOURCES = simple15.c
+simple15_OBJECTS = simple15.$(OBJEXT)
+simple15_LDADD = $(LDADD)
+simple15_DEPENDENCIES = ../libvncserver.a
+simple15_LDFLAGS =
storepasswd_SOURCES = storepasswd.c
storepasswd_OBJECTS = storepasswd.$(OBJEXT)
storepasswd_LDADD = $(LDADD)
@@ -190,17 +207,19 @@ depcomp = $(SHELL) $(top_srcdir)/depcomp
@AMDEP_TRUE@ $(DEPDIR)/colourmaptest.Po $(DEPDIR)/example.Po \
@AMDEP_TRUE@ $(DEPDIR)/fontsel.Po $(DEPDIR)/mac.Po \
@AMDEP_TRUE@ $(DEPDIR)/pnmshow.Po $(DEPDIR)/pnmshow24.Po \
-@AMDEP_TRUE@ $(DEPDIR)/regiontest.Po $(DEPDIR)/storepasswd.Po \
+@AMDEP_TRUE@ $(DEPDIR)/regiontest.Po $(DEPDIR)/simple.Po \
+@AMDEP_TRUE@ $(DEPDIR)/simple15.Po $(DEPDIR)/storepasswd.Po \
@AMDEP_TRUE@ $(DEPDIR)/vncev.Po
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
DIST_SOURCES = blooptest.c colourmaptest.c example.c fontsel.c mac.c \
- pnmshow.c pnmshow24.c regiontest.c storepasswd.c vncev.c
+ pnmshow.c pnmshow24.c regiontest.c simple.c simple15.c \
+ storepasswd.c vncev.c
HEADERS = $(noinst_HEADERS)
DIST_COMMON = $(noinst_HEADERS) Makefile.am Makefile.in
-SOURCES = blooptest.c colourmaptest.c example.c fontsel.c mac.c pnmshow.c pnmshow24.c regiontest.c storepasswd.c vncev.c
+SOURCES = blooptest.c colourmaptest.c example.c fontsel.c mac.c pnmshow.c pnmshow24.c regiontest.c simple.c simple15.c storepasswd.c vncev.c
all: all-am
@@ -240,6 +259,12 @@ pnmshow24$(EXEEXT): $(pnmshow24_OBJECTS) $(pnmshow24_DEPENDENCIES)
regiontest$(EXEEXT): $(regiontest_OBJECTS) $(regiontest_DEPENDENCIES)
@rm -f regiontest$(EXEEXT)
$(LINK) $(regiontest_LDFLAGS) $(regiontest_OBJECTS) $(regiontest_LDADD) $(LIBS)
+simple$(EXEEXT): $(simple_OBJECTS) $(simple_DEPENDENCIES)
+ @rm -f simple$(EXEEXT)
+ $(LINK) $(simple_LDFLAGS) $(simple_OBJECTS) $(simple_LDADD) $(LIBS)
+simple15$(EXEEXT): $(simple15_OBJECTS) $(simple15_DEPENDENCIES)
+ @rm -f simple15$(EXEEXT)
+ $(LINK) $(simple15_LDFLAGS) $(simple15_OBJECTS) $(simple15_LDADD) $(LIBS)
storepasswd$(EXEEXT): $(storepasswd_OBJECTS) $(storepasswd_DEPENDENCIES)
@rm -f storepasswd$(EXEEXT)
$(LINK) $(storepasswd_LDFLAGS) $(storepasswd_OBJECTS) $(storepasswd_LDADD) $(LIBS)
@@ -261,6 +286,8 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/pnmshow.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/pnmshow24.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/regiontest.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/simple.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/simple15.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/storepasswd.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/vncev.Po@am__quote@
diff --git a/examples/simple.c b/examples/simple.c
new file mode 100644
index 0000000..0d6345f
--- /dev/null
+++ b/examples/simple.c
@@ -0,0 +1,10 @@
+#include <rfb/rfb.h>
+
+int main(int argc,char** argv)
+{
+ rfbScreenInfoPtr server=rfbGetScreen(&argc,argv,400,300,8,3,4);
+ server->frameBuffer=malloc(400*300*4);
+ rfbInitServer(server);
+ rfbRunEventLoop(server,-1,FALSE);
+ return(0);
+}
diff --git a/examples/simple15.c b/examples/simple15.c
new file mode 100644
index 0000000..12583ba
--- /dev/null
+++ b/examples/simple15.c
@@ -0,0 +1,24 @@
+/* This example shows how to use 15-bit (which is handled as 16-bit
+ internally). */
+
+#include <rfb/rfb.h>
+
+int main(int argc,char** argv)
+{
+ int i,j;
+ uint16_t* f;
+
+ rfbScreenInfoPtr server=rfbGetScreen(&argc,argv,400,300,5,3,2);
+
+ server->frameBuffer=malloc(400*300*2);
+ f=(uint16_t*)server->frameBuffer;
+ for(j=0;j<300;j++)
+ for(i=0;i<400;i++)
+ f[j*400+i]=/* red */ ((j*32/300) << 10) |
+ /* green */ (((j+400-i)*32/700) << 5) |
+ /* blue */ ((i*32/400));
+
+ rfbInitServer(server);
+ rfbRunEventLoop(server,-1,FALSE);
+ return(0);
+}