Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Look up keyword
Like this
1Activity
0 of .
Results for:
No results containing your search query
P. 1
Oocheeps Final

Oocheeps Final

Ratings:

5.0

(2)
|Views: 140|Likes:
Published by amoswenger

More info:

Published by: amoswenger on Aug 04, 2009
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

05/25/2012

pdf

text

original

 
oocheeps a showcase of object-orientationAmos Wenger, 2009-05-25
oocheeps
a showcase of object-orientation
Introduction
As a reminder, here are some background infos on oocheeps:
It is a school assignment. The requirements were: use OpenGL, write it in C.
Out of boredom and irritation due to having to deal with pure C, I wrote
ooc
(see the other  paper), a high-level language that translates to pure C.
I wrote
all 
of 
ooc
myself (each of its 11'000 lines of code). Although using ooc for theassignment makes it considerably easier, this can hardly be considered cheating.
Since
ooc
is translated to pure C, the project is still « in C » and thus it fulfills therequirements.
Architecture
So what good did ooc on the architecture of oocheeps?
 Abstraction
List, ArrayList, SparseList. Can use same interface with different implementations
Shorter, clearer code
1 / 6
 
oocheeps a showcase of object-orientationAmos Wenger, 2009-05-25
Basic GTK example in C
#include <stdio.h>#include <gtk/gtk.h>voidclicked();intmain(intargc, char*argv[]) { GtkWidget*window, *button;  gtk_init(&argc, &argv);  window=gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_title(GTK_WINDOW(window), "GTK+C = somewhat verbose"); button=gtk_button_new(); gtk_button_set_label(GTK_BUTTON(button), "Hello, world!"); gtk_container_set_border_width(GTK_CONTAINER(button), 10); g_signal_connect(button, "clicked",G_CALLBACK(clicked),NULL); gtk_container_add(GTK_CONTAINER(window),button); gtk_widget_show_all(window);  gtk_main(); return 0; }voidclicked() { printf("Clicked!
\n
");gtk_main_quit();}
2 / 6
 
oocheeps a showcase of object-orientationAmos Wenger, 2009-05-25
Basic GTK example in ooc
include
stdio;
use
gtk;
import
gtk.Gtk;
import
gtk.Window;
import
gtk.Button;
import
gtk.Label;
int
main(
int
argc,
String
[]argv) {  Gtk.init(&argc,&argv);  
Window
window =
new
 
Window
("GTK+OOC = big win!");
Button
button =
Button
.newTextButton("Hello, world!", clicked); button.setBorderWidth(10); window.add(button); window.showAll();Gtk.main();}
void
clicked() { printf("Clicked!
\n
");Gtk.mainQuit();}
3 / 6

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->