From c5d20798f5d0ebb31eed17dc6f49911161f9ea12 Mon Sep 17 00:00:00 2001 From: Natsirt867 Date: Sat, 1 Mar 2025 17:21:14 -0600 Subject: [PATCH] Updating changes up to Draw Pixel Function --- renderer | Bin 17376 -> 17440 bytes src/.display.c.swp | Bin 0 -> 12288 bytes src/.display.h.swp | Bin 0 -> 12288 bytes src/.main.c.swp | Bin 0 -> 12288 bytes src/display.c | 100 +++++++++++++++++++++ src/display.h | 24 +++++ src/main.c | 102 +-------------------- ycm_extra_conf.py | 220 --------------------------------------------- 8 files changed, 127 insertions(+), 319 deletions(-) create mode 100644 src/.display.c.swp create mode 100644 src/.display.h.swp create mode 100644 src/.main.c.swp create mode 100644 src/display.c create mode 100644 src/display.h delete mode 100644 ycm_extra_conf.py diff --git a/renderer b/renderer index eacda0739bd97169069a0f19acc0de80a0db1338..6492c51789d0b297a2a530536e82a3784d064398 100755 GIT binary patch delta 2086 zcmZuwe{54l9KS1jUE6hToo(M5wWsG7~5Qdy7PPYZh${7dH4B#zn|~V zyL(+*aZ4R;@ZuHkjJsgoZ9;tQCN`XJ?lI_EPc)26u(@8>P(69iaKYZT=DV5p)^JY2 zvI9@rDoU@P9sg)JT0dgH0WXaPjT@|Zd-QNdH8v&k5K=X1fK0Xf@DcKyJ=3&DH|-*C zgQ=2yVSjLDQ+t;o(ynR_pU(LK+E_g`ax&JLpj6d-**cX1aF9`lhWTFNaE>wkkc*He z?aU>`PLJ(1P^N_v8^78TiepWBDVNkZ{iapir6`v~o#9YqQzB9mk1Xleq@Tud?@fi8 zbdHPhO=F;!L69}69rm=np?IWS3nlQEYLg1Rs`!`|>W>&muQSWEpZmQ!jwo_=Z7ENX z*mxQ$TQq4tSK}L78yc1!?@PP?<`OmXE1X9;*x78WZ?V~=xkBx@$yJ|F*MJ&pg6*zg zO&atu&a6mo%zCW04wQ8GI<8WB7|_~F=_SCCfC<34*D2iz=u$f9wswBESZ~#Rg;dsyAIZ&j?@R&^V}vQ?+ljk&bml`E|hI?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O@Ae&uY-P=IVTiH+A$kKW=mS;8>!60(4WG&%^Ryn|MAoZeOLUDMH1{laI&{Y^dRF&z0a7WhOgPxpz6JZm=X^OJeCrS z$*;_5RViUqQCYz1VF|^`qE#*$6bzls4pgbM&X_;P`m5AMO>k5|^2t)S*~d6-OgBjW z8P()lOdyZqFU3c^goGp^VG|2ZSDhSHPEtfPsoI!RDW&_FKT}xx8qZfU-{mpmkO|~l;XXJhsw`e&8>OXsM^+WfRg61_=3xFAs<#N=tJv)qa<|5} z1J%!#K&=$2#YyVrin1lC7Pa(gV{A0WSH;*65gxGHnISV1AFlCK;f%y8odsq*N%C*W z)o)90Yb3u-^5>8PGPAEEQykn6Dw|UKIlErFFg|Byla(bbO1yLKKn6X^-U(IONAIVe zb%(amRu&Fd7F_a~+Z@F~8hlJlj@lG9wx6^nw~YnPY}UEIhyT EZ;9y{>Hq)$ diff --git a/src/.display.c.swp b/src/.display.c.swp new file mode 100644 index 0000000000000000000000000000000000000000..a1daa1a302637a4c3783ef925947cc58072c69e8 GIT binary patch literal 12288 zcmeI2O>7%Q6vw9^K3piE5xu9;nv zxF{5H0&zl!dk>r_EfSSDAaOwSTs}^mB6=)Hh@Pk_4*X|lcKwkiqEI9v&8okycjxV! z_x|(dIcaw_cW(AHJ)RvSIG!Wq?#JJ*-56LWAMOwmaK{f!SB&g?D7%rxs^iwqnAXVo zvHZvkb4QMKKlZjV9L-ytxfbJ$kNUhaYB_$RZnm0x=-ezXEw0j+>mKr5gX&zzQgVIWP^1fPkGNgj@xmf%gFe7B~gcAPExS z_ov|#`~bcJ*TH4r0t1`}W$+?+6#VuSAzy=Q;1f^<6|f4u?i&79OL|D;=LZ z@Bd%yw-FTBCKN|`YR)*@bb?g65MNI*Kj2<#*>NpzGqo9>F#Ny|ME;e(1@(eiDtgmQ zO=)w+QWfvN_Fwn7vD&n4#xd`ko?}r<=4r?bQ{rCwtw@+{lE5F4Ld9!8`kImh&saf~ z4$)Sc4%02VLMLc$YkGPtpU)r57f8bPI88ZjfH8~|a5_QdJn~U-XLy2+PTj!jd&A=1G?%o&F*!$7$0*&EIl ztII4iR3zKV&?e6LqedXTcj_t9#35DPH^g-zYON#0wwyJ@-73%;J%KZhWuDET!)tJBsi-CJvoR}LTj0ooMXS#9-vh2o7LV$vOBGP3Z$J`rOr%l zbc&qXYhgqOkXv)oYqa9cndz!~BVb!Wld}vhEzQlzzt#4|DcmMP!*uWV@STgyv*Wqb z>D^l@BX5O%caO#s6Hz-N)}@AJ25eErlakdaJ4$!H-P@TngzwUTH(7y%zG8=E7RXjN z-K^LB3c8W2(#V7pF3*;x=9i6WBwn6eC>Bd9@ofOVK+F0uv313w`qBX zCX1Y-7r?C;*TeJc->m5O+l?J3@4gDi&!^3I|Ls6ytG#BV!qwQ*K5_ zskEYII8E%Ko$vNP3s`op-iYPhw2D{Mfe2K|^~(IhRB>UhST2)6z3 z?Y_rkQ&o}(bA|+kq9iIkOM(wy%>4v$LmEDS(uB95HOc1TMw?2ht;@G219oGpQv+i6}rP{OPBJf$5 zq{0uS*+rvxuDI~(;;GrvOqvehn@&{2s^``5b)Y=4uJ2b26WLzH4;O|k326UPE?4Lr zhy))O_lcNJ?f9Yl_9b`_HBlf@m+Ll*hoS4qy6@4N>utK!^r_9w4Mye91&En?P?u9= zQ1dgi;UQF9VhK!Gb8fb%XLki4V~e)s5RLa-6p#pAR^(8-SY@nu<=1g5^`^yWQdLQ| Hnk0V#2>V}S literal 0 HcmV?d00001 diff --git a/src/.display.h.swp b/src/.display.h.swp new file mode 100644 index 0000000000000000000000000000000000000000..20ea05f696f86e49af33b34feb267e436c1f75f5 GIT binary patch literal 12288 zcmeI2&ubGw6vwCDtD*-5FH>`gp_?>`2PH))6tqyG+G_Q*Zgys~qswlXoi&LE`!{&d zgZfwaFG%s|O+m$ro;~;nh;M%+WYZ!9dI^3PzIoaA-n@D9+2j!Nx@-5hZu9H)CZp>t zV_#mr?;Wl@W-q=oX0(cp6Q+@WUPYd@=d19^jw7rG&9-$@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ak literal 0 HcmV?d00001 diff --git a/src/display.c b/src/display.c new file mode 100644 index 0000000..ce1d8dd --- /dev/null +++ b/src/display.c @@ -0,0 +1,100 @@ +#include "display.h" + + +SDL_Window* window = NULL; +SDL_Renderer* renderer = NULL; + +// Also known as frame buffer in other books, pointer to an array of color_buffer +uint32_t* color_buffer = NULL; +SDL_Texture* color_buffer_texture = NULL; + +int window_width = 800; +int window_height = 600; + +bool initialize_window(void) { + if (SDL_Init(SDL_INIT_EVERYTHING) != 0) { + fprintf(stderr, "Error initializing SDL.\n"); + return false; + + } + + // Use SDL to query what is the fullscreen max. width and height + SDL_DisplayMode display_mode; + SDL_GetCurrentDisplayMode(0, &display_mode); + + window_width = display_mode.w; + window_height = display_mode.h; + + // Create a SDL window + window = SDL_CreateWindow( + NULL, + SDL_WINDOWPOS_CENTERED, + SDL_WINDOWPOS_CENTERED, + window_width, + window_height, + SDL_WINDOW_BORDERLESS + ); + if (!window) { + fprintf(stderr, "Error creating SDL window.\n"); + return false; + } + + // Create a SDL renderer + renderer = SDL_CreateRenderer(window, -1, 0); + if (!renderer) { + fprintf(stderr, "Error creating SDL error.\n"); + return false; + } + SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN); + + + return true; +} + +void render_color_buffer(void){ + SDL_UpdateTexture( + color_buffer_texture, + NULL, + color_buffer, + (int)(window_width * sizeof(uint32_t)) + ); + SDL_RenderCopy(renderer, color_buffer_texture, NULL, NULL); +} + +void clear_color_buffer(uint32_t color){ + for (int y = 0; y < window_height; y++){ + for (int x = 0; x < window_width; x++){ + color_buffer[(window_width * y) + x] = color; + } + } +} + +void draw_rect(int x, int y, int width, int height, uint32_t color){ + for (int j = x; j <= x + width; j++){ + for (int k = y; k <= y + height; k++){ + color_buffer[(window_width * j) + k] = color; + } + } +} + +void draw_pixel(int x, int y, uint32_t color){ + if (x < window_width && y < window_height){ + color_buffer[(window_width * y) + x] = color; + } +} + +void draw_grid(void){ + for (int y = 0; y < window_height; y += 10){ + for (int x = 0; x < window_width; x += 10){ + color_buffer[(window_width * y) + x ] = 0xFF133343; + } + } +} + +void destroy_window(void){ + free(color_buffer); + SDL_DestroyRenderer(renderer); + SDL_DestroyWindow(window); + SDL_Quit(); +} + diff --git a/src/display.h b/src/display.h new file mode 100644 index 0000000..54c38a8 --- /dev/null +++ b/src/display.h @@ -0,0 +1,24 @@ +#ifndef DISPLAY_H +#define DISPLAY_H + +#include +#include +#include + + +extern SDL_Window* window; +extern SDL_Renderer* renderer; +extern uint32_t* color_buffer; +extern SDL_Texture* color_buffer_texture; +extern int window_width; +extern int window_height; + +bool initialize_window(void); +void draw_pixel(int x, int y, uint32_t color); +void draw_rect(int x, int y, int width, int height, uint32_t color); +void draw_grid(void); +void render_color_buffer(void); +void clear_color_buffer(uint32_t color); +void destroy_window(void); + +#endif diff --git a/src/main.c b/src/main.c index fa83faf..c92925d 100644 --- a/src/main.c +++ b/src/main.c @@ -1,66 +1,10 @@ -#include #include #include #include +#include "display.h" bool is_running = false; -SDL_Window* window = NULL; -SDL_Renderer* renderer = NULL; - -// Also known as frame buffer in other books, pointer to an array of color_buffer -uint32_t* color_buffer = NULL; -SDL_Texture* color_buffer_texture = NULL; - -int window_width = 800; -int window_height = 600; - -bool initialize_window(void) { - if (SDL_Init(SDL_INIT_EVERYTHING) != 0) { - fprintf(stderr, "Error initializing SDL.\n"); - return false; - - } - - // Use SDL to query what is the fullscreen max. width and height - SDL_DisplayMode display_mode; - SDL_GetCurrentDisplayMode(0, &display_mode); - - window_width = display_mode.w; - window_height = display_mode.h; - - // Create a SDL window - window = SDL_CreateWindow( - NULL, - SDL_WINDOWPOS_CENTERED, - SDL_WINDOWPOS_CENTERED, - window_width, - window_height, - SDL_WINDOW_BORDERLESS - ); - if (!window) { - fprintf(stderr, "Error creating SDL window.\n"); - return false; - } - - // Create a SDL renderer - renderer = SDL_CreateRenderer(window, -1, 0); - if (!renderer) { - fprintf(stderr, "Error creating SDL error.\n"); - return false; - } - SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN); - - - return true; -} - - - - -// SDL_RenderDrawLine(&render_grid, 100, 100, 300, 300); - - void setup(void){ // Allocates the memory in bytes required to hold for color_buffer, using sizeof to allocate the # of bytes required color_buffer = (uint32_t*) malloc(sizeof(uint32_t) * window_width * window_height); @@ -93,60 +37,20 @@ void update(void){ //TODO } -void render_color_buffer(void){ - SDL_UpdateTexture( - color_buffer_texture, - NULL, - color_buffer, - (int)(window_width * sizeof(uint32_t)) - ); - SDL_RenderCopy(renderer, color_buffer_texture, NULL, NULL); -} - -void clear_color_buffer(uint32_t color){ - for (int y = 0; y < window_height; y++){ - for (int x = 0; x < window_width; x++){ - color_buffer[(window_width * y) + x] = color; - } - } -} - -void draw_rect(int x, int y, int width, int height, uint32_t color){ - for (int j = x; j <= x + width; j ++){ - for (int k = y; k <= y + height; k ++){ - color_buffer[(window_width * j) + k] = color; - } - } -} - -void draw_grid(void){ - for (int y = 0; y < window_height; y += 10){ - for (int x = 0; x < window_width; x += 10){ - color_buffer[(window_width * y) + x ] = 0xFF133343; - } - } -} void render(void){ SDL_SetRenderDrawColor(renderer, 255, 0, 0, 255); SDL_RenderClear(renderer); draw_grid(); - draw_rect(100, 200, 200, 400, 0xFF998500); + draw_pixel(20, 20, 0xFFFFFF00); + //draw_rect(100, 200, 200, 400, 0xFF998500); render_color_buffer(); clear_color_buffer(0xFF000000); SDL_RenderPresent(renderer); } -void destroy_window(void){ - free(color_buffer); - SDL_DestroyRenderer(renderer); - SDL_DestroyWindow(window); - SDL_Quit(); -} - - int main(void) { is_running = initialize_window(); diff --git a/ycm_extra_conf.py b/ycm_extra_conf.py deleted file mode 100644 index d970148..0000000 --- a/ycm_extra_conf.py +++ /dev/null @@ -1,220 +0,0 @@ -# This file is NOT licensed under the GPLv3, which is the license for the rest -# of YouCompleteMe. -# -# Here's the license text for this file: -# -# This is free and unencumbered software released into the public domain. -# -# Anyone is free to copy, modify, publish, use, compile, sell, or -# distribute this software, either in source code form or as a compiled -# binary, for any purpose, commercial or non-commercial, and by any -# means. -# -# In jurisdictions that recognize copyright laws, the author or authors -# of this software dedicate any and all copyright interest in the -# software to the public domain. We make this dedication for the benefit -# of the public at large and to the detriment of our heirs and -# successors. We intend this dedication to be an overt act of -# relinquishment in perpetuity of all present and future rights to this -# software under copyright law. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR -# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -# OTHER DEALINGS IN THE SOFTWARE. -# -# For more information, please refer to - -from sysconfig import get_path -import platform -import os.path as p -import subprocess - -DIR_OF_THIS_SCRIPT = p.abspath( p.dirname( __file__ ) ) -DIR_OF_THIRD_PARTY = p.join( DIR_OF_THIS_SCRIPT, 'third_party' ) -DIR_OF_WATCHDOG_DEPS = p.join( DIR_OF_THIRD_PARTY, 'watchdog_deps' ) -SOURCE_EXTENSIONS = [ '.cpp', '.cxx', '.cc', '.c', '.m', '.mm' ] - -database = None - -# These are the compilation flags that will be used in case there's no -# compilation database set (by default, one is not set). -# CHANGE THIS LIST OF FLAGS. YES, THIS IS THE DROID YOU HAVE BEEN LOOKING FOR. -flags = [ -'-Wall', -'-Wextra', -'-Werror', -'-Wno-long-long', -'-Wno-variadic-macros', -'-fexceptions', -'-DNDEBUG', -# You 100% do NOT need -DUSE_CLANG_COMPLETER and/or -DYCM_EXPORT in your flags; -# only the YCM source code needs it. -'-DUSE_CLANG_COMPLETER', -'-DYCM_EXPORT=', -'-DYCM_ABSEIL_SUPPORTED', -# THIS IS IMPORTANT! Without the '-x' flag, Clang won't know which language to -# use when compiling headers. So it will guess. Badly. So C++ headers will be -# compiled as C headers. You don't want that so ALWAYS specify the '-x' flag. -# For a C project, you would set this to 'c' instead of 'c++'. -'-x', -'c++', -'-isystem', -'cpp/absl', -'-isystem', -'cpp/pybind11', -'-isystem', -'cpp/whereami', -'-isystem', -'cpp/BoostParts', -'-isystem', -get_path( 'include' ), -'-isystem', -'cpp/llvm/include', -'-isystem', -'cpp/llvm/tools/clang/include', -'-I', -'cpp/ycm', -'-I', -'cpp/ycm/ClangCompleter', -'-isystem', -'cpp/ycm/tests/gmock/googlemock/include', -'-isystem', -'cpp/ycm/tests/gmock/googletest/include', -'-isystem', -'cpp/ycm/benchmarks/benchmark/include', -'-std=c++17', -] - -# Set this to the absolute path to the folder (NOT the file!) containing the -# compile_commands.json file to use that instead of 'flags'. See here for -# more details: http://clang.llvm.org/docs/JSONCompilationDatabase.html -# -# You can get CMake to generate this file for you by adding: -# set( CMAKE_EXPORT_COMPILE_COMMANDS 1 ) -# to your CMakeLists.txt file. -# -# Most projects will NOT need to set this to anything; you can just change the -# 'flags' list of compilation flags. Notice that YCM itself uses that approach. -compilation_database_folder = '' - - -def IsHeaderFile( filename ): - extension = p.splitext( filename )[ 1 ] - return extension in [ '.h', '.hxx', '.hpp', '.hh' ] - - -def FindCorrespondingSourceFile( filename ): - if IsHeaderFile( filename ): - basename = p.splitext( filename )[ 0 ] - for extension in SOURCE_EXTENSIONS: - replacement_file = basename + extension - if p.exists( replacement_file ): - return replacement_file - return filename - - -def PathToPythonUsedDuringBuild(): - try: - filepath = p.join( DIR_OF_THIS_SCRIPT, 'PYTHON_USED_DURING_BUILDING' ) - with open( filepath ) as f: - return f.read().strip() - except OSError: - return None - - -def Settings( **kwargs ): - # Do NOT import ycm_core at module scope. - import ycm_core - - global database - if database is None and p.exists( compilation_database_folder ): - database = ycm_core.CompilationDatabase( compilation_database_folder ) - - language = kwargs[ 'language' ] - - if language == 'cfamily': - # If the file is a header, try to find the corresponding source file and - # retrieve its flags from the compilation database if using one. This is - # necessary since compilation databases don't have entries for header files. - # In addition, use this source file as the translation unit. This makes it - # possible to jump from a declaration in the header file to its definition - # in the corresponding source file. - filename = FindCorrespondingSourceFile( kwargs[ 'filename' ] ) - - if not database: - return { - 'flags': flags, - 'include_paths_relative_to_dir': DIR_OF_THIS_SCRIPT, - 'override_filename': filename - } - - compilation_info = database.GetCompilationInfoForFile( filename ) - if not compilation_info.compiler_flags_: - return {} - - # Bear in mind that compilation_info.compiler_flags_ does NOT return a - # python list, but a "list-like" StringVec object. - final_flags = list( compilation_info.compiler_flags_ ) - - # NOTE: This is just for YouCompleteMe; it's highly likely that your project - # does NOT need to remove the stdlib flag. DO NOT USE THIS IN YOUR - # ycm_extra_conf IF YOU'RE NOT 100% SURE YOU NEED IT. - try: - final_flags.remove( '-stdlib=libc++' ) - except ValueError: - pass - - return { - 'flags': final_flags, - 'include_paths_relative_to_dir': compilation_info.compiler_working_dir_, - 'override_filename': filename - } - - if language == 'python': - return { - 'interpreter_path': PathToPythonUsedDuringBuild(), - 'ls': { - 'python': { - 'analysis': { - 'extraPaths': [ - p.join( DIR_OF_THIS_SCRIPT ), - p.join( DIR_OF_THIRD_PARTY, 'bottle' ), - p.join( DIR_OF_THIRD_PARTY, 'regex-build' ), - p.join( DIR_OF_THIRD_PARTY, 'frozendict' ), - p.join( DIR_OF_THIRD_PARTY, 'jedi_deps', 'jedi' ), - p.join( DIR_OF_THIRD_PARTY, 'jedi_deps', 'parso' ), - p.join( DIR_OF_WATCHDOG_DEPS, 'watchdog', 'build', 'lib3' ), - p.join( DIR_OF_WATCHDOG_DEPS, 'pathtools' ), - p.join( DIR_OF_THIRD_PARTY, 'waitress' ) - ], - 'useLibraryCodeForTypes': True - } - } - } - } - - return {} - - -def PythonSysPath( **kwargs ): - sys_path = kwargs[ 'sys_path' ] - - sys_path[ 0:0 ] = [ p.join( DIR_OF_THIS_SCRIPT ), - p.join( DIR_OF_THIRD_PARTY, 'bottle' ), - p.join( DIR_OF_THIRD_PARTY, 'regex-build' ), - p.join( DIR_OF_THIRD_PARTY, 'frozendict' ), - p.join( DIR_OF_THIRD_PARTY, 'jedi_deps', 'jedi' ), - p.join( DIR_OF_THIRD_PARTY, 'jedi_deps', 'parso' ), - p.join( DIR_OF_WATCHDOG_DEPS, - 'watchdog', - 'build', - 'lib3' ), - p.join( DIR_OF_WATCHDOG_DEPS, 'pathtools' ), - p.join( DIR_OF_THIRD_PARTY, 'waitress' ) ] - - sys_path.append( p.join( DIR_OF_THIRD_PARTY, 'jedi_deps', 'numpydoc' ) ) - return sys_path