| 35 | } |
| 36 | |
| 37 | int main(){ |
| 38 | CreateFramebufferSurface(fbSurface); |
| 39 | renderSurface = fbSurface; |
| 40 | renderSurface.buffer = new uint8_t[fbSurface.width * fbSurface.height * 4]; |
| 41 | |
| 42 | Lemon::Graphics::DrawRect(0, 0, renderSurface.width, renderSurface.height, 128, 0, 0, &fbSurface); |
| 43 | |
| 44 | handle_t svc = Lemon::CreateService("lemon.lemonwm"); |
| 45 | inst = new WMInstance(renderSurface, svc, "Instance"); |
| 46 | WMInstance& wm = *inst; |
| 47 | |
| 48 | Lemon::Graphics::DrawRect(0, 0, renderSurface.width, renderSurface.height, 255, 0, 0, &fbSurface); |
| 49 | |
| 50 | Lemon::JSONParser configParser("/system/lemon/lemonwm.json"); |
| 51 | auto json = configParser.Parse(); |
| 52 | if(json.IsObject()){ |
| 53 | std::map<Lemon::JSONKey, Lemon::JSONValue>& values = *json.object; |
| 54 | |
| 55 | if(auto it = values.find("useBackgroundImage"); it != values.end()){ |
| 56 | auto& v = it->second; |
| 57 | |
| 58 | if(v.IsBool()){ |
| 59 | wm.compositor.useImage = v.AsBool(); |
| 60 | } else {} // TODO: Do something when invalid valaue |
| 61 | } |
| 62 | |
| 63 | if(auto it = values.find("backgroundImage"); it != values.end()){ |
| 64 | auto& v = it->second; |
| 65 | |
| 66 | if(v.IsString()){ |
| 67 | bgPath = v.AsString(); |
| 68 | } else {} // TODO: Do something when invalid valaue |
| 69 | } |
| 70 | |
| 71 | if(auto it = values.find("displayFramerate"); it != values.end()){ |
| 72 | auto& v = it->second; |
| 73 | |
| 74 | if(v.IsBool()){ |
| 75 | wm.compositor.displayFramerate = v.AsBool(); |
| 76 | } else {} // TODO: Do something when invalid valaue |
| 77 | } |
| 78 | |
| 79 | if(auto it = values.find("capFramerate"); it != values.end()){ |
| 80 | auto& v = it->second; |
| 81 | |
| 82 | if(v.IsBool()){ |
| 83 | wm.compositor.capFramerate = v.AsBool(); |
| 84 | } else {} // TODO: Do something when invalid valaue |
| 85 | } |
| 86 | |
| 87 | if(auto it = values.find("theme"); it != values.end()){ |
| 88 | auto& v = it->second; |
| 89 | |
| 90 | if(v.IsString()){ |
| 91 | wm.themePath = v.AsString(); |
| 92 | } else {} // TODO: Do something when invalid valaue |
| 93 | } |
| 94 | } else { |
nothing calls this directly
no test coverage detected