Skip to content
Snippets Groups Projects
Commit dc3584fb authored by Faruk Hammoud's avatar Faruk Hammoud
Browse files

nilo1

parents
No related branches found
No related tags found
No related merge requests found
//NiloProject Versao alpha 0.3
//by Faruk Hammoud, Escola Politecnica da Universidade de Sao Paulo, 2017.
PImage poli;
PImage calatrava;
PImage pizza;
import camera3D.*;
import camera3D.generators.*;
import camera3D.generators.util.*;
import processing.net.*;
//DEFINES
int MAP_MAX = 1000;
//Funções Anexas
void Definicoes() {
TAREFAS.AlteraTarefaCodigo("Exemplo", "MOUSEPRESSED");
TAREFAS.AlteraTarefaLetra("Exemplo", 'd');
TAREFAS.Tarefa("Ativa Frame Base");
noCursor();
}
//Funções Main
void setup() {
fullScreen(P3D);
poli = loadImage("poli.png");
calatrava = loadImage("calatrava.jpg");
pizza = loadImage("pizza.png");
Definicoes();
}
void draw() {
FRAMES.Mostrar();
lights();
directionalLight(0, 255, 0, 0, -1, 0);
}
\ No newline at end of file
data/calatrava.jpg

169 KiB

data/pizza.png

937 KiB

data/poli.png

8.28 KiB

Interface INTERFACE = new Interface();
class Interface {
String tmp_text="";
float valor_scroll = -30.0;
float valor_setas = 0;
float rotacao_z = 0.0;
int x_ref = 0;
int y_ref = 0;
int x_relativo = 0;
int y_relativo = 0;
boolean mouse_clicked = false;
Interface() {
}
void Referencia() {
rotateZ(INTERFACE.rotacao_z);
translate(INTERFACE.x_relativo, INTERFACE.y_relativo, INTERFACE.valor_scroll*10);
}
void ScrollPlus() {
valor_scroll++;
if(valor_scroll>0){valor_scroll = 0;}
}
void ScrollMinus() {
valor_scroll--;
if(valor_scroll<-50){valor_scroll = -50;}
}
void DeletaString() {
this.tmp_text="";
}
String RetornaString() {
return this.tmp_text;
}
float RetornaScroll() {
return this.valor_scroll;
}
void ZeraScroll() {
this.valor_scroll = 0;
}
void VerificaCodigo(String codigo) {
}
}
void keyPressed() {
//Geral
//Especifico
if ((key>='a'&&key<='z')||key==' '||key=='.'||(key>='A'&&key<='Z')||(key>='0'&&key<='9')||key=='ç'||key=='!'||key=='?') {
INTERFACE.tmp_text += str(key);
TAREFAS.TarefaLetra(key);
}
if (keyCode == DOWN) {
TAREFAS.TarefaCodigo("BAIXO");
} else if (keyCode == LEFT) {
TAREFAS.TarefaCodigo("ESQUERDA");
} else if (keyCode == RIGHT) {
TAREFAS.TarefaCodigo("DIREITA");
} else if (keyCode == UP) {
TAREFAS.TarefaCodigo("CIMA");
} else if (keyCode == ENTER) {
TAREFAS.TarefaCodigo("ENTER");
}
if (key==DELETE) {
INTERFACE.DeletaString();
}
if (key==BACKSPACE) {
if (INTERFACE.tmp_text.length() > 0) {
INTERFACE.tmp_text = INTERFACE.tmp_text.substring(0, INTERFACE.tmp_text.length() - 1);
}
}
}
void mousePressed() {
TAREFAS.TarefaCodigo("MOUSEPRESSED");
}
void mouseDragged() {
TAREFAS.TarefaCodigo("MOUSEDRAGGED");
}
void mouseClicked() {
INTERFACE.mouse_clicked = true;
TAREFAS.TarefaCodigo("MOUSECLICKED");
}
void mouseWheel(MouseEvent event) {
float e = event.getCount();
if (e>0) {
//println(mouseX+" "+mouseY);
INTERFACE.ScrollPlus();
} else {
INTERFACE.ScrollMinus();
}
}
\ No newline at end of file
class Tela:
void Mostrar:
\ No newline at end of file
Tarefas TAREFAS = new Tarefas();
class Tarefas {
//Vetor Tarefa por Letra e Codigo
String[] tarefa_letra = new String[512];
String[] tarefa_codigo = new String[512];
String[] codigo = new String[512];
int indice_codigo = 0;
//Inicialização
Tarefas() {
for (int a = 0; a < this.tarefa_letra.length; a++) {
this.tarefa_letra[a] = "";
this.tarefa_codigo[a] = "";
this.codigo[a]= "";
}
}
//Função Tarefa
void AlteraTarefaLetra(String tarefa, char letra) {
this.tarefa_letra[int(letra)] = tarefa;
}
void AlteraTarefaCodigo(String tarefa, String n_codigo) {
this.tarefa_codigo[this.indice_codigo] = tarefa;
this.codigo[this.indice_codigo] = n_codigo;
this.indice_codigo++;
}
void Tarefa(String tarefa) {
if (tarefa == "") {
//Livre Execução
}
if (tarefa == "Ativa Frame Mapa") {
FRAMES.AtivaFrame(500);
}
if (tarefa == "Ativa Frame Base") {
FRAMES.AtivaFrame(0);
}
if (tarefa == "Estabelece Referência") {
INTERFACE.x_ref=mouseX;
INTERFACE.y_ref=mouseY;
}
if (tarefa == "Estabelece Arraste Mouse") {
INTERFACE.x_relativo+=(mouseX-INTERFACE.x_ref);
INTERFACE.y_relativo+=(mouseY-INTERFACE.y_ref);
INTERFACE.x_ref=mouseX;
INTERFACE.y_ref=mouseY;
}
if (tarefa == "Rotacionar Sentido Anti-horario") {
INTERFACE.rotacao_z -= PI/18;
}
if (tarefa == "Rotacionar Sentido Horario") {
INTERFACE.rotacao_z += PI/18;
}
if (tarefa == "CIMA - Bloco de Mapa") {
if (MAPA.bloco_y != 0) {
MAPA.bloco_y--;
}
}
if (tarefa == "Retorna Slide") {
FRAMES.FRAME_Base.frame_atual--;
}
if (tarefa == "BAIXO - Bloco de Mapa") {
if (MAPA.bloco_y != MAP_MAX/50 - 1) {
MAPA.bloco_y++;
}
}
if (tarefa == "Avanca Slide") {
FRAMES.FRAME_Base.frame_atual++;
}
}
void TarefaLetra(char letra) {
//println(int(letra));
this.Tarefa(this.tarefa_letra[int(letra)]);
}
void TarefaCodigo(String texto) {
for (int a = 0; a<256; a++) {
if (this.codigo[a] == texto) {
this.Tarefa(this.tarefa_codigo[a]);
}
}
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment