ScrollBar::ScrollBar( int nId, Win* parent, bool _vertical, bool _autoHide, crect* rect ) : Win( Win::WT_CHILD, 0, parent, rect, nId ), vertical( _vertical ), si( 100, 10, 0 ), len( 0 ), bsize( 0 ), bpos( 0 ), trace( false ), traceBPoint( 0 ), autoHide( _autoHide ), b1Pressed( false ), b2Pressed( false ), managedWin( 0 ) { LSize ls; int l = SB_WIDTH * 2;// + 2;// + 5; int h = SB_WIDTH;// + 2; if ( vertical ) { ls.Set( cpoint( h, l ) ); ls.y.maximal = 16000; } else { ls.Set( cpoint( l, h ) ); ls.x.maximal = 16000; } SetLSize( ls ); SetScrollInfo( 0 ); // crect r = ClientRect(); // EventSize(&cevent_size(cpoint(r.Width(),r.Height()))); }
cpoint GC::GetTextExtents(const unicode_t *s, int charCount) { if (!s) return cpoint(0,0); SIZE size; carray<wchar_t> p = GetWCT(s, charCount, &charCount); ::GetTextExtentPoint32W(handle, p.ptr(), charCount, &size); return cpoint(size.cx, size.cy); }
void LItemWin::GetLSize( LSize* ls ) { if ( w->IsVisible() ) { w->GetLSize( ls ); } else { ls->Set( cpoint( 0, 0 ) ); } }
inline bbox transformation::operator() (const bbox& b) const { const transformation& t = *this; bbox ret (t (cpoint (b.pmin.x, b.pmin.y, b.pmin.z))); ret = punion (ret, t (cpoint (b.pmax.x, b.pmin.y, b.pmin.z))); ret = punion (ret, t (cpoint (b.pmin.x, b.pmax.y, b.pmin.z))); ret = punion (ret, t (cpoint (b.pmin.x, b.pmin.y, b.pmax.z))); ret = punion (ret, t (cpoint (b.pmax.x, b.pmax.y, b.pmin.z))); ret = punion (ret, t (cpoint (b.pmin.x, b.pmax.y, b.pmax.z))); ret = punion (ret, t (cpoint (b.pmax.x, b.pmin.y, b.pmax.z))); ret = punion (ret, t (cpoint (b.pmax.x, b.pmax.y, b.pmax.z))); return ret; }
ToolBar::Node* ToolBar::GetNodeByPos( int x, int y ) { for ( size_t i = 0; i < _list.size(); i++ ) { Node* p = _list[i].ptr(); if ( p && p->rect.In( cpoint( x, y ) ) ) { return p; } } return 0; }
static FitVector ComputeCenterTangent(const QList<QPointF> &points, int center) { FitVector V1, V2, tHatCenter; FitVector cpointb(points.at(center - 1)); FitVector cpoint(points.at(center)); FitVector cpointa(points.at(center + 1)); V1 = VectorSub(cpointb, cpoint); V2 = VectorSub(cpoint, cpointa); tHatCenter.m_X = ((V1.m_X + V2.m_X) / 2.0); tHatCenter.m_Y = ((V1.m_Y + V2.m_Y) / 2.0); tHatCenter.normalize(); return tHatCenter; }
void LItemRect::GetLSize( LSize* ls ) { static LSize l( cpoint( 0, 0 ) ); *ls = l; }
bool CollisionPolygonEditor::forward_spatial_input_event(Camera* p_camera,const InputEvent& p_event) { if (!node) return false; Transform gt = node->get_global_transform(); Transform gi = gt.affine_inverse(); float depth = node->get_depth()*0.5; Vector3 n = gt.basis.get_axis(2).normalized(); Plane p(gt.origin+n*depth,n); switch(p_event.type) { case InputEvent::MOUSE_BUTTON: { const InputEventMouseButton &mb=p_event.mouse_button; Vector2 gpoint=Point2(mb.x,mb.y); Vector3 ray_from = p_camera->project_ray_origin(gpoint); Vector3 ray_dir = p_camera->project_ray_normal(gpoint); Vector3 spoint; if (!p.intersects_ray(ray_from,ray_dir,&spoint)) break; spoint = gi.xform(spoint); Vector2 cpoint(spoint.x,spoint.y); cpoint=CanvasItemEditor::get_singleton()->snap_point(cpoint); Vector<Vector2> poly = node->get_polygon(); //first check if a point is to be added (segment split) real_t grab_treshold=EDITOR_DEF("poly_editor/point_grab_radius",8); switch(mode) { case MODE_CREATE: { if (mb.button_index==BUTTON_LEFT && mb.pressed) { if (!wip_active) { wip.clear(); wip.push_back( cpoint ); wip_active=true; edited_point_pos=cpoint; _polygon_draw(); edited_point=1; return true; } else { if (wip.size()>1 && p_camera->unproject_position(gt.xform(Vector3(wip[0].x,wip[0].y,depth))).distance_to(gpoint)<grab_treshold) { //wip closed _wip_close(); return true; } else { wip.push_back( cpoint ); edited_point=wip.size(); _polygon_draw(); return true; //add wip point } } } else if (mb.button_index==BUTTON_RIGHT && mb.pressed && wip_active) { _wip_close(); } } break; case MODE_EDIT: { if (mb.button_index==BUTTON_LEFT) { if (mb.pressed) { if (mb.mod.control) { if (poly.size() < 3) { undo_redo->create_action("Edit Poly"); undo_redo->add_undo_method(node,"set_polygon",poly); poly.push_back(cpoint); undo_redo->add_do_method(node,"set_polygon",poly); undo_redo->add_do_method(this,"_polygon_draw"); undo_redo->add_undo_method(this,"_polygon_draw"); undo_redo->commit_action(); return true; } //search edges int closest_idx=-1; Vector2 closest_pos; real_t closest_dist=1e10; for(int i=0;i<poly.size();i++) { Vector2 points[2] ={ p_camera->unproject_position(gt.xform(Vector3(poly[i].x,poly[i].y,depth))), p_camera->unproject_position(gt.xform(Vector3(poly[(i+1)%poly.size()].x,poly[(i+1)%poly.size()].y,depth))) }; Vector2 cp = Geometry::get_closest_point_to_segment_2d(gpoint,points); if (cp.distance_squared_to(points[0])<CMP_EPSILON2 || cp.distance_squared_to(points[1])<CMP_EPSILON2) continue; //not valid to reuse point real_t d = cp.distance_to(gpoint); if (d<closest_dist && d<grab_treshold) { closest_dist=d; closest_pos=cp; closest_idx=i; } } if (closest_idx>=0) { pre_move_edit=poly; poly.insert(closest_idx+1,cpoint); edited_point=closest_idx+1; edited_point_pos=cpoint; node->set_polygon(poly); _polygon_draw(); return true; } } else { //look for points to move int closest_idx=-1; Vector2 closest_pos; real_t closest_dist=1e10; for(int i=0;i<poly.size();i++) { Vector2 cp = p_camera->unproject_position(gt.xform(Vector3(poly[i].x,poly[i].y,depth))); real_t d = cp.distance_to(gpoint); if (d<closest_dist && d<grab_treshold) { closest_dist=d; closest_pos=cp; closest_idx=i; } } if (closest_idx>=0) { pre_move_edit=poly; edited_point=closest_idx; edited_point_pos=poly[closest_idx]; _polygon_draw(); return true; } } } else { if (edited_point!=-1) { //apply ERR_FAIL_INDEX_V(edited_point,poly.size(),false); poly[edited_point]=edited_point_pos; undo_redo->create_action("Edit Poly"); undo_redo->add_do_method(node,"set_polygon",poly); undo_redo->add_undo_method(node,"set_polygon",pre_move_edit); undo_redo->add_do_method(this,"_polygon_draw"); undo_redo->add_undo_method(this,"_polygon_draw"); undo_redo->commit_action(); edited_point=-1; return true; } } } if (mb.button_index==BUTTON_RIGHT && mb.pressed && edited_point==-1) { int closest_idx=-1; Vector2 closest_pos; real_t closest_dist=1e10; for(int i=0;i<poly.size();i++) { Vector2 cp = p_camera->unproject_position(gt.xform(Vector3(poly[i].x,poly[i].y,depth))); real_t d = cp.distance_to(gpoint); if (d<closest_dist && d<grab_treshold) { closest_dist=d; closest_pos=cp; closest_idx=i; } } if (closest_idx>=0) { undo_redo->create_action("Edit Poly (Remove Point)"); undo_redo->add_undo_method(node,"set_polygon",poly); poly.remove(closest_idx); undo_redo->add_do_method(node,"set_polygon",poly); undo_redo->add_do_method(this,"_polygon_draw"); undo_redo->add_undo_method(this,"_polygon_draw"); undo_redo->commit_action(); return true; } } } break; } } break; case InputEvent::MOUSE_MOTION: { const InputEventMouseMotion &mm=p_event.mouse_motion; if (edited_point!=-1 && (wip_active || mm.button_mask&BUTTON_MASK_LEFT)) { Vector2 gpoint = Point2(mm.x,mm.y); Vector3 ray_from = p_camera->project_ray_origin(gpoint); Vector3 ray_dir = p_camera->project_ray_normal(gpoint); Vector3 spoint; if (!p.intersects_ray(ray_from,ray_dir,&spoint)) break; spoint = gi.xform(spoint); Vector2 cpoint(spoint.x,spoint.y); cpoint=CanvasItemEditor::get_singleton()->snap_point(cpoint); edited_point_pos = cpoint; _polygon_draw(); } } break; } return false; }
clSelectDriveDlgMenu::clSelectDriveDlgMenu( Win* parent, clMenuData* data ) : Win( Win::WT_CHILD, Win::WH_TABFOCUS | Win::WH_CLICKFOCUS, parent ) , _data( data ) , _current( 0 ) , _itemH( 16 ) , _width( 50 ) , _nameW( 10 ) , _comment1W( 0 ) , _comment2W( 0 ) , _splitterH( 5 ) , _splitterW( 1 ) { wal::GC gc( this ); gc.Set( GetFont() ); int w = 0; int height = 0; static unicode_t A[] = {'A', 'B', 'C'}; cpoint p = gc.GetTextExtents( A, 3 ); _itemH = p.y; if ( _itemH < 16 ) { _itemH = 16; } _splitterH = _itemH / 4; if ( _splitterH < 3 ) { _splitterH = 3; } for ( int i = 0 ; i < _data->Count(); i++ ) { unicode_t* name = _data->list[i].name.data(); if ( _data->list[i].cmd != 0 ) { if ( name ) { cpoint p = gc.GetTextExtents( name ); if ( _nameW < p.x ) { _nameW = p.x; } } unicode_t* comment1 = _data->list[i].comment1.data(); unicode_t* comment2 = _data->list[i].comment2.data(); if ( comment1 ) { cpoint p = gc.GetTextExtents( comment1 ); if ( _comment1W < p.x ) { _comment1W = p.x; } } if ( comment2 ) { cpoint p = gc.GetTextExtents( comment2 ); if ( _comment2W < p.x ) { _comment2W = p.x; } } height += _itemH; } else { height += _splitterH; } } w = 16 + 5 + _nameW + 5 + _comment1W + 30 + _comment2W; if ( _width < w ) { _width = w; } SetLSize( LSize( cpoint( _width, height ) ) ); }
void BulletSpaceFilter::buildInteractions(double time) { if (! _dynamicCollisionsObjectsInserted) { DynamicalSystemsGraph& dsg = *(_model->nonSmoothDynamicalSystem()->dynamicalSystems()); DynamicalSystemsGraph::VIterator dsi, dsiend; std11::tie(dsi, dsiend) = dsg.vertices(); for (; dsi != dsiend; ++dsi) { CollisionObjects& collisionObjects = *ask<ForCollisionObjects>(*dsg.bundle(*dsi)); for (CollisionObjects::iterator ico = collisionObjects.begin(); ico != collisionObjects.end(); ++ico) { _collisionWorld->addCollisionObject(const_cast<btCollisionObject*>((*ico).first)); DEBUG_PRINTF("add dynamic collision object %p\n", const_cast<btCollisionObject*>((*ico).first)); } } _dynamicCollisionsObjectsInserted = true; } if (! _staticCollisionsObjectsInserted) { for(StaticObjects::iterator ic = _staticObjects->begin(); ic != _staticObjects->end(); ++ic) { _collisionWorld->addCollisionObject(const_cast<btCollisionObject*>((*ic).first)); DEBUG_PRINTF("add static collision object %p\n", const_cast<btCollisionObject*>((*ic).first)); } _staticCollisionsObjectsInserted = true; } DEBUG_PRINT("-----start build interaction\n"); // 1. perform bullet collision detection gOrphanedInteractions.clear(); _collisionWorld->performDiscreteCollisionDetection(); // 2. collect old contact points from Siconos graph std::map<btManifoldPoint*, bool> contactPoints; std::map<Interaction*, bool> activeInteractions; SP::InteractionsGraph indexSet0 = model()->nonSmoothDynamicalSystem()->topology()->indexSet(0); InteractionsGraph::VIterator ui0, ui0end, v0next; std11::tie(ui0, ui0end) = indexSet0->vertices(); for (v0next = ui0 ; ui0 != ui0end; ui0 = v0next) { ++v0next; // trick to iterate on a dynamic bgl graph SP::Interaction inter0 = indexSet0->bundle(*ui0); if (gOrphanedInteractions.find(&*inter0) != gOrphanedInteractions.end()) { model()->nonSmoothDynamicalSystem()->removeInteraction(inter0); } else { SP::btManifoldPoint cp = ask<ForContactPoint>(*(inter0->relation())); if(cp) { DEBUG_PRINTF("Contact point in interaction : %p\n", &*cp); contactPoints[&*cp] = false; } } } unsigned int numManifolds = _collisionWorld->getDispatcher()->getNumManifolds(); DEBUG_PRINTF("number of manifolds : %d\n", numManifolds); for (unsigned int i = 0; i < numManifolds; ++i) { btPersistentManifold* contactManifold = _collisionWorld->getDispatcher()->getManifoldByIndexInternal(i); DEBUG_PRINTF("processing manifold %d : %p\n", i, contactManifold); const btCollisionObject* obA = contactManifold->getBody0(); const btCollisionObject* obB = contactManifold->getBody1(); DEBUG_PRINTF("object A : %p, object B: %p\n", obA, obB); // contactManifold->refreshContactPoints(obA->getWorldTransform(),obB->getWorldTransform()); unsigned int numContacts = contactManifold->getNumContacts(); if ( (obA->getUserPointer() && obA->getUserPointer() != obB->getUserPointer()) || (obB->getUserPointer() && obA->getUserPointer() != obB->getUserPointer()) ) { for (unsigned int z = 0; z < numContacts; ++z) { SP::btManifoldPoint cpoint(createSPtrbtManifoldPoint(contactManifold->getContactPoint(z))); DEBUG_PRINTF("manifold %d, contact %d, &contact %p, lifetime %d\n", i, z, &*cpoint, cpoint->getLifeTime()); // should no be mixed with something else that use UserPointer! SP::BulletDS dsa; SP::BulletDS dsb; unsigned long int gid1, gid2; if(obA->getUserPointer()) { dsa = static_cast<BulletDS*>(obA->getUserPointer())->shared_ptr(); assert(dsa->collisionObjects()->find(contactManifold->getBody0()) != dsa->collisionObjects()->end()); gid1 = boost::get<2>((*((*dsa->collisionObjects()).find(obA))).second); } else { gid1 = (*_staticObjects->find(obA)).second.second; } SP::NonSmoothLaw nslaw; if (obB->getUserPointer()) { dsb = static_cast<BulletDS*>(obB->getUserPointer())->shared_ptr(); assert(dsb->collisionObjects()->find(obB) != dsb->collisionObjects()->end()); gid2 = boost::get<2>((*((*dsb->collisionObjects()).find(obB))).second); } else { gid2 = (*_staticObjects->find(obB)).second.second; } DEBUG_PRINTF("collision between group %ld and %ld\n", gid1, gid2); nslaw = (*_nslaws)(gid1, gid2); if (!nslaw) { RuntimeException::selfThrow( (boost::format("Cannot find nslaw for collision between group %1% and %2%") % gid1 % gid2).str()); } assert(nslaw); std::map<btManifoldPoint*, bool>::iterator itc; itc = contactPoints.find(&*cpoint); DEBUG_EXPR(if (itc == contactPoints.end()) { DEBUG_PRINT("contact point not found\n"); for(std::map<btManifoldPoint*, bool>::iterator itd=contactPoints.begin(); itd != contactPoints.end(); ++itd) { DEBUG_PRINTF("-->%p != %p\n", &*cpoint, &*(*itd).first); } }); if (itc == contactPoints.end() || !cpoint->m_userPersistentData) { /* new interaction */ SP::Interaction inter; if (nslaw->size() == 3) { SP::BulletR rel(new BulletR(cpoint, createSPtrbtPersistentManifold(*contactManifold))); inter.reset(new Interaction(3, nslaw, rel, 4 * i + z)); } else { if (nslaw->size() == 1) { SP::BulletFrom1DLocalFrameR rel(new BulletFrom1DLocalFrameR(cpoint)); inter.reset(new Interaction(1, nslaw, rel, 4 * i + z)); } } if (obB->getUserPointer()) { SP::BulletDS dsb(static_cast<BulletDS*>(obB->getUserPointer())->shared_ptr()); if (dsa != dsb) { DEBUG_PRINTF("LINK obA:%p obB:%p inter:%p\n", obA, obB, &*inter); assert(inter); cpoint->m_userPersistentData = &*inter; link(inter, dsa, dsb); } /* else collision shapes belong to the same object do nothing */ } else { DEBUG_PRINTF("LINK obA:%p inter :%p\n", obA, &*inter); assert(inter); cpoint->m_userPersistentData = &*inter; link(inter, dsa); } } if (cpoint->m_userPersistentData) { activeInteractions[static_cast<Interaction *>(cpoint->m_userPersistentData)] = true; DEBUG_PRINTF("Interaction %p = true\n", static_cast<Interaction *>(cpoint->m_userPersistentData)); DEBUG_PRINTF("cpoint %p = true\n", &*cpoint); } else { assert(false); DEBUG_PRINT("cpoint->m_userPersistentData is empty\n"); } contactPoints[&*cpoint] = true; DEBUG_PRINTF("cpoint %p = true\n", &*cpoint); } } }
bool Polygon3DEditor::forward_spatial_gui_input(Camera *p_camera, const Ref<InputEvent> &p_event) { if (!node) return false; Transform gt = node->get_global_transform(); Transform gi = gt.affine_inverse(); float depth = _get_depth() * 0.5; Vector3 n = gt.basis.get_axis(2).normalized(); Plane p(gt.origin + n * depth, n); Ref<InputEventMouseButton> mb = p_event; if (mb.is_valid()) { Vector2 gpoint = mb->get_position(); Vector3 ray_from = p_camera->project_ray_origin(gpoint); Vector3 ray_dir = p_camera->project_ray_normal(gpoint); Vector3 spoint; if (!p.intersects_ray(ray_from, ray_dir, &spoint)) return false; spoint = gi.xform(spoint); Vector2 cpoint(spoint.x, spoint.y); //DO NOT snap here, it's confusing in 3D for adding points. //Let the snap happen when the point is being moved, instead. //cpoint = CanvasItemEditor::get_singleton()->snap_point(cpoint); Vector<Vector2> poly = node->call("get_polygon"); //first check if a point is to be added (segment split) real_t grab_threshold = EDITOR_DEF("editors/poly_editor/point_grab_radius", 8); switch (mode) { case MODE_CREATE: { if (mb->get_button_index() == BUTTON_LEFT && mb->is_pressed()) { if (!wip_active) { wip.clear(); wip.push_back(cpoint); wip_active = true; edited_point_pos = cpoint; snap_ignore = false; _polygon_draw(); edited_point = 1; return true; } else { if (wip.size() > 1 && p_camera->unproject_position(gt.xform(Vector3(wip[0].x, wip[0].y, depth))).distance_to(gpoint) < grab_threshold) { //wip closed _wip_close(); return true; } else { wip.push_back(cpoint); edited_point = wip.size(); snap_ignore = false; _polygon_draw(); return true; } } } else if (mb->get_button_index() == BUTTON_RIGHT && mb->is_pressed() && wip_active) { _wip_close(); } } break; case MODE_EDIT: { if (mb->get_button_index() == BUTTON_LEFT) { if (mb->is_pressed()) { if (mb->get_control()) { if (poly.size() < 3) { undo_redo->create_action(TTR("Edit Poly")); undo_redo->add_undo_method(node, "set_polygon", poly); poly.push_back(cpoint); undo_redo->add_do_method(node, "set_polygon", poly); undo_redo->add_do_method(this, "_polygon_draw"); undo_redo->add_undo_method(this, "_polygon_draw"); undo_redo->commit_action(); return true; } //search edges int closest_idx = -1; Vector2 closest_pos; real_t closest_dist = 1e10; for (int i = 0; i < poly.size(); i++) { Vector2 points[2] = { p_camera->unproject_position(gt.xform(Vector3(poly[i].x, poly[i].y, depth))), p_camera->unproject_position(gt.xform(Vector3(poly[(i + 1) % poly.size()].x, poly[(i + 1) % poly.size()].y, depth))) }; Vector2 cp = Geometry::get_closest_point_to_segment_2d(gpoint, points); if (cp.distance_squared_to(points[0]) < CMP_EPSILON2 || cp.distance_squared_to(points[1]) < CMP_EPSILON2) continue; //not valid to reuse point real_t d = cp.distance_to(gpoint); if (d < closest_dist && d < grab_threshold) { closest_dist = d; closest_pos = cp; closest_idx = i; } } if (closest_idx >= 0) { pre_move_edit = poly; poly.insert(closest_idx + 1, cpoint); edited_point = closest_idx + 1; edited_point_pos = cpoint; node->call("set_polygon", poly); _polygon_draw(); snap_ignore = true; return true; } } else { //look for points to move int closest_idx = -1; Vector2 closest_pos; real_t closest_dist = 1e10; for (int i = 0; i < poly.size(); i++) { Vector2 cp = p_camera->unproject_position(gt.xform(Vector3(poly[i].x, poly[i].y, depth))); real_t d = cp.distance_to(gpoint); if (d < closest_dist && d < grab_threshold) { closest_dist = d; closest_pos = cp; closest_idx = i; } } if (closest_idx >= 0) { pre_move_edit = poly; edited_point = closest_idx; edited_point_pos = poly[closest_idx]; _polygon_draw(); snap_ignore = false; return true; } } } else { snap_ignore = false; if (edited_point != -1) { //apply ERR_FAIL_INDEX_V(edited_point, poly.size(), false); poly[edited_point] = edited_point_pos; undo_redo->create_action(TTR("Edit Poly")); undo_redo->add_do_method(node, "set_polygon", poly); undo_redo->add_undo_method(node, "set_polygon", pre_move_edit); undo_redo->add_do_method(this, "_polygon_draw"); undo_redo->add_undo_method(this, "_polygon_draw"); undo_redo->commit_action(); edited_point = -1; return true; } } } if (mb->get_button_index() == BUTTON_RIGHT && mb->is_pressed() && edited_point == -1) { int closest_idx = -1; Vector2 closest_pos; real_t closest_dist = 1e10; for (int i = 0; i < poly.size(); i++) { Vector2 cp = p_camera->unproject_position(gt.xform(Vector3(poly[i].x, poly[i].y, depth))); real_t d = cp.distance_to(gpoint); if (d < closest_dist && d < grab_threshold) { closest_dist = d; closest_pos = cp; closest_idx = i; } } if (closest_idx >= 0) { undo_redo->create_action(TTR("Edit Poly (Remove Point)")); undo_redo->add_undo_method(node, "set_polygon", poly); poly.remove(closest_idx); undo_redo->add_do_method(node, "set_polygon", poly); undo_redo->add_do_method(this, "_polygon_draw"); undo_redo->add_undo_method(this, "_polygon_draw"); undo_redo->commit_action(); return true; } } } break; } } Ref<InputEventMouseMotion> mm = p_event; if (mm.is_valid()) { if (edited_point != -1 && (wip_active || mm->get_button_mask() & BUTTON_MASK_LEFT)) { Vector2 gpoint = mm->get_position(); Vector3 ray_from = p_camera->project_ray_origin(gpoint); Vector3 ray_dir = p_camera->project_ray_normal(gpoint); Vector3 spoint; if (!p.intersects_ray(ray_from, ray_dir, &spoint)) return false; spoint = gi.xform(spoint); Vector2 cpoint(spoint.x, spoint.y); if (snap_ignore && !Input::get_singleton()->is_key_pressed(KEY_CONTROL)) { snap_ignore = false; } if (!snap_ignore) { cpoint = CanvasItemEditor::get_singleton()->snap_point(cpoint); } edited_point_pos = cpoint; _polygon_draw(); } } return false; }
void main() { float a, b, c, d, e, g, h, i, j; int x, y; int xmax, ymax; int k; float l, m, n, o, p; cclg(1); // Blue background #ifdef ALTLOWGFX xmax = 64; ymax = 24; #else xmax = 32; ymax = 48; #endif a = -2.0; b = 2.0; c = a; d = b; //a=-0.765; b=-0.7651; //c=-0.095; d=-0.0951; e = 4.0; g = (b - a) / (float)xmax; h = (d - c) / (float)ymax; for (y = ymax / 2; y >= 0; y--) { j = (float)y * h + c; for (x = xmax; x >= 0; x--) { i = (float)x * g + a; k = 0; l = 0.0; m = 0.0; n = 0.0; o = 0.0; l110: k++; if (k < 50) //Iterates { p = n - o + i; m = 2.0 * l * m + j; l = p; n = l * l; o = m * m; if ((n + o) < e) goto l110; cplot(x, y, k & 7); cplot(x, ymax - y, k & 7); } ccopybuffer(); } ccopybuffer(); } if (ula_plus_mode()) { // color cycling - ulaplus mode for (k = 0; k < 240; k++) { ula_sync(); for (x = 0; x < 8; x++) { ulaplus_set(x, x + k); ulaplus_set(x + 8, x + k); } for (y = 0; y < 1600; y++) { } } } else { // color cycling - standard mode for (k = 100; k >= 0; k--) { for (y = ymax; y >= 0; y--) { for (x = xmax; x >= 0; x--) cplot(x, y, cpoint(x, y) + 1); } ccopybuffer(); } } ccopybuffer(); }