-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgp.cpp
More file actions
69 lines (55 loc) · 2.49 KB
/
gp.cpp
File metadata and controls
69 lines (55 loc) · 2.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#include <iostream>
#include <SDL2/SDL.h>
using namespace std;
bool initSDL() {
if (SDL_Init(SDL_INIT_VIDEO) != 0) {
cout << "SDL initialization failed: " << SDL_GetError() << endl;
return false;
}
return true;
}
SDL_Window* createWindow(const string& title, int width, int height) {
return SDL_CreateWindow(title.c_str(), SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, width, height, SDL_WINDOW_SHOWN);
}
int main() {
const int SCREEN_WIDTH = 800;
const int SCREEN_HEIGHT = 600;
// **Welcome Message**
cout << "**We've just completed a remarkable feat - our very own mini OS crafted in Linux using C++! It's been an exhilarating journey of coding, debugging, and countless late-night sessions. I, Mujtaba (Roll No. 22F3403), and my talented teammate Waleed Ahmed (Roll No. 22F8778), proudly represent the Meow Meow Team. From the get-go, we introduced ourselves, setting the stage for a project fueled by dedication and collaboration. Our journey began with laying the groundwork, meticulously crafting the backbone of the OS - process management, memory allocation, and file systems. With each line of code, we breathed life into our creation, gradually expanding its horizons. User interfaces, networking capabilities, and device drivers soon followed suit, each addition a testament to our unwavering commitment and shared vision. As we stand back and admire our creation, we're filled with pride, knowing that every function, every feature bears the mark of our hard work and determination.**" << endl;
if (!initSDL()) {
return 1;
}
SDL_Window* window = createWindow("Mini OS", SCREEN_WIDTH, SCREEN_HEIGHT);
if (!window) {
cout << "Window creation failed: " << SDL_GetError() << endl;
SDL_Quit();
return 1;
}
SDL_Renderer* renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);
if (!renderer) {
cout << "Renderer creation failed: " << SDL_GetError() << endl;
SDL_DestroyWindow(window);
SDL_Quit();
return 1;
}
bool quit = false;
SDL_Event e;
while (!quit) {
while (SDL_PollEvent(&e) != 0) {
if (e.type == SDL_QUIT) {
quit = true;
}
}
// Clear the screen
SDL_SetRenderDrawColor(renderer, 255, 255, 255, 255);
SDL_RenderClear(renderer);
// **Draw Menu and Graphics Here**
// (Functionality for menus and graphics would be implemented here)
// Update the screen
SDL_RenderPresent(renderer);
}
SDL_DestroyRenderer(renderer);
SDL_DestroyWindow(window);
SDL_Quit();
return 0;
}