TEST(PositioningTestGroup, CircleOfDeath) { position_t p_a = {1, 0}; position_t p_b = {0, 1}; position_t p_c = {-1, 0}; reference_triangle_t t = {NULL, NULL, NULL, 0, 0, 0}; positioning_reference_triangle_from_points(&p_a, &p_b, &p_c, &t); position_t some_point = {0.0f, -1.0f}; Angles angles = Vec2D(&some_point).angles_relative_to_triangle(&t); position_t result = {0, 0}; bool valid = positioning_from_angles( angles.alpha, angles.beta, angles.gamma, &t, &result); CHECK(!valid); CHECK(Vec2D(&result) != Vec2D(&some_point)); }
void hgeh::render_circle_slice( HGE *hge, float x, float y, float radius, int segments, float begin, float end, DWORD color ) { const float increment = ( end - begin ) / segments; float theta = begin; const Vec2D center( x, y ); typedef std::vector<Vec2D> Positions; Positions positions; for( int i = 0; i < segments + 1; ++i ) { Vec2D p = Vec2D( std::cos( theta ), std::sin( theta ) ); p *= radius; p += center; positions.push_back( p ); theta += increment; } render_lines( hge, positions, color ); Vec2D first = Vec2D( std::cos( begin ), std::sin( begin ) ) * radius + center; Vec2D last = Vec2D( std::cos( end ), std::sin( end ) ) * radius + center; //-1 correct point hge->Gfx_RenderLine( center.x - 1, center.y, first.x, first.y, color ); hge->Gfx_RenderLine( center.x, center.y, last.x, last.y, color ); }
int RetourInfos(int x_info,int y_info) { neuro.Print(string_numeric_entry,x_info,y_info+15);//input chaine clavier numerique petitchiffre.Print(string_last_ch,x_info,y_info+30);//input last ch selected petitchiffre.Print(string_last_copy_mem,x_info+170,y_info+30); Rect VisuHue(Vec2D(x_info+290,y_info+15),Vec2D(30,20)); Rgba CouleurPreviewHue(r_pick,v_pick,b_pick,255); VisuHue.Draw(CouleurPreviewHue); Rgba CouleurPreviewChroma(my_red,my_green,my_blue,255); Rect VisuChroma(Vec2D(x_info+325,y_info+15),Vec2D(30,20)); VisuChroma.Draw(CouleurPreviewChroma); petitpetitchiffre.Print(string_dock_col_sel,x_info+293,y_info+30); petitchiffre.Print(string_secondary_feeback,x_info,y_info+45);// petitchiffrerouge.Print(string_display_dmx_params,x_info,y_info+60); petitchiffre.Print(">>MIDI IN:",x_info, y_info+75);//midi in petitchiffre.Print(my_midi_string,x_info+70, y_info+75);//midi in petitchiffre.Print("Time Is:",x_info,y_info+90); petitchiffre.Print(tmp_time,x_info+60,y_info+90); sprintf(visu_chrono_str,"Chrono: %d..%d.%d",time_minutes,time_secondes, time_centiemes); petitchiffre.Print(visu_chrono_str,x_info+170,y_info+90); petitchiffrerouge.Print(string_Last_Order,x_info, y_info+105);//last order diodes_artnet(x_info,y_info+120); if(index_do_light_diode_artnet==1){light_temoin_universe(incoming_universe,x_info,y_info+120);index_do_light_diode_artnet=0; } if((myDMXinterfaceis==1 && index_init_dmx_ok==1) || index_artnet_doubledmx==1) {light_temoin_emission(Univers,x_info,y_info+120);} return(0); }
void rxScreenTriangle::Initialize() { if( ! vertexLayout ) { vertexLayout = RX_GET_INPUT_LAYOUT( ScreenVertex ); } if( ! vertexBuffer ) { // NOTE: z = 1 (the farthest possible distance) -> optimization for deferred lighting/shading engines: // skybox outputs z = w = 1 -> if we set depth test to less than the sky won't be shaded // const ScreenVertex vertices[VERTEX_COUNT] = { ScreenVertex( Vec4D( -1.0f, -3.0f, 1.0f, 1.0f ), Vec2D( 0.0f, 2.0f ) ), // lower-left ScreenVertex( Vec4D( -1.0f, 1.0f, 1.0f, 1.0f ), Vec2D( 0.0f, 0.0f ) ), // upper-left ScreenVertex( Vec4D( 3.0f, 1.0f, 1.0f, 1.0f ), Vec2D( 2.0f, 0.0f ) ), // upper-right }; vertexBuffer = rxResourceServer::Get().NewVertexBuffer( sizeof( vertices ), sizeof(vertices[0]), vertices ); } }
TEST(PositioningTestGroup, NormalBehaviour) { position_t p_a = {POINT_A_X, POINT_A_Y}; position_t p_b = {POINT_B_X, POINT_B_Y}; position_t p_c = {POINT_C_X, POINT_C_Y}; reference_triangle_t t = {NULL, NULL, NULL, 0, 0, 0}; positioning_reference_triangle_from_points(&p_a, &p_b, &p_c, &t); position_t some_point = {1.0f, 1.0f}; Angles angles = Vec2D(&some_point).angles_relative_to_triangle(&t); position_t result = {0, 0}; bool valid = positioning_from_angles( angles.alpha, angles.beta, angles.gamma, &t, &result); CHECK(valid); CHECK_EQUAL(Vec2D(&some_point), Vec2D(&result)); }
void drawTestPattern(Paintable *paintable, int index) { Painter painter(paintable); switch (index) { case 0: painter.setColor(Color::fromRgbValue(1,0,0)); painter.drawEllipse(128, 96, 64, 32); break; case 1: painter.setColor(Color::fromRgbValue(0,1,0)); painter.drawRect(128, 96, 128, 96); break; case 2: { Polygon polygon; polygon << Vec2D(256, 128) << Vec2D(192, 256) << Vec2D(320, 256); painter.drawPolygon(polygon); break; } default: break; } }
void CTerrainData::getGrassVertexByCell(int nCellX, int nCellY, TerrainVertex*& vertex)const { const TerrainCell* cell1 = getCell(nCellX,nCellY); const TerrainCell* cell2 = getCell(nCellX+1,nCellY+1); int nRand = (((nCellY*m_nVertexXCount+nCellX+nCellX*nCellY)*214013L+2531011L)>>16)&0x7fff; float fTexU = (nRand%4)*0.25f; vertex[0].p = Vec3D((float)nCellX, cell1->fHeight, (float)nCellY); //vertex[0].n = Vec3DGetCellNormal(posCell1); vertex[0].c = cell1->color; vertex[0].t0 = Vec2D(fTexU,1.0f); vertex[1].p = vertex[0].p+Vec3D(0.0f,1.5f,0.0f); //vertex[1].n = vertex[0].n; vertex[1].c = vertex[0].c; vertex[1].t0 = Vec2D(fTexU,0.0f); vertex[3].p = Vec3D((float)(nCellX+1), cell2->fHeight, (float)(nCellY+1)); //vertex[3].n = GetCellNormal(posCell2); vertex[3].c = cell2->color; vertex[3].t0 = Vec2D(fTexU+0.25f,1.0f); vertex[2].p = vertex[3].p+Vec3D(0.0f,1.5f,0.0f); //vertex[2].n = vertex[3].n; vertex[2].c = vertex[3].c; vertex[2].t0 = Vec2D(fTexU+0.25f,0.0f); }
int draw_curve_node(int n) { if(n<6) { Circle(curve_nodes[n].x, curve_nodes[n].y, 6).DrawOutline(CouleurBlind); petitchiffre.Print(ol::ToString(n),curve_nodes[n].x-7, curve_nodes[n].y-7); } if( window_focus_id==W_PATCH && mouse_x>=((curve_nodes[n].x)-(diam_curve_node/2)) && mouse_x<=((curve_nodes[n].x)+(diam_curve_node/2)) && mouse_x>=xpatch_window+30+455 && mouse_x<=xpatch_window+30+455+255 && mouse_x>(curve_nodes[n-1].x+(diam_curve_node/2)) && mouse_x<(curve_nodes[n+1].x-(diam_curve_node/2)) && mouse_y>=ypatch_window+50 && mouse_y<=ypatch_window+255+50 ) { Line( Vec2D( curve_nodes[n].x, ypatch_window+50 ), Vec2D(curve_nodes[n].x,ypatch_window+255+50)).Draw(Rgba::YELLOW); Circle(curve_nodes[n].x, curve_nodes[n].y, 6).Draw(CouleurBlind); if(mouse_b&1 && index_enable_curve_editing==1 ) { if(n>1 && n<5) { curve_ctrl_pt[curve_selected][n][0]=mouse_x-(xpatch_window+30+455); curve_ctrl_pt[curve_selected][n][1]=mouse_y-(ypatch_window+50); } if(n==1) { curve_ctrl_pt[curve_selected][n][0]=0; curve_ctrl_pt[curve_selected][n][1]=mouse_y-(ypatch_window+50); } if(n==5) { curve_ctrl_pt[curve_selected][n][0]=255; curve_ctrl_pt[curve_selected][n][1]=mouse_y-(ypatch_window+50); } write_curve();//ecriture des niveaux } } if (dmx_view==1)//255 { //affichage OUT petitpetitchiffrerouge.Print(ol::ToString(255-curve_ctrl_pt[curve_selected][n][1]),xpatch_window+5+455,ypatch_window+50+curve_ctrl_pt[curve_selected][n][1]); //affichage IN petitpetitchiffre.Print(ol::ToString(curve_ctrl_pt[curve_selected][n][0]),xpatch_window+455+20+curve_ctrl_pt[curve_selected][n][0],ypatch_window+50+270); } else if (dmx_view==0)//% { //affichage OUT petitpetitchiffrerouge.Print(ol::ToString((int)((255-curve_ctrl_pt[curve_selected][n][1])/2.55)),xpatch_window+5+455,ypatch_window+50+curve_ctrl_pt[curve_selected][n][1]); //affichage IN petitpetitchiffre.Print(ol::ToString((int)((curve_ctrl_pt[curve_selected][n][0])/2.55)),xpatch_window+455+20+curve_ctrl_pt[curve_selected][n][0],ypatch_window+50+270); } return(0); }
int Procedure(char procedure_title[64],char procedure_subtitle[120]) { Rect ProcedureAera( Vec2D( window_proc_x, window_proc_y), Vec2D ( 400,70)); ProcedureAera.SetRoundness(15); ProcedureAera.Draw(CouleurBleuProcedure); ProcedureAera.DrawOutline(CouleurLigne); neuro.Print(procedure_title, window_proc_x+120,window_proc_y+20); petitchiffre.Print( procedure_subtitle,window_proc_x+20, window_proc_y+45); return(0); }
void Camera::drawRotateSquareOnWindowSwayed(Vec2D pos_center, Size size, double rot_angle, Color_RGB color, bool fill) { if (!this->isVisibleForWindowPos(pos_center + this->sway_now, size, rot_angle)) return; Vec2D p1 = pos_center + Mat2D::rotation(rot_angle, Vec2D(-size.width / 2, -size.height / 2)) + this->sway_now; Vec2D p2 = pos_center + Mat2D::rotation(rot_angle, Vec2D(size.width / 2, -size.height / 2)) + this->sway_now; Vec2D p3 = pos_center + Mat2D::rotation(rot_angle, Vec2D(size.width / 2, size.height / 2)) + this->sway_now; Vec2D p4 = pos_center + Mat2D::rotation(rot_angle, Vec2D(-size.width / 2, size.height / 2)) + this->sway_now; Color_RGB c = color*this->shield_ratio; DrawQuadrangle((int)p1.x, (int)p1.y, (int)p2.x, (int)p2.y, (int)p3.x, (int)p3.y, (int)p4.x, (int)p4.y, c.toColor(), fill); }
Vec2D Vec2D::unit() const { float l = length(); if(l > 0) { return Vec2D(x / l, y / l); } else { return Vec2D(0, 0); } }
int do_keyboard_conf(int cfgnetw_X, int cfgnetw_Y)//ancienne version { petitchiffre.Print("Keyboard Mapping: " ,cfgnetw_X, cfgnetw_Y); Line(Vec2D(cfgnetw_X,cfgnetw_Y+5),Vec2D(cfgnetw_X+90,cfgnetw_Y+5)).Draw(CouleurLigne); sprintf(string_clavier_is,"Asc= %d Allg= %d KEY= %s ",scan_ascii_is,scan_allegro_key_is,string_key_id); petitchiffre.Print(string_clavier_is,cfgnetw_X,cfgnetw_Y+20); char str_iskeyfunct[25]; for (int oi=0;oi<nbre_key_persos;oi++) { Rect keyParam(Vec2D(cfgnetw_X+60,cfgnetw_Y+25+(oi*30)),Vec2D(50,25)); keyParam.SetRoundness(7.5); keyParam.SetLineWidth(epaisseur_ligne_fader); keyParam.Draw(CouleurFond.WithAlpha(0.5)); switch(oi) { case 0: sprintf(str_iskeyfunct,"AT LEVEL"); break; case 1: sprintf(str_iskeyfunct,"CH +"); break; case 2: sprintf(str_iskeyfunct,"CH -"); break; case 3: sprintf(str_iskeyfunct,"THRU"); break; case 4: sprintf(str_iskeyfunct,"CLEAR"); break; } if(mouse_x>cfgnetw_X+60 && mouse_x<cfgnetw_X+60+50 && mouse_y>cfgnetw_Y+25+(oi*30) && mouse_y<cfgnetw_Y+25+(oi*30)+25) { keyParam.DrawOutline(CouleurLevel); if(mouse_button==1 && mouse_released==0) { int tmp_valAsc=atoi(numeric); if((tmp_valAsc>0 && tmp_valAsc<255)|| tmp_valAsc==999)//999 pour eviter de bloquer les commandes en 0 ascii , genre touches de fonctions { mapping_temporaire[oi]=tmp_valAsc; } reset_numeric_entry(); mouse_released=1; } } petitpetitchiffre.Print(str_iskeyfunct,cfgnetw_X,cfgnetw_Y+40+(oi*30)); petitpetitchiffre.Print(ol::ToString(mapping_temporaire[oi]),cfgnetw_X+75,cfgnetw_Y+40+(oi*30)); } return(0); }
bool Camera::isVisibleForWindowPos(Vec2D p, Size s, double ang) { Vec2D p1 = p + Mat2D::rotation(ang, Vec2D(-s.width / 2, -s.height / 2)); Vec2D p2 = p + Mat2D::rotation(ang, Vec2D( s.width / 2, -s.height / 2)); Vec2D p3 = p + Mat2D::rotation(ang, Vec2D(-s.width / 2, s.height / 2)); Vec2D p4 = p + Mat2D::rotation(ang, Vec2D( s.width / 2, s.height / 2)); Vec2D w1 = Vec2D(0.0, 0.0); Vec2D w2 = Vec2D(this->windowPixelSize.width, 0.0); Vec2D w3 = Vec2D(this->windowPixelSize.width, this->windowPixelSize.height); Vec2D w4 = Vec2D(0.0, this->windowPixelSize.height); if (Vec2D::isCrossLine(p1, p2, w1, w2)) return true; if (Vec2D::isCrossLine(p1, p2, w2, w3)) return true; if (Vec2D::isCrossLine(p1, p2, w3, w4)) return true; if (Vec2D::isCrossLine(p1, p2, w4, w1)) return true; if (Vec2D::isCrossLine(p2, p3, w1, w2)) return true; if (Vec2D::isCrossLine(p2, p3, w2, w3)) return true; if (Vec2D::isCrossLine(p2, p3, w3, w4)) return true; if (Vec2D::isCrossLine(p2, p3, w4, w1)) return true; if (Vec2D::isCrossLine(p3, p4, w1, w2)) return true; if (Vec2D::isCrossLine(p3, p4, w2, w3)) return true; if (Vec2D::isCrossLine(p3, p4, w3, w4)) return true; if (Vec2D::isCrossLine(p3, p4, w4, w1)) return true; if (Vec2D::isCrossLine(p4, p1, w1, w2)) return true; if (Vec2D::isCrossLine(p4, p1, w2, w3)) return true; if (Vec2D::isCrossLine(p4, p1, w3, w4)) return true; if (Vec2D::isCrossLine(p4, p1, w4, w1)) return true; if (!Vec2D::isPointWholeInSquare(w1, w2, w3, w4, p1)) return false; if (!Vec2D::isPointWholeInSquare(w1, w2, w3, w4, p2)) return false; if (!Vec2D::isPointWholeInSquare(w1, w2, w3, w4, p3)) return false; if (!Vec2D::isPointWholeInSquare(w1, w2, w3, w4, p4)) return false; return true; }
int fader_niveau_son(int xp, int yp, int numero) { Rect FaderSon(Vec2D(xp,yp),Vec2D(20,127)); FaderSon.SetRoundness(5); Rect FaderSonNiveau(Vec2D(xp,yp+(127-player_niveauson[numero])),Vec2D(20,player_niveauson[numero])); FaderSonNiveau.Draw(CouleurFader); FaderSon.DrawOutline(CouleurLigne.WithAlpha(0.5)); petitpetitchiffre.Print(string_niveauson[numero],xp+22,yp+10); petitpetitchiffre.Print(ol::ToString(player_niveauson[numero]),xp+22,yp+20); if(window_focus_id==919 && Midi_Faders_Affectation_Type!=0 && mouse_x>xp && mouse_x<xp+20 && mouse_y>=yp && mouse_y<=yp+127 ) { FaderSon.DrawOutline(CouleurBlind); } Line (Vec2D(xp+20,yp+107),Vec2D(xp+30,yp+112)).Draw(CouleurLigne); Circle(Vec2D(xp+37,yp+117),7).Draw(CouleurBlind.WithAlpha(midi_send_out[616+numero])); Circle(Vec2D(xp+37,yp+117),7).DrawOutline(CouleurLigne); raccrochage_midi_visuel_vertical(xp,yp,616+numero,20,127); return(0); }
int level_wheel (int xw,int yw, int rayon_k, float angle_correction) { Circle (Vec2D(xw,yw), rayon_k+5).DrawOutline(CouleurLigne); Circle (Vec2D(xw,yw), rayon_k-5).DrawOutline(CouleurLigne); Circle(Vec2D(position_curseur_pad_x,position_curseur_pad_y),5).Draw(CouleurBlind); int poucentmidi=(int)((((float)midi_levels[664])/127)*100); petitpetitchiffrerouge.Print(ol::ToString(poucentmidi),xw-5,yw+2); petitpetitchiffre.Print(ol::ToString(midi_levels[664]),xw-5,yw+12); //AFFECTATION MIDI if( Midi_Faders_Affectation_Type!=0)//config midi { if(mouse_x>xw-rayon_k-5 && mouse_x<xw+rayon_k+5 && mouse_y>yw-rayon_k-5 && mouse_y<yw+rayon_k+5) { Circle (Vec2D(xw,yw), rayon_k+5).DrawOutline(CouleurBlind); if(mouse_button==1 && mouse_released==0) { Circle (Vec2D(xw,yw), rayon_k+5).Draw(CouleurBlind); } } } //toggle mode Relativ / absolute Rect WheelMode(Vec2D(xw+rayon_k+10,yw-rayon_k),Vec2D(15,15)); WheelMode.SetRoundness(3); switch(wheellevel_absolutemode) { case 0: WheelMode.Draw(CouleurLock); petitchiffre.Print("R",xw+rayon_k+13,yw-rayon_k+12); break; case 1: WheelMode.Draw(CouleurSurvol); petitchiffre.Print("A",xw+rayon_k+13,yw-rayon_k+12); break; } WheelMode.DrawOutline(CouleurLigne); //midi out Line (Vec2D(xw+rayon_k,yw+rayon_k-3),Vec2D(xw+rayon_k+7,yw+rayon_k+7)).Draw(CouleurLigne); Circle MidiOutW(Vec2D(xw+rayon_k+10,yw+rayon_k+10),7); if(midi_send_out[664]==1){MidiOutW.Draw(CouleurBlind);} MidiOutW.DrawOutline(CouleurLigne); return(0); }
void Camera::drawRotateSquareInWorld(Vec2D pos_center, Size original_size, double rot_angle, Color_RGB color, bool fill) { Vec2D p = this->toWindowPosPxFromWorldPos(pos_center) + this->sway_now; Size s = original_size * this->zoom_magnification_now; double a = rot_angle - this->rotate_angle_now; if (!this->isVisibleForWindowPos(p, s, a)) return; Vec2D p1 = p + Mat2D::rotation(a, Vec2D(-s.width / 2, -s.height / 2)); Vec2D p2 = p + Mat2D::rotation(a, Vec2D( s.width / 2, -s.height / 2)); Vec2D p3 = p + Mat2D::rotation(a, Vec2D( s.width / 2, s.height / 2)); Vec2D p4 = p + Mat2D::rotation(a, Vec2D(-s.width / 2, s.height / 2)); Color_RGB c = color*this->shield_ratio; DrawQuadrangle((int)p1.x, (int)p1.y, (int)p2.x, (int)p2.y, (int)p3.x, (int)p3.y, (int)p4.x, (int)p4.y, c.toColor(), fill); }
void hgeh::render_circle_slice( HGE *hge, const Vec2D center, float radius, int segments, float begin, float end, DWORD color ) { const float increment = ( end - begin ) / segments; float theta = begin; typedef std::vector<Vec2D> Positions; Positions positions; for( int i = 0; i < segments; ++i ) { Vec2D p = Vec2D( std::cos( theta ), std::sin( theta ) ); p *= radius; p += center; positions.push_back( p ); theta += increment; } for( Positions::iterator it = positions.begin(); it != positions.end(); ) { Vec2D p1 = *it; ++it; Vec2D p2; if( it != positions.end() ) { p2 = *it; } else { break; } hge->Gfx_RenderLine( p1.x, p1.y, p2.x, p2.y, color ); } }
void PathMove::computeNextMove( Object& obj ) { setNextIndex(); if ( nextIndex >= path.size()) { obj.setVelocity( Vec2D(0,0) ); return; } Vec2D& nexPos = path[nextIndex]; moveSpeed = nexPos - obj.getPos(); float dist = sqrtf( moveSpeed.length2() ); moveTime = dist / speed; if ( fabs( moveTime ) <= 0.000001 ) { computeNextMove(obj); return; } moveSpeed = ( 1 / moveTime )* moveSpeed; obj.setVelocity( moveSpeed ); }
void Camera::init(Size window_size) { this->windowPixelSize = window_size; this->worldSize = this->windowPixelSize; this->pos_anchor_world_now = (this->windowPixelSize / 2).toVec(); this->pos_anchor_window = (this->windowPixelSize / 2).toVec(); this->shield_ratio = 1.0; this->anchor_target_world_pos_goal = this->pos_anchor_world_now; this->anchor_target_world_pos_start = this->pos_anchor_world_now; this->move_count = 0; this->move_count_max = 0; this->zoom_magnification_now = 1.0; this->zoom_count = 0; this->zoom_count_max = 0; this->zoom_magnification_end = 1.0; this->zoom_magnification_start = 1.0; this->rotate_angle_now = 0.0; this->rotate_count = 0; this->rotate_count_max = 0; this->rotate_angle_start = 0.0; this->rotate_angle_end = 0.0; this->sway_now = Vec2D(0.0, 0.0); this->sway_count = 0; this->sway_count_max = 0; }
TEST(PositioningTestGroup, OutputParamIsNULL) { position_t p_a = {POINT_A_X, POINT_A_Y}; position_t p_b = {POINT_B_X, POINT_B_Y}; position_t p_c = {POINT_C_X, POINT_C_Y}; reference_triangle_t t = {NULL, NULL, NULL, 0, 0, 0}; positioning_reference_triangle_from_points(&p_a, &p_b, &p_c, &t); position_t some_point = {1.0f, 1.0f}; Angles angles = Vec2D(&some_point).angles_relative_to_triangle(&t); position_t result = {0, 0}; bool valid = positioning_from_angles( angles.alpha, angles.beta, angles.gamma, &t, NULL); CHECK(!valid); DOUBLES_EQUAL(0.0, result.x, 0.0001); DOUBLES_EQUAL(0.0, result.y, 0.0001); }
DirArrayGen::DirArrayGen( Vec2D const& d ) { difPos = Vec2D(0,0); dir = ( 1.0f / sqrtf( d.length2() ) ) * d; num = 1; offset = 2; }
void MovableEntity::move(Real speed) { const Real dx = cos(angle) * speed; const Real dy = sin(angle) * speed; const Vec2D pos = getPos() + Vec2D(dx, dy); setPos(game.getWorld().checkCollision(getPos(), pos, 0.35)); // UNDONE: magic nr }
int Box_artnet_udpport(int macx, int macy) { petitchiffre.Print("Art-Net UDP Ports",macx-5,macy-20); petitpetitchiffre.Print("- default 6454 -",macx+10,macy); petitpetitchiffre.Print("Out:",macx-5,macy+20); petitpetitchiffre.Print("In:",macx+70,macy+20); Rect UDPOut(Vec2D(macx+20,macy+5),Vec2D(45,25)); UDPOut.SetRoundness(7.5); UDPOut.Draw(CouleurFond.WithAlpha(0.4)); Rect UDPIn(Vec2D(macx+95,macy+5),Vec2D(45,25)); UDPIn.SetRoundness(7.5); UDPIn.Draw(CouleurFond.WithAlpha(0.4)); petitpetitchiffre.Print(ol::ToString(clientport_artnet),macx+25,macy+20); petitpetitchiffre.Print(ol::ToString(serveurport_artnet),macx+100,macy+20); if(mouse_y>macy+5 && mouse_y<macy+5+25 && window_focus_id==920) { if(mouse_x>macx+20 && mouse_x<macx+20+45) { UDPOut.DrawOutline(CouleurLevel); if(mouse_button==1 && mouse_released==0) { clientport_artnet=atoi(numeric); reset_numeric_entry(); index_re_init_client_artnet=1; index_ask_confirm=1; mouse_released=1; } } else if(mouse_x>macx+95 && mouse_x<macx+95+45) { UDPIn.DrawOutline(CouleurLevel); if(mouse_button==1 && mouse_released==0) { serveurport_artnet=atoi(numeric); reset_numeric_entry(); index_re_init_serveur_artnet=1; index_ask_confirm=1; mouse_released=1; } } } return(0); }
toxi::geom::Vec2D toxi::geom::Vec2D::getCartesian() { Vec2D v = Vec2D( 0, 0 ); float xx = (float) (x * std::cos(y)); v.y = (float) (x *std::sin(y)); v.x = xx; return v; }
int bouton_track_down(int xp, int yp,bool state) { Rect Btrack_stay(Vec2D(xp,yp),Vec2D(40,20)); Btrack_stay.SetRoundness(4); if(state==1){ Btrack_stay.Draw(CouleurRed);} Btrack_stay.DrawOutline(CouleurLigne); Line(Vec2D(xp,yp+5),Vec2D(xp+40,yp+20)).Draw(CouleurLigne); if(mouse_x>xp && mouse_x<xp+40 && mouse_y>yp && mouse_y<yp+20) { if( Midi_Faders_Affectation_Type!=0)//config midi { Btrack_stay.DrawOutline(CouleurBlind); } } return(0); }
int Grid_player(int xb, int yb, int num_grider) { Line(Vec2D(xb+10,yb-10),Vec2D(xb+largeurGrider, yb-10)).Draw(CouleurLigne); neuromoyen.Print("GridPlayer",xb+500,yb+15); neuro.Print(ol::ToString(num_grider+1),xb+578,yb+17); TheCallGridBox(xb,yb,num_grider); TheStepBox(xb+315,yb, num_grider); ThePlayCommands(xb+400,yb,num_grider); TheGrid_commands(xb+20,yb+35,num_grider);//pos x, posy y, num player TheGrid_divers(xb+220,yb+30,num_grider);//pos x, posy y, num player TheGrid_matrix(xb+340,yb+35,num_grider);//pos x pos y taille de case num player return(0); }
void Player::UpdateView(f32 mX, f32 mY) { PlyrDat *plyr_pDat = (PlyrDat *)m_ent->m_usrDat; //rotating via mouse g_game.viewRotX += (mY)/100; if(g_game.viewRotX < -PI/2) g_game.viewRotX = -PI/2; else if(g_game.viewRotX > PI/3) g_game.viewRotX = PI/3; if(g_game.viewbLook) { g_game.viewRotY += (mX)/100; f32 dirRotY = g_gi.Vec2DGetAngle(&Vec2D(m_ent->m_dir.x, m_ent->m_dir.z)); Matrix rotMtx; g_gi.MtxYawPitchRoll(dirRotY+g_game.viewRotY, g_game.viewRotX, 0, &rotMtx); g_gi.Vec3DTransformNormal(&g_game.viewDirDefault, &rotMtx, &g_game.viewDir); } else if(!g_game.viewbLook) { g_game.viewRotY = 0; if(m_ent->m_obj) { f32 dirRotY = g_gi.Vec2DGetAngle(&Vec2D(m_ent->m_dir.x, m_ent->m_dir.z)); Matrix rotMtx; g_gi.MtxYawPitchRoll(dirRotY, g_game.viewRotX, 0, &rotMtx); g_gi.Vec3DTransformNormal(&g_game.viewDirDefault, &rotMtx, &g_game.viewDir); } } //set the view to back of current Ta-Ta. Vec3D lookat(plyr_pDat->m_lookatOfs+m_ent->m_loc); g_game.view->SetTgt(lookat); g_game.view->SetPt(lookat + (plyr_pDat->m_lookDist*g_game.viewDir)); }
void toxi::geom::Polygon2D::offsetCorner( const float & x1, const float & y1, const float & x2, const float & y2, const float & x3, const float & y3, const float & distance, Vec2D * out ) { float c1 = x2, d1 = y2, c2 = x2, d2 = y2; float dx1, dy1, dist1, dx2, dy2, dist2, insetX, insetY; dx1 = x2 - x1; dy1 = y2 - y1; dist1 = (float) toxi::math::MathUtils::sqrt(dx1 * dx1 + dy1 * dy1); dx2 = x3 - x2; dy2 = y3 - y2; dist2 = (float) toxi::math::MathUtils::sqrt(dx2 * dx2 + dy2 * dy2); if (dist1 < toxi::math::MathUtils::EPS || dist2 < toxi::math::MathUtils::EPS) { return; } dist1 = distance / dist1; dist2 = distance / dist2; insetX = dy1 * dist1; insetY = -dx1 * dist1; float _x1 = x1 +insetX; c1 += insetX; float _y1 = y1 + insetY; d1 += insetY; insetX = dy2 * dist2; insetY = -dx2 * dist2; float _x3 = x3 + insetX; c2 += insetX; float _y3 = y3 + insetY; d2 += insetY; if (c1 == c2 && d1 == d2) { out->set(c1, d1); return; } Line2D l1 = toxi::geom::Line2D( Vec2D(_x1, _y1), Vec2D(c1, d1)); Line2D l2 = toxi::geom::Line2D( Vec2D(c2, d2), Vec2D(_x3, _y3)); LineIntersection isec = l1.intersectLine( l2); Vec2D ipos = isec.getPos(); if (ipos.isZeroVector()) { out->set(ipos); } }
void Camera::setSwayVibrationDecaying(int pow, int count_max, double trans_rad, int rot_freq) { this->sway_count = 0; this->sway_count_max = count_max; this->sway_power_max = pow; this->sway_vib_rotate_freq = rot_freq; this->sway_vib_trans_rad = trans_rad; this->sway_now = Vec2D(0.0, 0.0); this->sway_update_time = 0; }
cEntity::cEntity() { m_Graphics = 0; m_Position = Vec2D(0,0); m_Image = ""; m_Width = 0; m_Height = 0; m_Rotation = 0; m_Destroyed = false; }