Crop from above showing Ocelli (3 eyes almost all bugs have) From Wiki: Ocelli refers to a type of eye design or optical arrangement that contains a single lens which detects light. A "simple eye" is so-called in distinction from a multi-lensed "compound eye", and is not necessarily at all simple in the usual sense of the word. The eyes of humans and large animals, and camera lenses are classed as "simple" because in both cases a single lens collects and focuses light onto the retina or film. Many insects have compound eyes consisting of multiple lenses (up to tens of thousands), each focusing light onto a small number of retinula cells.
The Ocelli or "simple eye" basically just detect light and movement. This is why a bug takes off when you go to swat it.